/** * Create the ValueObject collection to hold the set of DomainObjects. * * @param map - maps DomainObjects to created ValueObjects * @param domainObjectSet - Set of * ims.therapies.mobilitytransfers.domain.objects.WheelchairAssessment objects. */ public static ims.therapies.vo.WheelchairAssessmentVoCollection createWheelchairAssessmentVoCollectionFromWheelchairAssessment( DomainObjectMap map, java.util.Set domainObjectSet) { ims.therapies.vo.WheelchairAssessmentVoCollection voList = new ims.therapies.vo.WheelchairAssessmentVoCollection(); if (null == domainObjectSet) { return voList; } int rieCount = 0; int activeCount = 0; java.util.Iterator iterator = domainObjectSet.iterator(); while (iterator.hasNext()) { ims.therapies.mobilitytransfers.domain.objects.WheelchairAssessment domainObject = (ims.therapies.mobilitytransfers.domain.objects.WheelchairAssessment) iterator.next(); ims.therapies.vo.WheelchairAssessmentVo 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.therapies.mobilitytransfers.domain.objects.WheelchairAssessment objects. */ public static ims.therapies.vo.WheelchairAssessmentVoCollection createWheelchairAssessmentVoCollectionFromWheelchairAssessment( DomainObjectMap map, java.util.List domainObjectList) { ims.therapies.vo.WheelchairAssessmentVoCollection voList = new ims.therapies.vo.WheelchairAssessmentVoCollection(); if (null == domainObjectList) { return voList; } int rieCount = 0; int activeCount = 0; for (int i = 0; i < domainObjectList.size(); i++) { ims.therapies.mobilitytransfers.domain.objects.WheelchairAssessment domainObject = (ims.therapies.mobilitytransfers.domain.objects.WheelchairAssessment) domainObjectList.get(i); ims.therapies.vo.WheelchairAssessmentVo 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.therapies.mobilitytransfers.domain.objects.WheelchairAssessment object. * * @param map DomainObjectMap of DomainObjects to already created ValueObjects. * @param domainObject */ public static ims.therapies.vo.WheelchairAssessmentVo create( DomainObjectMap map, ims.therapies.mobilitytransfers.domain.objects.WheelchairAssessment domainObject) { if (null == domainObject) { return null; } // check if the domainObject already has a valueObject created for it ims.therapies.vo.WheelchairAssessmentVo valueObject = (ims.therapies.vo.WheelchairAssessmentVo) map.getValueObject(domainObject, ims.therapies.vo.WheelchairAssessmentVo.class); if (null == valueObject) { valueObject = new ims.therapies.vo.WheelchairAssessmentVo( domainObject.getId(), domainObject.getVersion()); map.addValueObject(domainObject, valueObject); valueObject = insert(map, valueObject, domainObject); } return valueObject; }
public static ims.therapies.mobilitytransfers.domain.objects.WheelchairAssessment extractWheelchairAssessment( ims.domain.ILightweightDomainFactory domainFactory, ims.therapies.vo.WheelchairAssessmentVo valueObject, HashMap domMap) { if (null == valueObject) { return null; } Integer id = valueObject.getID_WheelchairAssessment(); ims.therapies.mobilitytransfers.domain.objects.WheelchairAssessment domainObject = null; if (null == id) { if (domMap.get(valueObject) != null) { return (ims.therapies.mobilitytransfers.domain.objects.WheelchairAssessment) domMap.get(valueObject); } // ims.therapies.vo.WheelchairAssessmentVo ID_WheelchairAssessment field is unknown domainObject = new ims.therapies.mobilitytransfers.domain.objects.WheelchairAssessment(); domMap.put(valueObject, domainObject); } else { String key = (valueObject.getClass().getName() + "__" + valueObject.getID_WheelchairAssessment()); if (domMap.get(key) != null) { return (ims.therapies.mobilitytransfers.domain.objects.WheelchairAssessment) domMap.get(key); } domainObject = (ims.therapies.mobilitytransfers.domain.objects.WheelchairAssessment) domainFactory.getDomainObject( ims.therapies.mobilitytransfers.domain.objects.WheelchairAssessment.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_WheelchairAssessment()); ims.framework.utils.DateTime dateTime1 = valueObject.getAuthoringDateTime(); java.util.Date value1 = null; if (dateTime1 != null) { value1 = dateTime1.getJavaDate(); } domainObject.setAuthoringDateTime(value1); domainObject.setAuthoringCP( ims.core.vo.domain.HcpAssembler.extractHcp( domainFactory, valueObject.getAuthoringCP(), domMap)); // create LookupInstance from vo LookupType ims.domain.lookups.LookupInstance value3 = null; if (null != valueObject.getChairType()) { value3 = domainFactory.getLookupInstance(valueObject.getChairType().getID()); } domainObject.setChairType(value3); domainObject.setSurfaceDistance( ims.therapies.vo.domain.WheelchairSurfaceDistanceVoAssembler .extractWheelchairSurfaceDistanceSet( domainFactory, valueObject.getSurfaceDistance(), domainObject.getSurfaceDistance(), domMap)); domainObject.setPowerchairSkillsAssess( ims.therapies.vo.domain.PowerchairSkillsAssessmentVoAssembler .extractPowerchairSkillsAssessmentSet( domainFactory, valueObject.getPowerchairSkillsAssess(), domainObject.getPowerchairSkillsAssess(), domMap)); domainObject.setWheelchairSkillsAssess( ims.therapies.vo.domain.WheelchairSkillsAssessmentVoAssembler .extractWheelchairSkillsAssessmentSet( domainFactory, valueObject.getWheelchairSkillsAssess(), domainObject.getWheelchairSkillsAssess(), domMap)); ims.core.admin.domain.objects.ClinicalContact value7 = null; if (null != valueObject.getClinicalContact()) { if (valueObject.getClinicalContact().getBoId() == null) { if (domMap.get(valueObject.getClinicalContact()) != null) { value7 = (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 { value7 = domainObject.getClinicalContact(); } else { value7 = (ims.core.admin.domain.objects.ClinicalContact) domainFactory.getDomainObject( ims.core.admin.domain.objects.ClinicalContact.class, valueObject.getClinicalContact().getBoId()); } } domainObject.setClinicalContact(value7); 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.therapies.mobilitytransfers.domain.objects.WheelchairAssessment */ public static ims.therapies.vo.WheelchairAssessmentVo insert( DomainObjectMap map, ims.therapies.vo.WheelchairAssessmentVo valueObject, ims.therapies.mobilitytransfers.domain.objects.WheelchairAssessment domainObject) { if (null == domainObject) { return valueObject; } if (null == map) { map = new DomainObjectMap(); } valueObject.setID_WheelchairAssessment(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; // AuthoringDateTime java.util.Date AuthoringDateTime = domainObject.getAuthoringDateTime(); if (null != AuthoringDateTime) { valueObject.setAuthoringDateTime(new ims.framework.utils.DateTime(AuthoringDateTime)); } // AuthoringCP valueObject.setAuthoringCP( ims.core.vo.domain.HcpAssembler.create(map, domainObject.getAuthoringCP())); // ChairType ims.domain.lookups.LookupInstance instance3 = domainObject.getChairType(); 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.spinalinjuries.vo.lookups.WheelchairType voLookup3 = new ims.spinalinjuries.vo.lookups.WheelchairType( instance3.getId(), instance3.getText(), instance3.isActive(), null, img, color); ims.spinalinjuries.vo.lookups.WheelchairType 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.spinalinjuries.vo.lookups.WheelchairType( parent3.getId(), parent3.getText(), parent3.isActive(), null, img, color)); parentVoLookup3 = parentVoLookup3.getParent(); parent3 = parent3.getParent(); } valueObject.setChairType(voLookup3); } // SurfaceDistance valueObject.setSurfaceDistance( ims.therapies.vo.domain.WheelchairSurfaceDistanceVoAssembler .createWheelchairSurfaceDistanceVoCollectionFromWheelchairSurfaceDistance( map, domainObject.getSurfaceDistance())); // PowerchairSkillsAssess valueObject.setPowerchairSkillsAssess( ims.therapies.vo.domain.PowerchairSkillsAssessmentVoAssembler .createPowerchairSkillsAssessmentVoCollectionFromPowerchairSkillsAssessment( map, domainObject.getPowerchairSkillsAssess())); // WheelchairSkillsAssess valueObject.setWheelchairSkillsAssess( ims.therapies.vo.domain.WheelchairSkillsAssessmentVoAssembler .createWheelchairSkillsAssessmentVoCollectionFromWheelchairSkillsAssessment( map, domainObject.getWheelchairSkillsAssess())); // 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())); } } return valueObject; }