/** * Copy one ValueObject to another * * @param valueObjectDest to be updated * @param valueObjectSrc to copy values from */ public static ims.clinical.vo.PatientAbsentProcedureVo copy( ims.clinical.vo.PatientAbsentProcedureVo valueObjectDest, ims.clinical.vo.PatientAbsentProcedureVo valueObjectSrc) { if (null == valueObjectSrc) { return valueObjectSrc; } valueObjectDest.setID_PatientAbsentProcedure(valueObjectSrc.getID_PatientAbsentProcedure()); valueObjectDest.setIsRIE(valueObjectSrc.getIsRIE()); // Procedure valueObjectDest.setProcedure(valueObjectSrc.getProcedure()); // Selected valueObjectDest.setSelected(valueObjectSrc.getSelected()); // SourceofInformation valueObjectDest.setSourceofInformation(valueObjectSrc.getSourceofInformation()); return valueObjectDest; }
public static ims.clinical.domain.objects.PatientAbsentProcedure extractPatientAbsentProcedure( ims.domain.ILightweightDomainFactory domainFactory, ims.clinical.vo.PatientAbsentProcedureVo valueObject, HashMap domMap) { if (null == valueObject) { return null; } Integer id = valueObject.getID_PatientAbsentProcedure(); ims.clinical.domain.objects.PatientAbsentProcedure domainObject = null; if (null == id) { if (domMap.get(valueObject) != null) { return (ims.clinical.domain.objects.PatientAbsentProcedure) domMap.get(valueObject); } // ims.clinical.vo.PatientAbsentProcedureVo ID_PatientAbsentProcedure field is unknown domainObject = new ims.clinical.domain.objects.PatientAbsentProcedure(); domMap.put(valueObject, domainObject); } else { String key = (valueObject.getClass().getName() + "__" + valueObject.getID_PatientAbsentProcedure()); if (domMap.get(key) != null) { return (ims.clinical.domain.objects.PatientAbsentProcedure) domMap.get(key); } domainObject = (ims.clinical.domain.objects.PatientAbsentProcedure) domainFactory.getDomainObject( ims.clinical.domain.objects.PatientAbsentProcedure.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_PatientAbsentProcedure()); // SaveAsRefVO - treated as a refVo in extract methods ims.core.clinical.domain.objects.Procedure value1 = null; if (null != valueObject.getProcedure()) { if (valueObject.getProcedure().getBoId() == null) { if (domMap.get(valueObject.getProcedure()) != null) { value1 = (ims.core.clinical.domain.objects.Procedure) domMap.get(valueObject.getProcedure()); } } else { value1 = (ims.core.clinical.domain.objects.Procedure) domainFactory.getDomainObject( ims.core.clinical.domain.objects.Procedure.class, valueObject.getProcedure().getBoId()); } } domainObject.setProcedure(value1); // create LookupInstance from vo LookupType ims.domain.lookups.LookupInstance value2 = null; if (null != valueObject.getSelected()) { value2 = domainFactory.getLookupInstance(valueObject.getSelected().getID()); } domainObject.setSelected(value2); // create LookupInstance from vo LookupType ims.domain.lookups.LookupInstance value3 = null; if (null != valueObject.getSourceofInformation()) { value3 = domainFactory.getLookupInstance(valueObject.getSourceofInformation().getID()); } domainObject.setSourceofInformation(value3); 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.clinical.domain.objects.PatientAbsentProcedure */ public static ims.clinical.vo.PatientAbsentProcedureVo insert( DomainObjectMap map, ims.clinical.vo.PatientAbsentProcedureVo valueObject, ims.clinical.domain.objects.PatientAbsentProcedure domainObject) { if (null == domainObject) { return valueObject; } if (null == map) { map = new DomainObjectMap(); } valueObject.setID_PatientAbsentProcedure(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; // Procedure valueObject.setProcedure( ims.core.vo.domain.ProcedureLiteVoAssembler.create(map, domainObject.getProcedure())); // Selected ims.domain.lookups.LookupInstance instance2 = domainObject.getSelected(); 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.PresentAbsentUnknown voLookup2 = new ims.clinical.vo.lookups.PresentAbsentUnknown( instance2.getId(), instance2.getText(), instance2.isActive(), null, img, color); ims.clinical.vo.lookups.PresentAbsentUnknown 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.PresentAbsentUnknown( parent2.getId(), parent2.getText(), parent2.isActive(), null, img, color)); parentVoLookup2 = parentVoLookup2.getParent(); parent2 = parent2.getParent(); } valueObject.setSelected(voLookup2); } // SourceofInformation ims.domain.lookups.LookupInstance instance3 = domainObject.getSourceofInformation(); if (null != instance3) { ims.framework.utils.ImagePath img = null; ims.framework.utils.Color color = null; img = null; if (instance3.getImage() != null) { img = new ims.framework.utils.ImagePath( instance3.getImage().getImageId(), instance3.getImage().getImagePath()); } color = instance3.getColor(); if (color != null) color.getValue(); ims.core.vo.lookups.SourceofInformation voLookup3 = new ims.core.vo.lookups.SourceofInformation( instance3.getId(), instance3.getText(), instance3.isActive(), null, img, color); ims.core.vo.lookups.SourceofInformation parentVoLookup3 = voLookup3; ims.domain.lookups.LookupInstance parent3 = instance3.getParent(); while (parent3 != null) { if (parent3.getImage() != null) { img = new ims.framework.utils.ImagePath( parent3.getImage().getImageId(), parent3.getImage().getImagePath()); } else { img = null; } color = parent3.getColor(); if (color != null) color.getValue(); parentVoLookup3.setParent( new ims.core.vo.lookups.SourceofInformation( parent3.getId(), parent3.getText(), parent3.isActive(), null, img, color)); parentVoLookup3 = parentVoLookup3.getParent(); parent3 = parent3.getParent(); } valueObject.setSourceofInformation(voLookup3); } return valueObject; }