/** * Create the ValueObject collection to hold the set of DomainObjects. * * @param map - maps DomainObjects to created ValueObjects * @param domainObjectSet - Set of ims.medical.domain.objects.OPDSpasticityAssessTreat objects. */ public static ims.generalmedical.vo.OPDSpasticityAssessTreatVoCollection createOPDSpasticityAssessTreatVoCollectionFromOPDSpasticityAssessTreat( DomainObjectMap map, java.util.Set domainObjectSet) { ims.generalmedical.vo.OPDSpasticityAssessTreatVoCollection voList = new ims.generalmedical.vo.OPDSpasticityAssessTreatVoCollection(); if (null == domainObjectSet) { return voList; } int rieCount = 0; int activeCount = 0; java.util.Iterator iterator = domainObjectSet.iterator(); while (iterator.hasNext()) { ims.medical.domain.objects.OPDSpasticityAssessTreat domainObject = (ims.medical.domain.objects.OPDSpasticityAssessTreat) iterator.next(); ims.generalmedical.vo.OPDSpasticityAssessTreatVo vo = create(map, domainObject); if (vo != null) voList.add(vo); if (domainObject != null) { if (domainObject.getIsRIE() != null && domainObject.getIsRIE().booleanValue() == true) rieCount++; else activeCount++; } } voList.setRieCount(rieCount); voList.setActiveCount(activeCount); return voList; }
/** * Create the ValueObject collection to hold the list of DomainObjects. * * @param map - maps DomainObjects to created ValueObjects * @param domainObjectList - List of ims.medical.domain.objects.OPDSpasticityAssessTreat objects. */ public static ims.generalmedical.vo.OPDSpasticityAssessTreatVoCollection createOPDSpasticityAssessTreatVoCollectionFromOPDSpasticityAssessTreat( DomainObjectMap map, java.util.List domainObjectList) { ims.generalmedical.vo.OPDSpasticityAssessTreatVoCollection voList = new ims.generalmedical.vo.OPDSpasticityAssessTreatVoCollection(); if (null == domainObjectList) { return voList; } int rieCount = 0; int activeCount = 0; for (int i = 0; i < domainObjectList.size(); i++) { ims.medical.domain.objects.OPDSpasticityAssessTreat domainObject = (ims.medical.domain.objects.OPDSpasticityAssessTreat) domainObjectList.get(i); ims.generalmedical.vo.OPDSpasticityAssessTreatVo vo = create(map, domainObject); if (vo != null) voList.add(vo); if (domainObject != null) { if (domainObject.getIsRIE() != null && domainObject.getIsRIE().booleanValue() == true) rieCount++; else activeCount++; } } voList.setRieCount(rieCount); voList.setActiveCount(activeCount); return voList; }
/** * Create the ValueObject from the ims.medical.domain.objects.OPDSpasticityAssessTreat object. * * @param map DomainObjectMap of DomainObjects to already created ValueObjects. * @param domainObject */ public static ims.generalmedical.vo.OPDSpasticityAssessTreatVo create( DomainObjectMap map, ims.medical.domain.objects.OPDSpasticityAssessTreat domainObject) { if (null == domainObject) { return null; } // check if the domainObject already has a valueObject created for it ims.generalmedical.vo.OPDSpasticityAssessTreatVo valueObject = (ims.generalmedical.vo.OPDSpasticityAssessTreatVo) map.getValueObject( domainObject, ims.generalmedical.vo.OPDSpasticityAssessTreatVo.class); if (null == valueObject) { valueObject = new ims.generalmedical.vo.OPDSpasticityAssessTreatVo( domainObject.getId(), domainObject.getVersion()); map.addValueObject(domainObject, valueObject); valueObject = insert(map, valueObject, domainObject); } return valueObject; }
public static ims.medical.domain.objects.OPDSpasticityAssessTreat extractOPDSpasticityAssessTreat( ims.domain.ILightweightDomainFactory domainFactory, ims.generalmedical.vo.OPDSpasticityAssessTreatVo valueObject, HashMap domMap) { if (null == valueObject) { return null; } Integer id = valueObject.getID_OPDSpasticityAssessTreat(); ims.medical.domain.objects.OPDSpasticityAssessTreat domainObject = null; if (null == id) { if (domMap.get(valueObject) != null) { return (ims.medical.domain.objects.OPDSpasticityAssessTreat) domMap.get(valueObject); } // ims.generalmedical.vo.OPDSpasticityAssessTreatVo ID_OPDSpasticityAssessTreat field is // unknown domainObject = new ims.medical.domain.objects.OPDSpasticityAssessTreat(); domMap.put(valueObject, domainObject); } else { String key = (valueObject.getClass().getName() + "__" + valueObject.getID_OPDSpasticityAssessTreat()); if (domMap.get(key) != null) { return (ims.medical.domain.objects.OPDSpasticityAssessTreat) domMap.get(key); } domainObject = (ims.medical.domain.objects.OPDSpasticityAssessTreat) domainFactory.getDomainObject( ims.medical.domain.objects.OPDSpasticityAssessTreat.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_OPDSpasticityAssessTreat()); domainObject.setTreatGoals( ims.generalmedical.vo.domain.OPDSpasticityAssessTreatGoalVoAssembler .extractOPDSpasAssessTreatGoalSet( domainFactory, valueObject.getTreatGoals(), domainObject.getTreatGoals(), domMap)); ims.spinalinjuries.vo.lookups.SATreatmentPlanCollection collection2 = valueObject.getTreatmentPlan(); java.util.List domainTreatmentPlan = domainObject.getTreatmentPlan(); ; int collection2Size = 0; if (collection2 == null) { domainTreatmentPlan = new java.util.ArrayList(0); } else { collection2Size = collection2.size(); } for (int i = 0; i < collection2Size; i++) { int instanceId = collection2.get(i).getID(); ims.domain.lookups.LookupInstanceRef dom = new ims.domain.lookups.LookupInstanceRef(domainFactory.getLookupInstance(instanceId)); int domIdx = domainTreatmentPlan.indexOf(dom); if (domIdx == -1) { domainTreatmentPlan.add(i, dom); } else if (i != domIdx && i < domainTreatmentPlan.size()) { Object tmp = domainTreatmentPlan.get(i); domainTreatmentPlan.set(i, domainTreatmentPlan.get(domIdx)); domainTreatmentPlan.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 j2 = domainTreatmentPlan.size(); while (j2 > collection2Size) { domainTreatmentPlan.remove(j2 - 1); j2 = domainTreatmentPlan.size(); } domainObject.setTreatmentPlan(domainTreatmentPlan); ims.spinalinjuries.vo.lookups.SABotulinmCollection collection3 = valueObject.getBotulismTreatment(); java.util.List domainBotulismTreatment = domainObject.getBotulismTreatment(); ; int collection3Size = 0; if (collection3 == null) { domainBotulismTreatment = new java.util.ArrayList(0); } else { collection3Size = collection3.size(); } for (int i = 0; i < collection3Size; i++) { int instanceId = collection3.get(i).getID(); ims.domain.lookups.LookupInstanceRef dom = new ims.domain.lookups.LookupInstanceRef(domainFactory.getLookupInstance(instanceId)); int domIdx = domainBotulismTreatment.indexOf(dom); if (domIdx == -1) { domainBotulismTreatment.add(i, dom); } else if (i != domIdx && i < domainBotulismTreatment.size()) { Object tmp = domainBotulismTreatment.get(i); domainBotulismTreatment.set(i, domainBotulismTreatment.get(domIdx)); domainBotulismTreatment.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 j3 = domainBotulismTreatment.size(); while (j3 > collection3Size) { domainBotulismTreatment.remove(j3 - 1); j3 = domainBotulismTreatment.size(); } domainObject.setBotulismTreatment(domainBotulismTreatment); // 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.getJointContracture() != null && valueObject.getJointContracture().equals("")) { valueObject.setJointContracture(null); } domainObject.setJointContracture(valueObject.getJointContracture()); domainObject.setLimbFinding( ims.generalmedical.vo.domain.OPDSpasAssLimbsVoAssembler.extractOPDSpasAssLimbsSet( domainFactory, valueObject.getLimbFinding(), domainObject.getLimbFinding(), domMap)); // SaveAsRefVO - treated as a refVo in extract methods ims.core.admin.domain.objects.CareContext value6 = null; if (null != valueObject.getCareContext()) { if (valueObject.getCareContext().getBoId() == null) { if (domMap.get(valueObject.getCareContext()) != null) { value6 = (ims.core.admin.domain.objects.CareContext) domMap.get(valueObject.getCareContext()); } } else { value6 = (ims.core.admin.domain.objects.CareContext) domainFactory.getDomainObject( ims.core.admin.domain.objects.CareContext.class, valueObject.getCareContext().getBoId()); } } domainObject.setCareContext(value6); domainObject.setAuthoringInformation( ims.core.vo.domain.AuthoringInformationVoAssembler.extractAuthoringInformation( domainFactory, valueObject.getAuthoringInformation(), domMap)); 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.medical.domain.objects.OPDSpasticityAssessTreat */ public static ims.generalmedical.vo.OPDSpasticityAssessTreatVo insert( DomainObjectMap map, ims.generalmedical.vo.OPDSpasticityAssessTreatVo valueObject, ims.medical.domain.objects.OPDSpasticityAssessTreat domainObject) { if (null == domainObject) { return valueObject; } if (null == map) { map = new DomainObjectMap(); } valueObject.setID_OPDSpasticityAssessTreat(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; // TreatGoals valueObject.setTreatGoals( ims.generalmedical.vo.domain.OPDSpasticityAssessTreatGoalVoAssembler .createOPDSpasticityAssessTreatGoalVoCollectionFromOPDSpasAssessTreatGoal( map, domainObject.getTreatGoals())); // TreatmentPlan java.util.List listTreatmentPlan = domainObject.getTreatmentPlan(); ims.spinalinjuries.vo.lookups.SATreatmentPlanCollection TreatmentPlan = new ims.spinalinjuries.vo.lookups.SATreatmentPlanCollection(); for (java.util.Iterator iterator = listTreatmentPlan.iterator(); iterator.hasNext(); ) { ims.framework.utils.ImagePath img = null; ims.framework.utils.Color color = null; ims.domain.lookups.LookupInstance instance = (ims.domain.lookups.LookupInstance) iterator.next(); if (instance.getImage() != null) { img = new ims.framework.utils.ImagePath( instance.getImage().getImageId(), instance.getImage().getImagePath()); } else { img = null; } color = instance.getColor(); if (color != null) color.getValue(); ims.spinalinjuries.vo.lookups.SATreatmentPlan voInstance = new ims.spinalinjuries.vo.lookups.SATreatmentPlan( instance.getId(), instance.getText(), instance.isActive(), null, img, color); ims.spinalinjuries.vo.lookups.SATreatmentPlan parentVoInstance = voInstance; ims.domain.lookups.LookupInstance parent = instance.getParent(); while (parent != null) { if (parent.getImage() != null) { img = new ims.framework.utils.ImagePath( parent.getImage().getImageId(), parent.getImage().getImagePath()); } else { img = null; } color = parent.getColor(); if (color != null) color.getValue(); parentVoInstance.setParent( new ims.spinalinjuries.vo.lookups.SATreatmentPlan( parent.getId(), parent.getText(), parent.isActive(), null, img, color)); parentVoInstance = parentVoInstance.getParent(); parent = parent.getParent(); } TreatmentPlan.add(voInstance); } valueObject.setTreatmentPlan(TreatmentPlan); // BotulismTreatment java.util.List listBotulismTreatment = domainObject.getBotulismTreatment(); ims.spinalinjuries.vo.lookups.SABotulinmCollection BotulismTreatment = new ims.spinalinjuries.vo.lookups.SABotulinmCollection(); for (java.util.Iterator iterator = listBotulismTreatment.iterator(); iterator.hasNext(); ) { ims.framework.utils.ImagePath img = null; ims.framework.utils.Color color = null; ims.domain.lookups.LookupInstance instance = (ims.domain.lookups.LookupInstance) iterator.next(); if (instance.getImage() != null) { img = new ims.framework.utils.ImagePath( instance.getImage().getImageId(), instance.getImage().getImagePath()); } else { img = null; } color = instance.getColor(); if (color != null) color.getValue(); ims.spinalinjuries.vo.lookups.SABotulinm voInstance = new ims.spinalinjuries.vo.lookups.SABotulinm( instance.getId(), instance.getText(), instance.isActive(), null, img, color); ims.spinalinjuries.vo.lookups.SABotulinm parentVoInstance = voInstance; ims.domain.lookups.LookupInstance parent = instance.getParent(); while (parent != null) { if (parent.getImage() != null) { img = new ims.framework.utils.ImagePath( parent.getImage().getImageId(), parent.getImage().getImagePath()); } else { img = null; } color = parent.getColor(); if (color != null) color.getValue(); parentVoInstance.setParent( new ims.spinalinjuries.vo.lookups.SABotulinm( parent.getId(), parent.getText(), parent.isActive(), null, img, color)); parentVoInstance = parentVoInstance.getParent(); parent = parent.getParent(); } BotulismTreatment.add(voInstance); } valueObject.setBotulismTreatment(BotulismTreatment); // JointContracture valueObject.setJointContracture(domainObject.getJointContracture()); // LimbFinding valueObject.setLimbFinding( ims.generalmedical.vo.domain.OPDSpasAssLimbsVoAssembler .createOPDSpasAssLimbsVoCollectionFromOPDSpasAssLimbs( map, domainObject.getLimbFinding())); // CareContext valueObject.setCareContext( ims.core.vo.domain.CareContextShortVoAssembler.create(map, domainObject.getCareContext())); // AuthoringInformation valueObject.setAuthoringInformation( ims.core.vo.domain.AuthoringInformationVoAssembler.create( map, domainObject.getAuthoringInformation())); return valueObject; }