/** * Update the ValueObject with the Domain Object. * * @param map DomainObjectMap of DomainObjects to already created ValueObjects. * @param valueObject to be updated * @param domainObject ims.core.admin.domain.objects.CareContext */ public static ims.core.vo.CareContextMinVo insert( DomainObjectMap map, ims.core.vo.CareContextMinVo valueObject, ims.core.admin.domain.objects.CareContext domainObject) { if (null == domainObject) { return valueObject; } if (null == map) { map = new DomainObjectMap(); } valueObject.setID_CareContext(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; // EpisodeOfCare valueObject.setEpisodeOfCare( ims.core.vo.domain.EpisodeOfCareForPatientDocumentsVoAssembler.create( map, domainObject.getEpisodeOfCare())); // StartDateTime java.util.Date StartDateTime = domainObject.getStartDateTime(); if (null != StartDateTime) { valueObject.setStartDateTime(new ims.framework.utils.DateTime(StartDateTime)); } // ResponsibleHCP if (domainObject.getResponsibleHCP() != null) { if (domainObject.getResponsibleHCP() instanceof HibernateProxy) // If the proxy is set, there is no need to lazy load, the proxy knows the // id already. { HibernateProxy p = (HibernateProxy) domainObject.getResponsibleHCP(); int id = Integer.parseInt(p.getHibernateLazyInitializer().getIdentifier().toString()); valueObject.setResponsibleHCP(new ims.core.resource.people.vo.HcpRefVo(id, -1)); } else { valueObject.setResponsibleHCP( new ims.core.resource.people.vo.HcpRefVo( domainObject.getResponsibleHCP().getId(), domainObject.getResponsibleHCP().getVersion())); } } return valueObject; }
/** * Update the ValueObject with the Domain Object. * * @param map DomainObjectMap of DomainObjects to already created ValueObjects. * @param valueObject to be updated * @param domainObject ims.core.admin.domain.objects.CareContext */ public static ims.core.vo.CareContextSmallVo insert( DomainObjectMap map, ims.core.vo.CareContextSmallVo valueObject, ims.core.admin.domain.objects.CareContext domainObject) { if (null == domainObject) { return valueObject; } if (null == map) { map = new DomainObjectMap(); } valueObject.setID_CareContext(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; // Context ims.domain.lookups.LookupInstance instance1 = domainObject.getContext(); if (null != instance1) { ims.framework.utils.ImagePath img = null; ims.framework.utils.Color color = null; img = null; if (instance1.getImage() != null) { img = new ims.framework.utils.ImagePath( instance1.getImage().getImageId(), instance1.getImage().getImagePath()); } color = instance1.getColor(); if (color != null) color.getValue(); ims.core.vo.lookups.ContextType voLookup1 = new ims.core.vo.lookups.ContextType( instance1.getId(), instance1.getText(), instance1.isActive(), null, img, color); ims.core.vo.lookups.ContextType parentVoLookup1 = voLookup1; ims.domain.lookups.LookupInstance parent1 = instance1.getParent(); while (parent1 != null) { if (parent1.getImage() != null) { img = new ims.framework.utils.ImagePath( parent1.getImage().getImageId(), parent1.getImage().getImagePath()); } else { img = null; } color = parent1.getColor(); if (color != null) color.getValue(); parentVoLookup1.setParent( new ims.core.vo.lookups.ContextType( parent1.getId(), parent1.getText(), parent1.isActive(), null, img, color)); parentVoLookup1 = parentVoLookup1.getParent(); parent1 = parent1.getParent(); } valueObject.setContext(voLookup1); } // StartDateTime java.util.Date StartDateTime = domainObject.getStartDateTime(); if (null != StartDateTime) { valueObject.setStartDateTime(new ims.framework.utils.DateTime(StartDateTime)); } // EndDateTime java.util.Date EndDateTime = domainObject.getEndDateTime(); if (null != EndDateTime) { valueObject.setEndDateTime(new ims.framework.utils.DateTime(EndDateTime)); } // CareContextHistory valueObject.setCareContextHistory( ims.core.vo.domain.CareContextHistVoAssembler .createCareContextHistVoCollectionFromCareContextHistory( map, domainObject.getCareContextHistory())); return valueObject; }