public static ims.icps.configuration.domain.objects.ICPPhase extractICPPhase( ims.domain.ILightweightDomainFactory domainFactory, ims.icp.vo.ICPPhaseListVo valueObject, HashMap domMap) { if (null == valueObject) { return null; } Integer id = valueObject.getID_ICPPhase(); ims.icps.configuration.domain.objects.ICPPhase domainObject = null; if (null == id) { if (domMap.get(valueObject) != null) { return (ims.icps.configuration.domain.objects.ICPPhase) domMap.get(valueObject); } // ims.icp.vo.ICPPhaseListVo ID_ICPPhase field is unknown domainObject = new ims.icps.configuration.domain.objects.ICPPhase(); domMap.put(valueObject, domainObject); } else { String key = (valueObject.getClass().getName() + "__" + valueObject.getID_ICPPhase()); if (domMap.get(key) != null) { return (ims.icps.configuration.domain.objects.ICPPhase) domMap.get(key); } domainObject = (ims.icps.configuration.domain.objects.ICPPhase) domainFactory.getDomainObject( ims.icps.configuration.domain.objects.ICPPhase.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_ICPPhase()); // 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()); // 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.getDescription() != null && valueObject.getDescription().equals("")) { valueObject.setDescription(null); } domainObject.setDescription(valueObject.getDescription()); // create LookupInstance from vo LookupType ims.domain.lookups.LookupInstance value3 = null; if (null != valueObject.getStatus()) { value3 = domainFactory.getLookupInstance(valueObject.getStatus().getID()); } domainObject.setStatus(value3); return domainObject; }
/** * Copy one ValueObject to another * * @param valueObjectDest to be updated * @param valueObjectSrc to copy values from */ public static ims.icp.vo.ICPPhaseListVo copy( ims.icp.vo.ICPPhaseListVo valueObjectDest, ims.icp.vo.ICPPhaseListVo valueObjectSrc) { if (null == valueObjectSrc) { return valueObjectSrc; } valueObjectDest.setID_ICPPhase(valueObjectSrc.getID_ICPPhase()); valueObjectDest.setIsRIE(valueObjectSrc.getIsRIE()); // Name valueObjectDest.setName(valueObjectSrc.getName()); // Description valueObjectDest.setDescription(valueObjectSrc.getDescription()); // Status valueObjectDest.setStatus(valueObjectSrc.getStatus()); return valueObjectDest; }