/** * Copy one ValueObject to another * * @param valueObjectDest to be updated * @param valueObjectSrc to copy values from */ public static ims.nursing.vo.PlanOfCareListVo copy( ims.nursing.vo.PlanOfCareListVo valueObjectDest, ims.nursing.vo.PlanOfCareListVo valueObjectSrc) { if (null == valueObjectSrc) { return valueObjectSrc; } valueObjectDest.setID_PlanOfCare(valueObjectSrc.getID_PlanOfCare()); valueObjectDest.setIsRIE(valueObjectSrc.getIsRIE()); // Actions valueObjectDest.setActions(valueObjectSrc.getActions()); // Group valueObjectDest.setGroup(valueObjectSrc.getGroup()); // Title valueObjectDest.setTitle(valueObjectSrc.getTitle()); // StartDateTime valueObjectDest.setStartDateTime(valueObjectSrc.getStartDateTime()); // ResolvedDateTime valueObjectDest.setResolvedDateTime(valueObjectSrc.getResolvedDateTime()); // AssessmentQuestion valueObjectDest.setAssessmentQuestion(valueObjectSrc.getAssessmentQuestion()); // LevelOfIntervention valueObjectDest.setLevelOfIntervention(valueObjectSrc.getLevelOfIntervention()); return valueObjectDest; }
public static ims.nursing.domain.objects.PlanOfCare extractPlanOfCare( ims.domain.ILightweightDomainFactory domainFactory, ims.nursing.vo.PlanOfCareListVo valueObject, HashMap domMap) { if (null == valueObject) { return null; } Integer id = valueObject.getID_PlanOfCare(); ims.nursing.domain.objects.PlanOfCare domainObject = null; if (null == id) { if (domMap.get(valueObject) != null) { return (ims.nursing.domain.objects.PlanOfCare) domMap.get(valueObject); } // ims.nursing.vo.PlanOfCareListVo ID_PlanOfCare field is unknown domainObject = new ims.nursing.domain.objects.PlanOfCare(); domMap.put(valueObject, domainObject); } else { String key = (valueObject.getClass().getName() + "__" + valueObject.getID_PlanOfCare()); if (domMap.get(key) != null) { return (ims.nursing.domain.objects.PlanOfCare) domMap.get(key); } domainObject = (ims.nursing.domain.objects.PlanOfCare) domainFactory.getDomainObject(ims.nursing.domain.objects.PlanOfCare.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_PlanOfCare()); domainObject.setActions( ims.nursing.vo.domain.PlanOfCareActionsVoAssembler.extractPlanOfCareActionsSet( domainFactory, valueObject.getActions(), domainObject.getActions(), domMap)); // create LookupInstance from vo LookupType ims.domain.lookups.LookupInstance value2 = null; if (null != valueObject.getGroup()) { value2 = domainFactory.getLookupInstance(valueObject.getGroup().getID()); } domainObject.setGroup(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()); ims.framework.utils.DateTime dateTime4 = valueObject.getStartDateTime(); java.util.Date value4 = null; if (dateTime4 != null) { value4 = dateTime4.getJavaDate(); } domainObject.setStartDateTime(value4); ims.framework.utils.DateTime dateTime5 = valueObject.getResolvedDateTime(); java.util.Date value5 = null; if (dateTime5 != null) { value5 = dateTime5.getJavaDate(); } domainObject.setResolvedDateTime(value5); domainObject.setAssessmentQuestion( ims.core.vo.domain.AssessmentQuestionShortVoAssembler.extractAssessmentQuestion( domainFactory, valueObject.getAssessmentQuestion(), domMap)); domainObject.setLevelOfIntervention(valueObject.getLevelOfIntervention()); return domainObject; }