/** * Copy one ValueObject to another * * @param valueObjectDest to be updated * @param valueObjectSrc to copy values from */ public static ims.nursing.vo.NutritionalRiskAssessmentVo copy( ims.nursing.vo.NutritionalRiskAssessmentVo valueObjectDest, ims.nursing.vo.NutritionalRiskAssessmentVo valueObjectSrc) { if (null == valueObjectSrc) { return valueObjectSrc; } valueObjectDest.setID_Assessment(valueObjectSrc.getID_Assessment()); valueObjectDest.setIsRIE(valueObjectSrc.getIsRIE()); // AssessmentDetails valueObjectDest.setAssessmentDetails(valueObjectSrc.getAssessmentDetails()); // HcpInitiated valueObjectDest.setHcpInitiated(valueObjectSrc.getHcpInitiated()); // DateTimeInitiated valueObjectDest.setDateTimeInitiated(valueObjectSrc.getDateTimeInitiated()); // ClinicalContact valueObjectDest.setClinicalContact(valueObjectSrc.getClinicalContact()); // CareContext valueObjectDest.setCareContext(valueObjectSrc.getCareContext()); return valueObjectDest; }
public static ims.nursing.assessmenttools.domain.objects.NutritionalRiskAssessment extractNutritionalRiskAssessment( ims.domain.ILightweightDomainFactory domainFactory, ims.nursing.vo.NutritionalRiskAssessmentVo valueObject, HashMap domMap) { if (null == valueObject) { return null; } Integer id = valueObject.getID_Assessment(); ims.nursing.assessmenttools.domain.objects.NutritionalRiskAssessment domainObject = null; if (null == id) { if (domMap.get(valueObject) != null) { return (ims.nursing.assessmenttools.domain.objects.NutritionalRiskAssessment) domMap.get(valueObject); } // ims.nursing.vo.NutritionalRiskAssessmentVo ID_NutritionalRiskAssessment field is unknown domainObject = new ims.nursing.assessmenttools.domain.objects.NutritionalRiskAssessment(); domMap.put(valueObject, domainObject); } else { String key = (valueObject.getClass().getName() + "__" + valueObject.getID_Assessment()); if (domMap.get(key) != null) { return (ims.nursing.assessmenttools.domain.objects.NutritionalRiskAssessment) domMap.get(key); } domainObject = (ims.nursing.assessmenttools.domain.objects.NutritionalRiskAssessment) domainFactory.getDomainObject( ims.nursing.assessmenttools.domain.objects.NutritionalRiskAssessment.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_Assessment()); domainObject.setAssessmentDetails( ims.nursing.vo.domain.NutritionalRiskAssessmentDetailsVoAssembler .extractNutritionalRiskAssessmentDetailsSet( domainFactory, valueObject.getAssessmentDetails(), domainObject.getAssessmentDetails(), domMap)); // SaveAsRefVO - treated as a refVo in extract methods ims.core.resource.people.domain.objects.Hcp value2 = null; if (null != valueObject.getHcpInitiated()) { if (valueObject.getHcpInitiated().getBoId() == null) { if (domMap.get(valueObject.getHcpInitiated()) != null) { value2 = (ims.core.resource.people.domain.objects.Hcp) domMap.get(valueObject.getHcpInitiated()); } } else { value2 = (ims.core.resource.people.domain.objects.Hcp) domainFactory.getDomainObject( ims.core.resource.people.domain.objects.Hcp.class, valueObject.getHcpInitiated().getBoId()); } } domainObject.setHcpInitiated(value2); ims.framework.utils.DateTime dateTime3 = valueObject.getDateTimeInitiated(); java.util.Date value3 = null; if (dateTime3 != null) { value3 = dateTime3.getJavaDate(); } domainObject.setDateTimeInitiated(value3); ims.core.admin.domain.objects.ClinicalContact value4 = null; if (null != valueObject.getClinicalContact()) { if (valueObject.getClinicalContact().getBoId() == null) { if (domMap.get(valueObject.getClinicalContact()) != null) { value4 = (ims.core.admin.domain.objects.ClinicalContact) domMap.get(valueObject.getClinicalContact()); } } else if (valueObject.getBoVersion() == -1) // RefVo was not modified since obtained from the Assembler, no need to update the // BO field { value4 = domainObject.getClinicalContact(); } else { value4 = (ims.core.admin.domain.objects.ClinicalContact) domainFactory.getDomainObject( ims.core.admin.domain.objects.ClinicalContact.class, valueObject.getClinicalContact().getBoId()); } } domainObject.setClinicalContact(value4); ims.core.admin.domain.objects.CareContext value5 = null; if (null != valueObject.getCareContext()) { if (valueObject.getCareContext().getBoId() == null) { if (domMap.get(valueObject.getCareContext()) != null) { value5 = (ims.core.admin.domain.objects.CareContext) domMap.get(valueObject.getCareContext()); } } else if (valueObject.getBoVersion() == -1) // RefVo was not modified since obtained from the Assembler, no need to update the // BO field { value5 = domainObject.getCareContext(); } else { value5 = (ims.core.admin.domain.objects.CareContext) domainFactory.getDomainObject( ims.core.admin.domain.objects.CareContext.class, valueObject.getCareContext().getBoId()); } } domainObject.setCareContext(value5); return domainObject; }