/** * Copy one ValueObject to another * * @param valueObjectDest to be updated * @param valueObjectSrc to copy values from */ public static ims.assessment.vo.UserDefinedObjectListVo copy( ims.assessment.vo.UserDefinedObjectListVo valueObjectDest, ims.assessment.vo.UserDefinedObjectListVo valueObjectSrc) { if (null == valueObjectSrc) { return valueObjectSrc; } valueObjectDest.setID_UserDefinedObject(valueObjectSrc.getID_UserDefinedObject()); valueObjectDest.setIsRIE(valueObjectSrc.getIsRIE()); // Components valueObjectDest.setComponents(valueObjectSrc.getComponents()); // Name valueObjectDest.setName(valueObjectSrc.getName()); // ObjectType valueObjectDest.setObjectType(valueObjectSrc.getObjectType()); // ActiveStatus valueObjectDest.setActiveStatus(valueObjectSrc.getActiveStatus()); return valueObjectDest; }
public static ims.assessment.configuration.domain.objects.UserDefinedObject extractUserDefinedObject( ims.domain.ILightweightDomainFactory domainFactory, ims.assessment.vo.UserDefinedObjectListVo valueObject, HashMap domMap) { if (null == valueObject) { return null; } Integer id = valueObject.getID_UserDefinedObject(); ims.assessment.configuration.domain.objects.UserDefinedObject domainObject = null; if (null == id) { if (domMap.get(valueObject) != null) { return (ims.assessment.configuration.domain.objects.UserDefinedObject) domMap.get(valueObject); } // ims.assessment.vo.UserDefinedObjectListVo ID_UserDefinedObject field is unknown domainObject = new ims.assessment.configuration.domain.objects.UserDefinedObject(); domMap.put(valueObject, domainObject); } else { String key = (valueObject.getClass().getName() + "__" + valueObject.getID_UserDefinedObject()); if (domMap.get(key) != null) { return (ims.assessment.configuration.domain.objects.UserDefinedObject) domMap.get(key); } domainObject = (ims.assessment.configuration.domain.objects.UserDefinedObject) domainFactory.getDomainObject( ims.assessment.configuration.domain.objects.UserDefinedObject.class, id); // TODO: Not sure how this should be handled. Effectively it must be a staleobject exception, // but maybe should be handled as that further up. if (domainObject == null) return null; domMap.put(key, domainObject); } domainObject.setVersion(valueObject.getVersion_UserDefinedObject()); domainObject.setComponents( ims.assessment.vo.domain.UserDefinedObjectComponentListVoAssembler .extractUserDefinedObjectComponentList( domainFactory, valueObject.getComponents(), domainObject.getComponents(), domMap)); // This is to overcome a bug in both Sybase and Oracle which prevents them from storing an empty // string correctly // Sybase stores it as a single space, Oracle stores it as NULL. This fix will make them // consistent at least. if (valueObject.getName() != null && valueObject.getName().equals("")) { valueObject.setName(null); } domainObject.setName(valueObject.getName()); // create LookupInstance from vo LookupType ims.domain.lookups.LookupInstance value3 = null; if (null != valueObject.getObjectType()) { value3 = domainFactory.getLookupInstance(valueObject.getObjectType().getID()); } domainObject.setObjectType(value3); // create LookupInstance from vo LookupType ims.domain.lookups.LookupInstance value4 = null; if (null != valueObject.getActiveStatus()) { value4 = domainFactory.getLookupInstance(valueObject.getActiveStatus().getID()); } domainObject.setActiveStatus(value4); return domainObject; }