/** * Copy one ValueObject to another * * @param valueObjectDest to be updated * @param valueObjectSrc to copy values from */ public static ims.ocrr.vo.SpecimenWorkListItemListVo copy( ims.ocrr.vo.SpecimenWorkListItemListVo valueObjectDest, ims.ocrr.vo.SpecimenWorkListItemListVo valueObjectSrc) { if (null == valueObjectSrc) { return valueObjectSrc; } valueObjectDest.setID_SpecimenWorkListItem(valueObjectSrc.getID_SpecimenWorkListItem()); valueObjectDest.setIsRIE(valueObjectSrc.getIsRIE()); // Specimen valueObjectDest.setSpecimen(valueObjectSrc.getSpecimen()); // ListType valueObjectDest.setListType(valueObjectSrc.getListType()); // DateToCollect valueObjectDest.setDateToCollect(valueObjectSrc.getDateToCollect()); // RoundToCollect valueObjectDest.setRoundToCollect(valueObjectSrc.getRoundToCollect()); // TimeToCollect valueObjectDest.setTimeToCollect(valueObjectSrc.getTimeToCollect()); // CollectionStatus valueObjectDest.setCollectionStatus(valueObjectSrc.getCollectionStatus()); // Printed valueObjectDest.setPrinted(valueObjectSrc.getPrinted()); // DFTOrderInvestigation valueObjectDest.setDFTOrderInvestigation(valueObjectSrc.getDFTOrderInvestigation()); // Ward valueObjectDest.setWard(valueObjectSrc.getWard()); return valueObjectDest; }
/** * Update the ValueObject with the Domain Object. * * @param map DomainObjectMap of DomainObjects to already created ValueObjects. * @param valueObject to be updated * @param domainObject ims.ocrr.orderingresults.domain.objects.SpecimenWorkListItem */ public static ims.ocrr.vo.SpecimenWorkListItemListVo insert( DomainObjectMap map, ims.ocrr.vo.SpecimenWorkListItemListVo valueObject, ims.ocrr.orderingresults.domain.objects.SpecimenWorkListItem domainObject) { if (null == domainObject) { return valueObject; } if (null == map) { map = new DomainObjectMap(); } valueObject.setID_SpecimenWorkListItem(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; // Specimen valueObject.setSpecimen( ims.ocrr.vo.domain.OrderSpecimenListVoAssembler.create(map, domainObject.getSpecimen())); // ListType ims.domain.lookups.LookupInstance instance2 = domainObject.getListType(); if (null != instance2) { ims.framework.utils.ImagePath img = null; ims.framework.utils.Color color = null; img = null; if (instance2.getImage() != null) { img = new ims.framework.utils.ImagePath( instance2.getImage().getImageId(), instance2.getImage().getImagePath()); } color = instance2.getColor(); if (color != null) color.getValue(); ims.ocrr.vo.lookups.SpecimenCollectionMethod voLookup2 = new ims.ocrr.vo.lookups.SpecimenCollectionMethod( instance2.getId(), instance2.getText(), instance2.isActive(), null, img, color); ims.ocrr.vo.lookups.SpecimenCollectionMethod parentVoLookup2 = voLookup2; ims.domain.lookups.LookupInstance parent2 = instance2.getParent(); while (parent2 != null) { if (parent2.getImage() != null) { img = new ims.framework.utils.ImagePath( parent2.getImage().getImageId(), parent2.getImage().getImagePath()); } else { img = null; } color = parent2.getColor(); if (color != null) color.getValue(); parentVoLookup2.setParent( new ims.ocrr.vo.lookups.SpecimenCollectionMethod( parent2.getId(), parent2.getText(), parent2.isActive(), null, img, color)); parentVoLookup2 = parentVoLookup2.getParent(); parent2 = parent2.getParent(); } valueObject.setListType(voLookup2); } // DateToCollect java.util.Date DateToCollect = domainObject.getDateToCollect(); if (null != DateToCollect) { valueObject.setDateToCollect(new ims.framework.utils.Date(DateToCollect)); } // RoundToCollect ims.domain.lookups.LookupInstance instance4 = domainObject.getRoundToCollect(); if (null != instance4) { ims.framework.utils.ImagePath img = null; ims.framework.utils.Color color = null; img = null; if (instance4.getImage() != null) { img = new ims.framework.utils.ImagePath( instance4.getImage().getImageId(), instance4.getImage().getImagePath()); } color = instance4.getColor(); if (color != null) color.getValue(); ims.ocrr.vo.lookups.SpecimenCollectionTime voLookup4 = new ims.ocrr.vo.lookups.SpecimenCollectionTime( instance4.getId(), instance4.getText(), instance4.isActive(), null, img, color); ims.ocrr.vo.lookups.SpecimenCollectionTime parentVoLookup4 = voLookup4; ims.domain.lookups.LookupInstance parent4 = instance4.getParent(); while (parent4 != null) { if (parent4.getImage() != null) { img = new ims.framework.utils.ImagePath( parent4.getImage().getImageId(), parent4.getImage().getImagePath()); } else { img = null; } color = parent4.getColor(); if (color != null) color.getValue(); parentVoLookup4.setParent( new ims.ocrr.vo.lookups.SpecimenCollectionTime( parent4.getId(), parent4.getText(), parent4.isActive(), null, img, color)); parentVoLookup4 = parentVoLookup4.getParent(); parent4 = parent4.getParent(); } valueObject.setRoundToCollect(voLookup4); } // TimeToCollect String TimeToCollect = domainObject.getTimeToCollect(); if (null != TimeToCollect) { valueObject.setTimeToCollect(new ims.framework.utils.Time(TimeToCollect)); } // CollectionStatus ims.domain.lookups.LookupInstance instance6 = domainObject.getCollectionStatus(); if (null != instance6) { ims.framework.utils.ImagePath img = null; ims.framework.utils.Color color = null; img = null; if (instance6.getImage() != null) { img = new ims.framework.utils.ImagePath( instance6.getImage().getImageId(), instance6.getImage().getImagePath()); } color = instance6.getColor(); if (color != null) color.getValue(); ims.ocrr.vo.lookups.SpecimenCollectionStatus voLookup6 = new ims.ocrr.vo.lookups.SpecimenCollectionStatus( instance6.getId(), instance6.getText(), instance6.isActive(), null, img, color); ims.ocrr.vo.lookups.SpecimenCollectionStatus parentVoLookup6 = voLookup6; ims.domain.lookups.LookupInstance parent6 = instance6.getParent(); while (parent6 != null) { if (parent6.getImage() != null) { img = new ims.framework.utils.ImagePath( parent6.getImage().getImageId(), parent6.getImage().getImagePath()); } else { img = null; } color = parent6.getColor(); if (color != null) color.getValue(); parentVoLookup6.setParent( new ims.ocrr.vo.lookups.SpecimenCollectionStatus( parent6.getId(), parent6.getText(), parent6.isActive(), null, img, color)); parentVoLookup6 = parentVoLookup6.getParent(); parent6 = parent6.getParent(); } valueObject.setCollectionStatus(voLookup6); } // Printed valueObject.setPrinted(domainObject.isPrinted()); // DFTOrderInvestigation valueObject.setDFTOrderInvestigation( ims.ocrr.vo.domain.DftOrderInvestigationVoAssembler.create( map, domainObject.getDFTOrderInvestigation())); // Ward if (domainObject.getWard() != null) { if (domainObject.getWard() instanceof HibernateProxy) // If the proxy is set, there is no need to lazy load, the proxy knows the // id already. { HibernateProxy p = (HibernateProxy) domainObject.getWard(); int id = Integer.parseInt(p.getHibernateLazyInitializer().getIdentifier().toString()); valueObject.setWard(new ims.core.resource.place.vo.LocationRefVo(id, -1)); } else { valueObject.setWard( new ims.core.resource.place.vo.LocationRefVo( domainObject.getWard().getId(), domainObject.getWard().getVersion())); } } return valueObject; }