/** * 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; }
/** * Update the ValueObject with the Domain Object. * * @param map DomainObjectMap of DomainObjects to already created ValueObjects. * @param valueObject to be updated * @param domainObject ims.nursing.domain.objects.PlanOfCare */ public static ims.nursing.vo.PlanOfCareListVo insert( DomainObjectMap map, ims.nursing.vo.PlanOfCareListVo valueObject, ims.nursing.domain.objects.PlanOfCare domainObject) { if (null == domainObject) { return valueObject; } if (null == map) { map = new DomainObjectMap(); } valueObject.setID_PlanOfCare(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; // Actions valueObject.setActions( ims.nursing.vo.domain.PlanOfCareActionsVoAssembler .createPlanOfCareActionsVoCollectionFromPlanOfCareActions( map, domainObject.getActions())); // Group ims.domain.lookups.LookupInstance instance2 = domainObject.getGroup(); if (null != instance2) { ims.framework.utils.ImagePath img = null; ims.framework.utils.Color color = null; img = null; if (instance2.getImage() != null) { img = new ims.framework.utils.ImagePath( instance2.getImage().getImageId(), instance2.getImage().getImagePath()); } color = instance2.getColor(); if (color != null) color.getValue(); ims.clinical.vo.lookups.PlanOfCareGroupings voLookup2 = new ims.clinical.vo.lookups.PlanOfCareGroupings( instance2.getId(), instance2.getText(), instance2.isActive(), null, img, color); ims.clinical.vo.lookups.PlanOfCareGroupings parentVoLookup2 = voLookup2; ims.domain.lookups.LookupInstance parent2 = instance2.getParent(); while (parent2 != null) { if (parent2.getImage() != null) { img = new ims.framework.utils.ImagePath( parent2.getImage().getImageId(), parent2.getImage().getImagePath()); } else { img = null; } color = parent2.getColor(); if (color != null) color.getValue(); parentVoLookup2.setParent( new ims.clinical.vo.lookups.PlanOfCareGroupings( parent2.getId(), parent2.getText(), parent2.isActive(), null, img, color)); parentVoLookup2 = parentVoLookup2.getParent(); parent2 = parent2.getParent(); } valueObject.setGroup(voLookup2); } // Title valueObject.setTitle(domainObject.getTitle()); // StartDateTime java.util.Date StartDateTime = domainObject.getStartDateTime(); if (null != StartDateTime) { valueObject.setStartDateTime(new ims.framework.utils.DateTime(StartDateTime)); } // ResolvedDateTime java.util.Date ResolvedDateTime = domainObject.getResolvedDateTime(); if (null != ResolvedDateTime) { valueObject.setResolvedDateTime(new ims.framework.utils.DateTime(ResolvedDateTime)); } // AssessmentQuestion valueObject.setAssessmentQuestion( ims.core.vo.domain.AssessmentQuestionShortVoAssembler.create( map, domainObject.getAssessmentQuestion())); // LevelOfIntervention valueObject.setLevelOfIntervention(domainObject.getLevelOfIntervention()); return valueObject; }