beganTransaction = TransactionUtil.begin();
}
EntityEcaRuleRunner<?> ecaRunner = this.getEcaRuleRunner(value.getEntityName());
ecaRunner.evalRules(EntityEcaHandler.EV_VALIDATE, EntityEcaHandler.OP_STORE, value, false);
GenericHelper helper = getEntityHelper(value.getEntityName());
if (doCacheClear) {
// always clear cache before the operation
ecaRunner.evalRules(EntityEcaHandler.EV_CACHE_CLEAR, EntityEcaHandler.OP_STORE, value, false);
this.clearCacheLine(value);
}
ecaRunner.evalRules(EntityEcaHandler.EV_RUN, EntityEcaHandler.OP_STORE, value, false);
this.encryptFields(value);
// if audit log on for any fields, save old value before the update so we still have both
if (value.getModelEntity().getHasFieldWithAuditLog()) {
createEntityAuditLogAll(value, true, false);
}
GenericValue updatedEntity = null;
if (testMode) {
updatedEntity = this.findOne(value.entityName, value.getPrimaryKey(), false);
}
int retVal = helper.store(value);
if (testMode) {
storeForTestRollback(new TestOperation(OperationType.UPDATE, updatedEntity));
}
// refresh the valueObject to get the new version