/** * Copy one ValueObject to another * * @param valueObjectDest to be updated * @param valueObjectSrc to copy values from */ public static ims.core.vo.BedSpaceStateVo copy( ims.core.vo.BedSpaceStateVo valueObjectDest, ims.core.vo.BedSpaceStateVo valueObjectSrc) { if (null == valueObjectSrc) { return valueObjectSrc; } valueObjectDest.setID_BedSpaceState(valueObjectSrc.getID_BedSpaceState()); valueObjectDest.setIsRIE(valueObjectSrc.getIsRIE()); // CurrentBedStatus valueObjectDest.setCurrentBedStatus(valueObjectSrc.getCurrentBedStatus()); // isMaternity valueObjectDest.setIsMaternity(valueObjectSrc.getIsMaternity()); // NoOfInfants valueObjectDest.setNoOfInfants(valueObjectSrc.getNoOfInfants()); // BedSpace valueObjectDest.setBedSpace(valueObjectSrc.getBedSpace()); // Ward valueObjectDest.setWard(valueObjectSrc.getWard()); // InpatientEpisode valueObjectDest.setInpatientEpisode(valueObjectSrc.getInpatientEpisode()); // PreviousBedStatus valueObjectDest.setPreviousBedStatus(valueObjectSrc.getPreviousBedStatus()); // Comment valueObjectDest.setComment(valueObjectSrc.getComment()); // Bay valueObjectDest.setBay(valueObjectSrc.getBay()); return valueObjectDest; }
public static ims.core.admin.pas.domain.objects.BedSpaceState extractBedSpaceState( ims.domain.ILightweightDomainFactory domainFactory, ims.core.vo.BedSpaceStateVo valueObject, HashMap domMap) { if (null == valueObject) { return null; } Integer id = valueObject.getID_BedSpaceState(); ims.core.admin.pas.domain.objects.BedSpaceState domainObject = null; if (null == id) { if (domMap.get(valueObject) != null) { return (ims.core.admin.pas.domain.objects.BedSpaceState) domMap.get(valueObject); } // ims.core.vo.BedSpaceStateVo ID_BedSpaceState field is unknown domainObject = new ims.core.admin.pas.domain.objects.BedSpaceState(); domMap.put(valueObject, domainObject); } else { String key = (valueObject.getClass().getName() + "__" + valueObject.getID_BedSpaceState()); if (domMap.get(key) != null) { return (ims.core.admin.pas.domain.objects.BedSpaceState) domMap.get(key); } domainObject = (ims.core.admin.pas.domain.objects.BedSpaceState) domainFactory.getDomainObject( ims.core.admin.pas.domain.objects.BedSpaceState.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_BedSpaceState()); domainObject.setCurrentBedStatus( ims.core.vo.domain.BedSpaceStateStatusLiteVoAssembler.extractBedSpaceStateStatus( domainFactory, valueObject.getCurrentBedStatus(), domMap)); domainObject.setIsMaternity(valueObject.getIsMaternity()); domainObject.setNoOfInfants(valueObject.getNoOfInfants()); domainObject.setBedSpace( ims.core.vo.domain.BedSpaceVoAssembler.extractBedSpace( domainFactory, valueObject.getBedSpace(), domMap)); domainObject.setWard( ims.core.vo.domain.LocationLiteVoAssembler.extractLocation( domainFactory, valueObject.getWard(), domMap)); // SaveAsRefVO - treated as a refVo in extract methods ims.core.admin.pas.domain.objects.InpatientEpisode value6 = null; if (null != valueObject.getInpatientEpisode()) { if (valueObject.getInpatientEpisode().getBoId() == null) { if (domMap.get(valueObject.getInpatientEpisode()) != null) { value6 = (ims.core.admin.pas.domain.objects.InpatientEpisode) domMap.get(valueObject.getInpatientEpisode()); } } else { value6 = (ims.core.admin.pas.domain.objects.InpatientEpisode) domainFactory.getDomainObject( ims.core.admin.pas.domain.objects.InpatientEpisode.class, valueObject.getInpatientEpisode().getBoId()); } } domainObject.setInpatientEpisode(value6); domainObject.setPreviousBedStatus( ims.core.vo.domain.BedSpaceStateStatusLiteVoAssembler.extractBedSpaceStateStatus( domainFactory, valueObject.getPreviousBedStatus(), 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.getComment() != null && valueObject.getComment().equals("")) { valueObject.setComment(null); } domainObject.setComment(valueObject.getComment()); // SaveAsRefVO - treated as a refVo in extract methods ims.core.resource.place.domain.objects.Location value9 = null; if (null != valueObject.getBay()) { if (valueObject.getBay().getBoId() == null) { if (domMap.get(valueObject.getBay()) != null) { value9 = (ims.core.resource.place.domain.objects.Location) domMap.get(valueObject.getBay()); } } else { value9 = (ims.core.resource.place.domain.objects.Location) domainFactory.getDomainObject( ims.core.resource.place.domain.objects.Location.class, valueObject.getBay().getBoId()); } } domainObject.setBay(value9); return domainObject; }