/** * 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.configuration.domain.objects.ElectiveListConfiguration */ public static ims.admin.vo.ElectiveListConfigForElectiveListDetailsVo insert( DomainObjectMap map, ims.admin.vo.ElectiveListConfigForElectiveListDetailsVo valueObject, ims.core.configuration.domain.objects.ElectiveListConfiguration domainObject) { if (null == domainObject) { return valueObject; } if (null == map) { map = new DomainObjectMap(); } valueObject.setID_ElectiveListConfiguration(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; // ListLocations valueObject.setListLocations( ims.RefMan.vo.domain.ElectiveListHospitalConfigurationWLVoAssembler .createElectiveListHospitalConfigurationWLVoCollectionFromElectiveListHospitalConfiguration( map, domainObject.getListLocations())); // WaitingListName valueObject.setWaitingListName(domainObject.getWaitingListName()); // StartDate java.util.Date StartDate = domainObject.getStartDate(); if (null != StartDate) { valueObject.setStartDate(new ims.framework.utils.Date(StartDate)); } // EndDate java.util.Date EndDate = domainObject.getEndDate(); if (null != EndDate) { valueObject.setEndDate(new ims.framework.utils.Date(EndDate)); } // WaitingListCode valueObject.setWaitingListCode(domainObject.getWaitingListCode()); // IsActive valueObject.setIsActive(domainObject.isIsActive()); return valueObject; }
/** * Copy one ValueObject to another * * @param valueObjectDest to be updated * @param valueObjectSrc to copy values from */ public static ims.admin.vo.ElectiveListConfigForElectiveListDetailsVo copy( ims.admin.vo.ElectiveListConfigForElectiveListDetailsVo valueObjectDest, ims.admin.vo.ElectiveListConfigForElectiveListDetailsVo valueObjectSrc) { if (null == valueObjectSrc) { return valueObjectSrc; } valueObjectDest.setID_ElectiveListConfiguration( valueObjectSrc.getID_ElectiveListConfiguration()); valueObjectDest.setIsRIE(valueObjectSrc.getIsRIE()); // ListLocations valueObjectDest.setListLocations(valueObjectSrc.getListLocations()); // WaitingListName valueObjectDest.setWaitingListName(valueObjectSrc.getWaitingListName()); // StartDate valueObjectDest.setStartDate(valueObjectSrc.getStartDate()); // EndDate valueObjectDest.setEndDate(valueObjectSrc.getEndDate()); // WaitingListCode valueObjectDest.setWaitingListCode(valueObjectSrc.getWaitingListCode()); // IsActive valueObjectDest.setIsActive(valueObjectSrc.getIsActive()); return valueObjectDest; }
public static ims.core.configuration.domain.objects.ElectiveListConfiguration extractElectiveListConfiguration( ims.domain.ILightweightDomainFactory domainFactory, ims.admin.vo.ElectiveListConfigForElectiveListDetailsVo valueObject, HashMap domMap) { if (null == valueObject) { return null; } Integer id = valueObject.getID_ElectiveListConfiguration(); ims.core.configuration.domain.objects.ElectiveListConfiguration domainObject = null; if (null == id) { if (domMap.get(valueObject) != null) { return (ims.core.configuration.domain.objects.ElectiveListConfiguration) domMap.get(valueObject); } // ims.admin.vo.ElectiveListConfigForElectiveListDetailsVo ID_ElectiveListConfiguration field // is unknown domainObject = new ims.core.configuration.domain.objects.ElectiveListConfiguration(); domMap.put(valueObject, domainObject); } else { String key = (valueObject.getClass().getName() + "__" + valueObject.getID_ElectiveListConfiguration()); if (domMap.get(key) != null) { return (ims.core.configuration.domain.objects.ElectiveListConfiguration) domMap.get(key); } domainObject = (ims.core.configuration.domain.objects.ElectiveListConfiguration) domainFactory.getDomainObject( ims.core.configuration.domain.objects.ElectiveListConfiguration.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_ElectiveListConfiguration()); // SaveAsRefVO treated as RefValueObject ims.core.configuration.vo.ElectiveListHospitalConfigurationRefVoCollection refCollection1 = new ims.core.configuration.vo.ElectiveListHospitalConfigurationRefVoCollection(); if (valueObject.getListLocations() != null) { for (int i1 = 0; i1 < valueObject.getListLocations().size(); i1++) { ims.core.configuration.vo.ElectiveListHospitalConfigurationRefVo ref1 = (ims.core.configuration.vo.ElectiveListHospitalConfigurationRefVo) valueObject.getListLocations().get(i1); refCollection1.add(ref1); } } int size1 = (null == refCollection1) ? 0 : refCollection1.size(); java.util.List domainListLocations1 = domainObject.getListLocations(); if (domainListLocations1 == null) { domainListLocations1 = new java.util.ArrayList(); } for (int i = 0; i < size1; i++) { ims.core.configuration.vo.ElectiveListHospitalConfigurationRefVo vo = refCollection1.get(i); ims.core.configuration.domain.objects.ElectiveListHospitalConfiguration dom = null; if (null != vo) { if (vo.getBoId() == null) { if (domMap.get(vo) != null) { dom = (ims.core.configuration.domain.objects.ElectiveListHospitalConfiguration) domMap.get(vo); } } else { dom = (ims.core.configuration.domain.objects.ElectiveListHospitalConfiguration) domainFactory.getDomainObject( ims.core.configuration.domain.objects.ElectiveListHospitalConfiguration.class, vo.getBoId()); } } int domIdx = domainListLocations1.indexOf(dom); if (domIdx == -1) { domainListLocations1.add(i, dom); } else if (i != domIdx && i < domainListLocations1.size()) { Object tmp = domainListLocations1.get(i); domainListLocations1.set(i, domainListLocations1.get(domIdx)); domainListLocations1.set(domIdx, tmp); } } // Remove all ones in domList where index > voCollection.size() as these should // now represent the ones removed from the VO collection. No longer referenced. int i1 = domainListLocations1.size(); while (i1 > size1) { domainListLocations1.remove(i1 - 1); i1 = domainListLocations1.size(); } domainObject.setListLocations(domainListLocations1); // 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.getWaitingListName() != null && valueObject.getWaitingListName().equals("")) { valueObject.setWaitingListName(null); } domainObject.setWaitingListName(valueObject.getWaitingListName()); java.util.Date value3 = null; ims.framework.utils.Date date3 = valueObject.getStartDate(); if (date3 != null) { value3 = date3.getDate(); } domainObject.setStartDate(value3); java.util.Date value4 = null; ims.framework.utils.Date date4 = valueObject.getEndDate(); if (date4 != null) { value4 = date4.getDate(); } domainObject.setEndDate(value4); // 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.getWaitingListCode() != null && valueObject.getWaitingListCode().equals("")) { valueObject.setWaitingListCode(null); } domainObject.setWaitingListCode(valueObject.getWaitingListCode()); domainObject.setIsActive(valueObject.getIsActive()); return domainObject; }