oldVersionNo = sqlEntityInfo.getVersionFieldInfo().getGetter().invoke(record); if (entityPolicy != null) { if (entityPolicy.isSetNow()) { entityPolicy.preUpdate(record, getNow()); } else { entityPolicy.preUpdate(record, null); } else { if (entityPolicy != null) { if (entityPolicy.isSetNow()) { entityPolicy.preUpdate(record, getNow()); } else { entityPolicy.preUpdate(record, null); entityPolicy.onUpdateError(record);
oldVersionNo = sqlEntityInfo.getVersionFieldInfo().getGetter().invoke(record); if (entityPolicy != null) { if (entityPolicy.isSetNow()) { entityPolicy.preDelete(record, getNow()); } else { entityPolicy.preDelete(record, null); } else { if (entityPolicy != null) { if (entityPolicy.isSetNow()) { entityPolicy.preDelete(record, getNow()); } else { entityPolicy.preDelete(record, null); entityPolicy.onDeleteError(record);
@Override public Object create(Entity record) throws UnifyException { SqlEntityInfo sqlEntityInfo = sqlDataSourceDialect.getSqlEntityInfo(SqlUtils.getEntityClass(record)); EntityPolicy entityPolicy = sqlEntityInfo.getEntityPolicy(); Object id = null; if (entityPolicy != null) { if (entityPolicy.isSetNow()) { id = entityPolicy.preCreate(record, getNow()); } else { id = entityPolicy.preCreate(record, null); } } SqlStatement sqlStatement = sqlDataSourceDialect.prepareCreateStatement(record); try { getSqlStatementExecutor().executeUpdate(connection, sqlStatement); if (sqlEntityInfo.isChildList()) { createChildRecords(sqlEntityInfo, record, id); } } catch (UnifyException e) { throw e; } finally { sqlDataSourceDialect.restoreStatement(sqlStatement); } return id; }
try { if (entityPolicy != null) { if (entityPolicy.isSetNow()) { entityPolicy.preDelete(record, getNow()); } else { entityPolicy.preDelete(record, null); entityPolicy.onDeleteError(record);
try { if (entityPolicy != null) { if (entityPolicy.isSetNow()) { entityPolicy.preUpdate(record, getNow()); } else { entityPolicy.preUpdate(record, null); entityPolicy.onUpdateError(record);