@Override public void verifyVersionNumber(Object dataObject) { if (isPersistable(dataObject.getClass())) { PersistableBusinessObject pbObject = businessObjectService.retrieve((PersistableBusinessObject) dataObject); Long pbObjectVerNbr = KRADUtils.isNull(pbObject) ? null : pbObject.getVersionNumber(); Long newObjectVerNbr = ((PersistableBusinessObject) dataObject).getVersionNumber(); if (pbObjectVerNbr != null && !(pbObjectVerNbr.equals(newObjectVerNbr))) { GlobalVariables.getMessageMap() .putError(KRADConstants.GLOBAL_ERRORS, RiceKeyConstants.ERROR_VERSION_MISMATCH); throw new ValidationException( "Version mismatch between the local business object and the database business object"); } } }
public ObjectCode createObjectCode(BusinessObjectService businessObjectService) { return (ObjectCode) businessObjectService.retrieve(this.createObjectCode()); }
@Override public <T> T retrieve(T dataObject) { return (T) businessObjectService.retrieve((PersistableBusinessObject) dataObject); }