use of alma.cdbErrType.CDBFieldIsReadOnlyEx in project ACS by ACS-Community.
the class HibernateWDALImpl method saveChanges.
/**
* Save changes given by map to the node identified by curl
*
* @param curl
* @param propertyMap
*
* @throws CDBXMLErrorEx
* @throws CDBExceptionEx
* @throws CDBFieldDoesNotExistEx
*/
public void saveChanges(String curl, Map propertyMap) throws CDBXMLErrorEx, CDBExceptionEx, CDBFieldDoesNotExistEx, CDBRecordDoesNotExistEx {
Object node = curl.length() == 0 ? rootNode : DOMJavaClassIntrospector.getNode(curl, rootNode);
if (node == null || DOMJavaClassIntrospector.isPrimitive(node.getClass())) {
AcsJCDBRecordDoesNotExistEx ex = new AcsJCDBRecordDoesNotExistEx();
ex.setCurl(curl);
m_logger.log(AcsLogLevel.NOTICE, "WDAL::saveChanges " + ex.getShortDescription());
throw ex.toCDBRecordDoesNotExistEx();
}
boolean commit = false;
Transaction tr = mainSession.beginTransaction();
try {
HibernateWDAOImpl wdao = new HibernateWDAOImpl(mainSession, curl, node, poa, m_logger, false, false);
for (Object key : propertyMap.keySet()) {
String propertyName = key.toString();
wdao.set_field_data(propertyName, propertyMap.get(propertyName).toString());
}
commit = true;
} catch (CDBFieldIsReadOnlyEx fne) {
AcsJCDBExceptionEx cdbex = new AcsJCDBExceptionEx(fne);
throw cdbex.toCDBExceptionEx();
} catch (WrongCDBDataTypeEx fne) {
AcsJCDBExceptionEx cdbex = new AcsJCDBExceptionEx(fne);
throw cdbex.toCDBExceptionEx();
} finally {
if (commit)
tr.commit();
else
tr.rollback();
}
/// TODO revert memory state?!!!
}
Aggregations