public static ims.nursing.careplans.domain.objects.CarePlanTemplate extractCarePlanTemplate( ims.domain.ILightweightDomainFactory domainFactory, ims.nursing.vo.CarePlanTemplateTitle valueObject, HashMap domMap) { if (null == valueObject) { return null; } Integer id = valueObject.getID_CarePlanTemplate(); ims.nursing.careplans.domain.objects.CarePlanTemplate domainObject = null; if (null == id) { if (domMap.get(valueObject) != null) { return (ims.nursing.careplans.domain.objects.CarePlanTemplate) domMap.get(valueObject); } // ims.nursing.vo.CarePlanTemplateTitle ID_CarePlanTemplate field is unknown domainObject = new ims.nursing.careplans.domain.objects.CarePlanTemplate(); domMap.put(valueObject, domainObject); } else { String key = (valueObject.getClass().getName() + "__" + valueObject.getID_CarePlanTemplate()); if (domMap.get(key) != null) { return (ims.nursing.careplans.domain.objects.CarePlanTemplate) domMap.get(key); } domainObject = (ims.nursing.careplans.domain.objects.CarePlanTemplate) domainFactory.getDomainObject( ims.nursing.careplans.domain.objects.CarePlanTemplate.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_CarePlanTemplate()); java.util.Date value1 = null; ims.framework.utils.Date date1 = valueObject.getCreationDate(); if (date1 != null) { value1 = date1.getDate(); } domainObject.setCreationDate(value1); // create LookupInstance from vo LookupType ims.domain.lookups.LookupInstance value2 = null; if (null != valueObject.getAssessmentComponent()) { value2 = domainFactory.getLookupInstance(valueObject.getAssessmentComponent().getID()); } domainObject.setAssessmentComponent(value2); // 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.getTitle() != null && valueObject.getTitle().equals("")) { valueObject.setTitle(null); } domainObject.setTitle(valueObject.getTitle()); domainObject.setActive(valueObject.getActive()); return domainObject; }
/** * Copy one ValueObject to another * * @param valueObjectDest to be updated * @param valueObjectSrc to copy values from */ public static ims.nursing.vo.CarePlanTemplateTitle copy( ims.nursing.vo.CarePlanTemplateTitle valueObjectDest, ims.nursing.vo.CarePlanTemplateTitle valueObjectSrc) { if (null == valueObjectSrc) { return valueObjectSrc; } valueObjectDest.setID_CarePlanTemplate(valueObjectSrc.getID_CarePlanTemplate()); valueObjectDest.setIsRIE(valueObjectSrc.getIsRIE()); // CreationDate valueObjectDest.setCreationDate(valueObjectSrc.getCreationDate()); // AssessmentComponent valueObjectDest.setAssessmentComponent(valueObjectSrc.getAssessmentComponent()); // Title valueObjectDest.setTitle(valueObjectSrc.getTitle()); // Active valueObjectDest.setActive(valueObjectSrc.getActive()); return valueObjectDest; }