/** * Copy one ValueObject to another * * @param valueObjectDest to be updated * @param valueObjectSrc to copy values from */ public static ims.clinicaladmin.vo.TumourGroupListForPrimaryTumourDetailsVo copy( ims.clinicaladmin.vo.TumourGroupListForPrimaryTumourDetailsVo valueObjectDest, ims.clinicaladmin.vo.TumourGroupListForPrimaryTumourDetailsVo valueObjectSrc) { if (null == valueObjectSrc) { return valueObjectSrc; } valueObjectDest.setID_TumourGroup(valueObjectSrc.getID_TumourGroup()); valueObjectDest.setIsRIE(valueObjectSrc.getIsRIE()); // GroupName valueObjectDest.setGroupName(valueObjectSrc.getGroupName()); // Sites valueObjectDest.setSites(valueObjectSrc.getSites()); // TnmRequiresOver45 valueObjectDest.setTnmRequiresOver45(valueObjectSrc.getTnmRequiresOver45()); // isActive valueObjectDest.setIsActive(valueObjectSrc.getIsActive()); // TNMValues valueObjectDest.setTNMValues(valueObjectSrc.getTNMValues()); // SerumMarkers valueObjectDest.setSerumMarkers(valueObjectSrc.getSerumMarkers()); // OtherClassifications valueObjectDest.setOtherClassifications(valueObjectSrc.getOtherClassifications()); // AssociatedSpecialties valueObjectDest.setAssociatedSpecialties(valueObjectSrc.getAssociatedSpecialties()); // hasTNM valueObjectDest.setHasTNM(valueObjectSrc.getHasTNM()); // Histologies valueObjectDest.setHistologies(valueObjectSrc.getHistologies()); // HistopathologicGrades valueObjectDest.setHistopathologicGrades(valueObjectSrc.getHistopathologicGrades()); // Assessment valueObjectDest.setAssessment(valueObjectSrc.getAssessment()); // isPrognosticGroupingRelevant valueObjectDest.setIsPrognosticGroupingRelevant( valueObjectSrc.getIsPrognosticGroupingRelevant()); // PrognosticGroupingConfig valueObjectDest.setPrognosticGroupingConfig(valueObjectSrc.getPrognosticGroupingConfig()); // TnmRequiresDiff valueObjectDest.setTnmRequiresDiff(valueObjectSrc.getTnmRequiresDiff()); // TnmRequiresHisto valueObjectDest.setTnmRequiresHisto(valueObjectSrc.getTnmRequiresHisto()); // TnmRequiresSMarkers valueObjectDest.setTnmRequiresSMarkers(valueObjectSrc.getTnmRequiresSMarkers()); return valueObjectDest; }
public static ims.oncology.configuration.domain.objects.TumourGroup extractTumourGroup( ims.domain.ILightweightDomainFactory domainFactory, ims.clinicaladmin.vo.TumourGroupListForPrimaryTumourDetailsVo valueObject, HashMap domMap) { if (null == valueObject) { return null; } Integer id = valueObject.getID_TumourGroup(); ims.oncology.configuration.domain.objects.TumourGroup domainObject = null; if (null == id) { if (domMap.get(valueObject) != null) { return (ims.oncology.configuration.domain.objects.TumourGroup) domMap.get(valueObject); } // ims.clinicaladmin.vo.TumourGroupListForPrimaryTumourDetailsVo ID_TumourGroup field is // unknown domainObject = new ims.oncology.configuration.domain.objects.TumourGroup(); domMap.put(valueObject, domainObject); } else { String key = (valueObject.getClass().getName() + "__" + valueObject.getID_TumourGroup()); if (domMap.get(key) != null) { return (ims.oncology.configuration.domain.objects.TumourGroup) domMap.get(key); } domainObject = (ims.oncology.configuration.domain.objects.TumourGroup) domainFactory.getDomainObject( ims.oncology.configuration.domain.objects.TumourGroup.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_TumourGroup()); // 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.getGroupName() != null && valueObject.getGroupName().equals("")) { valueObject.setGroupName(null); } domainObject.setGroupName(valueObject.getGroupName()); domainObject.setSites( ims.clinicaladmin.vo.domain.TumourSiteLiteVoAssembler.extractTumourSiteList( domainFactory, valueObject.getSites(), domainObject.getSites(), domMap)); domainObject.setTnmRequiresOver45(valueObject.getTnmRequiresOver45()); domainObject.setIsActive(valueObject.getIsActive()); domainObject.setTNMValues( ims.clinicaladmin.vo.domain.TumourGroupSiteTNMValueListVoAssembler .extractTumourGroupSiteTNMValueList( domainFactory, valueObject.getTNMValues(), domainObject.getTNMValues(), domMap)); domainObject.setSerumMarkers( ims.clinicaladmin.vo.domain.TumourSerumMarkersVoAssembler.extractTumourSerumMarkerSet( domainFactory, valueObject.getSerumMarkers(), domainObject.getSerumMarkers(), domMap)); domainObject.setOtherClassifications( ims.oncology.vo.domain.TumourGroupClassificationVoAssembler .extractTumourGroupClassificationSet( domainFactory, valueObject.getOtherClassifications(), domainObject.getOtherClassifications(), domMap)); domainObject.setAssociatedSpecialties( ims.oncology.vo.domain.TumourGroupSpecialtyVoAssembler.extractTumourGroupSpecialtySet( domainFactory, valueObject.getAssociatedSpecialties(), domainObject.getAssociatedSpecialties(), domMap)); domainObject.setHasTNM(valueObject.getHasTNM()); // SaveAsRefVO treated as RefValueObject ims.oncology.configuration.vo.TumourGroupHistologyRefVoCollection refCollection10 = new ims.oncology.configuration.vo.TumourGroupHistologyRefVoCollection(); if (valueObject.getHistologies() != null) { for (int i10 = 0; i10 < valueObject.getHistologies().size(); i10++) { ims.oncology.configuration.vo.TumourGroupHistologyRefVo ref10 = (ims.oncology.configuration.vo.TumourGroupHistologyRefVo) valueObject.getHistologies().get(i10); refCollection10.add(ref10); } } int size10 = (null == refCollection10) ? 0 : refCollection10.size(); java.util.List domainHistologies10 = domainObject.getHistologies(); if (domainHistologies10 == null) { domainHistologies10 = new java.util.ArrayList(); } for (int i = 0; i < size10; i++) { ims.oncology.configuration.vo.TumourGroupHistologyRefVo vo = refCollection10.get(i); ims.oncology.configuration.domain.objects.TumourGroupHistology dom = null; if (null != vo) { if (vo.getBoId() == null) { if (domMap.get(vo) != null) { dom = (ims.oncology.configuration.domain.objects.TumourGroupHistology) domMap.get(vo); } } else { dom = (ims.oncology.configuration.domain.objects.TumourGroupHistology) domainFactory.getDomainObject( ims.oncology.configuration.domain.objects.TumourGroupHistology.class, vo.getBoId()); } } int domIdx = domainHistologies10.indexOf(dom); if (domIdx == -1) { domainHistologies10.add(i, dom); } else if (i != domIdx && i < domainHistologies10.size()) { Object tmp = domainHistologies10.get(i); domainHistologies10.set(i, domainHistologies10.get(domIdx)); domainHistologies10.set(domIdx, tmp); } } // Remove all ones in domList where index > voCollection.size() as these should // now represent the ones removed from the VO collection. No longer referenced. int i10 = domainHistologies10.size(); while (i10 > size10) { domainHistologies10.remove(i10 - 1); i10 = domainHistologies10.size(); } domainObject.setHistologies(domainHistologies10); domainObject.setHistopathologicGrades( ims.clinicaladmin.vo.domain.TumourGroupHistopathologyGradeVoAssembler .extractTumourGroupHistopathologicGradeSet( domainFactory, valueObject.getHistopathologicGrades(), domainObject.getHistopathologicGrades(), domMap)); ims.assessment.configuration.domain.objects.UserAssessment value12 = null; if (null != valueObject.getAssessment()) { if (valueObject.getAssessment().getBoId() == null) { if (domMap.get(valueObject.getAssessment()) != null) { value12 = (ims.assessment.configuration.domain.objects.UserAssessment) domMap.get(valueObject.getAssessment()); } } else if (valueObject.getBoVersion() == -1) // RefVo was not modified since obtained from the Assembler, no need to update the // BO field { value12 = domainObject.getAssessment(); } else { value12 = (ims.assessment.configuration.domain.objects.UserAssessment) domainFactory.getDomainObject( ims.assessment.configuration.domain.objects.UserAssessment.class, valueObject.getAssessment().getBoId()); } } domainObject.setAssessment(value12); domainObject.setIsPrognosticGroupingRelevant(valueObject.getIsPrognosticGroupingRelevant()); // SaveAsRefVO - treated as a refVo in extract methods ims.oncology.configuration.domain.objects.PrognosticGroupingConfig value14 = null; if (null != valueObject.getPrognosticGroupingConfig()) { if (valueObject.getPrognosticGroupingConfig().getBoId() == null) { if (domMap.get(valueObject.getPrognosticGroupingConfig()) != null) { value14 = (ims.oncology.configuration.domain.objects.PrognosticGroupingConfig) domMap.get(valueObject.getPrognosticGroupingConfig()); } } else { value14 = (ims.oncology.configuration.domain.objects.PrognosticGroupingConfig) domainFactory.getDomainObject( ims.oncology.configuration.domain.objects.PrognosticGroupingConfig.class, valueObject.getPrognosticGroupingConfig().getBoId()); } } domainObject.setPrognosticGroupingConfig(value14); domainObject.setTnmRequiresDiff(valueObject.getTnmRequiresDiff()); domainObject.setTnmRequiresHisto(valueObject.getTnmRequiresHisto()); domainObject.setTnmRequiresSMarkers(valueObject.getTnmRequiresSMarkers()); return domainObject; }