public static ims.core.resource.place.domain.objects.Location extractLocation( ims.domain.ILightweightDomainFactory domainFactory, ims.admin.vo.LocationShortVo valueObject, HashMap domMap) { if (null == valueObject) { return null; } Integer id = valueObject.getID_Location(); ims.core.resource.place.domain.objects.Location domainObject = null; if (null == id) { if (domMap.get(valueObject) != null) { return (ims.core.resource.place.domain.objects.Location) domMap.get(valueObject); } // ims.admin.vo.LocationShortVo ID_Location field is unknown domainObject = new ims.core.resource.place.domain.objects.Location(); domMap.put(valueObject, domainObject); } else { String key = (valueObject.getClass().getName() + "__" + valueObject.getID_Location()); if (domMap.get(key) != null) { return (ims.core.resource.place.domain.objects.Location) domMap.get(key); } domainObject = (ims.core.resource.place.domain.objects.Location) domainFactory.getDomainObject( ims.core.resource.place.domain.objects.Location.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_Location()); // 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.getUpperName() != null && valueObject.getUpperName().equals("")) { valueObject.setUpperName(null); } domainObject.setUpperName(valueObject.getUpperName()); // 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()); domainObject.setIsActive(valueObject.getIsActive()); domainObject.setIsVirtual(valueObject.getIsVirtual()); // create LookupInstance from vo LookupType ims.domain.lookups.LookupInstance value5 = null; if (null != valueObject.getType()) { value5 = domainFactory.getLookupInstance(valueObject.getType().getID()); } domainObject.setType(value5); domainObject.setDisplayInEDTracking(valueObject.getDisplayInEDTracking()); domainObject.setCaseNoteFolderLocation(valueObject.getCaseNoteFolderLocation()); return domainObject; }
/** * Copy one ValueObject to another * * @param valueObjectDest to be updated * @param valueObjectSrc to copy values from */ public static ims.admin.vo.LocationShortVo copy( ims.admin.vo.LocationShortVo valueObjectDest, ims.admin.vo.LocationShortVo valueObjectSrc) { if (null == valueObjectSrc) { return valueObjectSrc; } valueObjectDest.setID_Location(valueObjectSrc.getID_Location()); valueObjectDest.setIsRIE(valueObjectSrc.getIsRIE()); // UpperName valueObjectDest.setUpperName(valueObjectSrc.getUpperName()); // Name valueObjectDest.setName(valueObjectSrc.getName()); // isActive valueObjectDest.setIsActive(valueObjectSrc.getIsActive()); // IsVirtual valueObjectDest.setIsVirtual(valueObjectSrc.getIsVirtual()); // Type valueObjectDest.setType(valueObjectSrc.getType()); // DisplayInEDTracking valueObjectDest.setDisplayInEDTracking(valueObjectSrc.getDisplayInEDTracking()); // CaseNoteFolderLocation valueObjectDest.setCaseNoteFolderLocation(valueObjectSrc.getCaseNoteFolderLocation()); return valueObjectDest; }
/** * Update the ValueObject with the Domain Object. * * @param map DomainObjectMap of DomainObjects to already created ValueObjects. * @param valueObject to be updated * @param domainObject ims.core.resource.place.domain.objects.Location */ public static ims.admin.vo.LocationShortVo insert( DomainObjectMap map, ims.admin.vo.LocationShortVo valueObject, ims.core.resource.place.domain.objects.Location domainObject) { if (null == domainObject) { return valueObject; } if (null == map) { map = new DomainObjectMap(); } valueObject.setID_Location(domainObject.getId()); valueObject.setIsRIE(domainObject.getIsRIE()); // If this is a recordedInError record, and the domainObject // value isIncludeRecord has not been set, then we return null and // not the value object if (valueObject.getIsRIE() != null && valueObject.getIsRIE().booleanValue() == true && !domainObject.isIncludeRecord()) return null; // If this is not a recordedInError record, and the domainObject // value isIncludeRecord has been set, then we return null and // not the value object if ((valueObject.getIsRIE() == null || valueObject.getIsRIE().booleanValue() == false) && domainObject.isIncludeRecord()) return null; // UpperName valueObject.setUpperName(domainObject.getUpperName()); // Name valueObject.setName(domainObject.getName()); // isActive valueObject.setIsActive(domainObject.isIsActive()); // IsVirtual valueObject.setIsVirtual(domainObject.isIsVirtual()); // Type ims.domain.lookups.LookupInstance instance5 = domainObject.getType(); if (null != instance5) { ims.framework.utils.ImagePath img = null; ims.framework.utils.Color color = null; img = null; if (instance5.getImage() != null) { img = new ims.framework.utils.ImagePath( instance5.getImage().getImageId(), instance5.getImage().getImagePath()); } color = instance5.getColor(); if (color != null) color.getValue(); ims.core.vo.lookups.LocationType voLookup5 = new ims.core.vo.lookups.LocationType( instance5.getId(), instance5.getText(), instance5.isActive(), null, img, color); ims.core.vo.lookups.LocationType parentVoLookup5 = voLookup5; ims.domain.lookups.LookupInstance parent5 = instance5.getParent(); while (parent5 != null) { if (parent5.getImage() != null) { img = new ims.framework.utils.ImagePath( parent5.getImage().getImageId(), parent5.getImage().getImagePath()); } else { img = null; } color = parent5.getColor(); if (color != null) color.getValue(); parentVoLookup5.setParent( new ims.core.vo.lookups.LocationType( parent5.getId(), parent5.getText(), parent5.isActive(), null, img, color)); parentVoLookup5 = parentVoLookup5.getParent(); parent5 = parent5.getParent(); } valueObject.setType(voLookup5); } // DisplayInEDTracking valueObject.setDisplayInEDTracking(domainObject.isDisplayInEDTracking()); // CaseNoteFolderLocation valueObject.setCaseNoteFolderLocation(domainObject.isCaseNoteFolderLocation()); return valueObject; }