/** * Create the ValueObject collection to hold the set of DomainObjects. * * @param map - maps DomainObjects to created ValueObjects * @param domainObjectSet - Set of ims.clinical.domain.objects.PatientProcedureChecklist objects. */ public static ims.clinical.vo.PatientProcedureChecklistVoCollection createPatientProcedureChecklistVoCollectionFromPatientProcedureChecklist( DomainObjectMap map, java.util.Set domainObjectSet) { ims.clinical.vo.PatientProcedureChecklistVoCollection voList = new ims.clinical.vo.PatientProcedureChecklistVoCollection(); if (null == domainObjectSet) { return voList; } int rieCount = 0; int activeCount = 0; java.util.Iterator iterator = domainObjectSet.iterator(); while (iterator.hasNext()) { ims.clinical.domain.objects.PatientProcedureChecklist domainObject = (ims.clinical.domain.objects.PatientProcedureChecklist) iterator.next(); ims.clinical.vo.PatientProcedureChecklistVo 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.clinical.domain.objects.PatientProcedureChecklist * objects. */ public static ims.clinical.vo.PatientProcedureChecklistVoCollection createPatientProcedureChecklistVoCollectionFromPatientProcedureChecklist( DomainObjectMap map, java.util.List domainObjectList) { ims.clinical.vo.PatientProcedureChecklistVoCollection voList = new ims.clinical.vo.PatientProcedureChecklistVoCollection(); if (null == domainObjectList) { return voList; } int rieCount = 0; int activeCount = 0; for (int i = 0; i < domainObjectList.size(); i++) { ims.clinical.domain.objects.PatientProcedureChecklist domainObject = (ims.clinical.domain.objects.PatientProcedureChecklist) domainObjectList.get(i); ims.clinical.vo.PatientProcedureChecklistVo 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.clinical.domain.objects.PatientProcedureChecklist object. * * @param map DomainObjectMap of DomainObjects to already created ValueObjects. * @param domainObject */ public static ims.clinical.vo.PatientProcedureChecklistVo create( DomainObjectMap map, ims.clinical.domain.objects.PatientProcedureChecklist domainObject) { if (null == domainObject) { return null; } // check if the domainObject already has a valueObject created for it ims.clinical.vo.PatientProcedureChecklistVo valueObject = (ims.clinical.vo.PatientProcedureChecklistVo) map.getValueObject(domainObject, ims.clinical.vo.PatientProcedureChecklistVo.class); if (null == valueObject) { valueObject = new ims.clinical.vo.PatientProcedureChecklistVo( domainObject.getId(), domainObject.getVersion()); map.addValueObject(domainObject, valueObject); valueObject = insert(map, valueObject, domainObject); } return valueObject; }
public static ims.clinical.domain.objects.PatientProcedureChecklist extractPatientProcedureChecklist( ims.domain.ILightweightDomainFactory domainFactory, ims.clinical.vo.PatientProcedureChecklistVo valueObject, HashMap domMap) { if (null == valueObject) { return null; } Integer id = valueObject.getID_PatientProcedureChecklist(); ims.clinical.domain.objects.PatientProcedureChecklist domainObject = null; if (null == id) { if (domMap.get(valueObject) != null) { return (ims.clinical.domain.objects.PatientProcedureChecklist) domMap.get(valueObject); } // ims.clinical.vo.PatientProcedureChecklistVo ID_PatientProcedureChecklist field is unknown domainObject = new ims.clinical.domain.objects.PatientProcedureChecklist(); domMap.put(valueObject, domainObject); } else { String key = (valueObject.getClass().getName() + "__" + valueObject.getID_PatientProcedureChecklist()); if (domMap.get(key) != null) { return (ims.clinical.domain.objects.PatientProcedureChecklist) domMap.get(key); } domainObject = (ims.clinical.domain.objects.PatientProcedureChecklist) domainFactory.getDomainObject( ims.clinical.domain.objects.PatientProcedureChecklist.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_PatientProcedureChecklist()); ims.core.admin.domain.objects.ClinicalContact value1 = null; if (null != valueObject.getClinicalContact()) { if (valueObject.getClinicalContact().getBoId() == null) { if (domMap.get(valueObject.getClinicalContact()) != null) { value1 = (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 { value1 = domainObject.getClinicalContact(); } else { value1 = (ims.core.admin.domain.objects.ClinicalContact) domainFactory.getDomainObject( ims.core.admin.domain.objects.ClinicalContact.class, valueObject.getClinicalContact().getBoId()); } } domainObject.setClinicalContact(value1); domainObject.setPresentProcedures( ims.core.vo.domain.PatientProcedureVoAssembler.extractPatientProcedureSet( domainFactory, valueObject.getPresentProcedures(), domainObject.getPresentProcedures(), domMap)); domainObject.setOtherProcedures( ims.clinical.vo.domain.PatientAbsentProcedureVoAssembler.extractPatientAbsentProcedureSet( domainFactory, valueObject.getOtherProcedures(), domainObject.getOtherProcedures(), domMap)); 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.clinical.domain.objects.PatientProcedureChecklist */ public static ims.clinical.vo.PatientProcedureChecklistVo insert( DomainObjectMap map, ims.clinical.vo.PatientProcedureChecklistVo valueObject, ims.clinical.domain.objects.PatientProcedureChecklist domainObject) { if (null == domainObject) { return valueObject; } if (null == map) { map = new DomainObjectMap(); } valueObject.setID_PatientProcedureChecklist(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; // ClinicalContact if (domainObject.getClinicalContact() != null) { if (domainObject.getClinicalContact() instanceof HibernateProxy) // If the proxy is set, there is no need to lazy load, the proxy knows the // id already. { HibernateProxy p = (HibernateProxy) domainObject.getClinicalContact(); int id = Integer.parseInt(p.getHibernateLazyInitializer().getIdentifier().toString()); valueObject.setClinicalContact(new ims.core.admin.vo.ClinicalContactRefVo(id, -1)); } else { valueObject.setClinicalContact( new ims.core.admin.vo.ClinicalContactRefVo( domainObject.getClinicalContact().getId(), domainObject.getClinicalContact().getVersion())); } } // PresentProcedures valueObject.setPresentProcedures( ims.core.vo.domain.PatientProcedureVoAssembler .createPatientProcedureVoCollectionFromPatientProcedure( map, domainObject.getPresentProcedures())); // OtherProcedures valueObject.setOtherProcedures( ims.clinical.vo.domain.PatientAbsentProcedureVoAssembler .createPatientAbsentProcedureVoCollectionFromPatientAbsentProcedure( map, domainObject.getOtherProcedures())); // AuthoringInformation valueObject.setAuthoringInformation( ims.core.vo.domain.AuthoringInformationVoAssembler.create( map, domainObject.getAuthoringInformation())); return valueObject; }