/** * Copy one ValueObject to another * * @param valueObjectDest to be updated * @param valueObjectSrc to copy values from */ public static ims.core.vo.CatsReferralRepatriationRequestVo copy( ims.core.vo.CatsReferralRepatriationRequestVo valueObjectDest, ims.core.vo.CatsReferralRepatriationRequestVo valueObjectSrc) { if (null == valueObjectSrc) { return valueObjectSrc; } valueObjectDest.setID_CatsReferral(valueObjectSrc.getID_CatsReferral()); valueObjectDest.setIsRIE(valueObjectSrc.getIsRIE()); // Patient valueObjectDest.setPatient(valueObjectSrc.getPatient()); // ReferralDetails valueObjectDest.setReferralDetails(valueObjectSrc.getReferralDetails()); // EpisodeOfCare valueObjectDest.setEpisodeOfCare(valueObjectSrc.getEpisodeOfCare()); // CareContext valueObjectDest.setCareContext(valueObjectSrc.getCareContext()); // CurrentStatus valueObjectDest.setCurrentStatus(valueObjectSrc.getCurrentStatus()); // StatusHistory valueObjectDest.setStatusHistory(valueObjectSrc.getStatusHistory()); // Contract valueObjectDest.setContract(valueObjectSrc.getContract()); // Urgency valueObjectDest.setUrgency(valueObjectSrc.getUrgency()); // Journey valueObjectDest.setJourney(valueObjectSrc.getJourney()); // PathwayID valueObjectDest.setPathwayID(valueObjectSrc.getPathwayID()); // RTTClockImpact valueObjectDest.setRTTClockImpact(valueObjectSrc.getRTTClockImpact()); // CurrentRTTStatus valueObjectDest.setCurrentRTTStatus(valueObjectSrc.getCurrentRTTStatus()); // RepatriationRequest valueObjectDest.setRepatriationRequest(valueObjectSrc.getRepatriationRequest()); // PatientCategory valueObjectDest.setPatientCategory(valueObjectSrc.getPatientCategory()); // IsEmergencyReferral valueObjectDest.setIsEmergencyReferral(valueObjectSrc.getIsEmergencyReferral()); 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.RefMan.domain.objects.CatsReferral */ public static ims.core.vo.CatsReferralRepatriationRequestVo insert( DomainObjectMap map, ims.core.vo.CatsReferralRepatriationRequestVo valueObject, ims.RefMan.domain.objects.CatsReferral domainObject) { if (null == domainObject) { return valueObject; } if (null == map) { map = new DomainObjectMap(); } valueObject.setID_CatsReferral(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; // Patient if (domainObject.getPatient() != null) { if (domainObject.getPatient() instanceof HibernateProxy) // If the proxy is set, there is no need to lazy load, the proxy knows the // id already. { HibernateProxy p = (HibernateProxy) domainObject.getPatient(); int id = Integer.parseInt(p.getHibernateLazyInitializer().getIdentifier().toString()); valueObject.setPatient(new ims.core.patient.vo.PatientRefVo(id, -1)); } else { valueObject.setPatient( new ims.core.patient.vo.PatientRefVo( domainObject.getPatient().getId(), domainObject.getPatient().getVersion())); } } // ReferralDetails valueObject.setReferralDetails( ims.core.vo.domain.CatsReferralDetailsRepatriationRequestVoAssembler.create( map, domainObject.getReferralDetails())); // EpisodeOfCare if (domainObject.getEpisodeOfCare() != null) { if (domainObject.getEpisodeOfCare() instanceof HibernateProxy) // If the proxy is set, there is no need to lazy load, the proxy knows the // id already. { HibernateProxy p = (HibernateProxy) domainObject.getEpisodeOfCare(); int id = Integer.parseInt(p.getHibernateLazyInitializer().getIdentifier().toString()); valueObject.setEpisodeOfCare(new ims.core.admin.vo.EpisodeOfCareRefVo(id, -1)); } else { valueObject.setEpisodeOfCare( new ims.core.admin.vo.EpisodeOfCareRefVo( domainObject.getEpisodeOfCare().getId(), domainObject.getEpisodeOfCare().getVersion())); } } // CareContext if (domainObject.getCareContext() != null) { if (domainObject.getCareContext() instanceof HibernateProxy) // If the proxy is set, there is no need to lazy load, the proxy knows the // id already. { HibernateProxy p = (HibernateProxy) domainObject.getCareContext(); int id = Integer.parseInt(p.getHibernateLazyInitializer().getIdentifier().toString()); valueObject.setCareContext(new ims.core.admin.vo.CareContextRefVo(id, -1)); } else { valueObject.setCareContext( new ims.core.admin.vo.CareContextRefVo( domainObject.getCareContext().getId(), domainObject.getCareContext().getVersion())); } } // CurrentStatus valueObject.setCurrentStatus( ims.RefMan.vo.domain.CatsReferralStatusVoAssembler.create( map, domainObject.getCurrentStatus())); // StatusHistory valueObject.setStatusHistory( ims.RefMan.vo.domain.CatsReferralStatusVoAssembler .createCatsReferralStatusVoCollectionFromCATSReferralStatus( map, domainObject.getStatusHistory())); // Contract if (domainObject.getContract() != null) { if (domainObject.getContract() instanceof HibernateProxy) // If the proxy is set, there is no need to lazy load, the proxy knows the // id already. { HibernateProxy p = (HibernateProxy) domainObject.getContract(); int id = Integer.parseInt(p.getHibernateLazyInitializer().getIdentifier().toString()); valueObject.setContract(new ims.core.configuration.vo.ContractConfigRefVo(id, -1)); } else { valueObject.setContract( new ims.core.configuration.vo.ContractConfigRefVo( domainObject.getContract().getId(), domainObject.getContract().getVersion())); } } // Urgency ims.domain.lookups.LookupInstance instance8 = domainObject.getUrgency(); if (null != instance8) { ims.framework.utils.ImagePath img = null; ims.framework.utils.Color color = null; img = null; if (instance8.getImage() != null) { img = new ims.framework.utils.ImagePath( instance8.getImage().getImageId(), instance8.getImage().getImagePath()); } color = instance8.getColor(); if (color != null) color.getValue(); ims.RefMan.vo.lookups.ReferralUrgency voLookup8 = new ims.RefMan.vo.lookups.ReferralUrgency( instance8.getId(), instance8.getText(), instance8.isActive(), null, img, color); ims.RefMan.vo.lookups.ReferralUrgency parentVoLookup8 = voLookup8; ims.domain.lookups.LookupInstance parent8 = instance8.getParent(); while (parent8 != null) { if (parent8.getImage() != null) { img = new ims.framework.utils.ImagePath( parent8.getImage().getImageId(), parent8.getImage().getImagePath()); } else { img = null; } color = parent8.getColor(); if (color != null) color.getValue(); parentVoLookup8.setParent( new ims.RefMan.vo.lookups.ReferralUrgency( parent8.getId(), parent8.getText(), parent8.isActive(), null, img, color)); parentVoLookup8 = parentVoLookup8.getParent(); parent8 = parent8.getParent(); } valueObject.setUrgency(voLookup8); } // Journey if (domainObject.getJourney() != null) { if (domainObject.getJourney() instanceof HibernateProxy) // If the proxy is set, there is no need to lazy load, the proxy knows the // id already. { HibernateProxy p = (HibernateProxy) domainObject.getJourney(); int id = Integer.parseInt(p.getHibernateLazyInitializer().getIdentifier().toString()); valueObject.setJourney(new ims.pathways.vo.PatientPathwayJourneyRefVo(id, -1)); } else { valueObject.setJourney( new ims.pathways.vo.PatientPathwayJourneyRefVo( domainObject.getJourney().getId(), domainObject.getJourney().getVersion())); } } // PathwayID valueObject.setPathwayID(domainObject.getPathwayID()); // RTTClockImpact valueObject.setRTTClockImpact(domainObject.isRTTClockImpact()); // CurrentRTTStatus valueObject.setCurrentRTTStatus( ims.pathways.vo.domain.PathwayRTTStatusVoAssembler.create( map, domainObject.getCurrentRTTStatus())); // RepatriationRequest valueObject.setRepatriationRequest( ims.core.vo.domain.PendingEmergencyAdmissionRepatriationVoAssembler.create( map, domainObject.getRepatriationRequest())); // PatientCategory ims.domain.lookups.LookupInstance instance14 = domainObject.getPatientCategory(); if (null != instance14) { ims.framework.utils.ImagePath img = null; ims.framework.utils.Color color = null; img = null; if (instance14.getImage() != null) { img = new ims.framework.utils.ImagePath( instance14.getImage().getImageId(), instance14.getImage().getImagePath()); } color = instance14.getColor(); if (color != null) color.getValue(); ims.core.vo.lookups.PatientStatus voLookup14 = new ims.core.vo.lookups.PatientStatus( instance14.getId(), instance14.getText(), instance14.isActive(), null, img, color); ims.core.vo.lookups.PatientStatus parentVoLookup14 = voLookup14; ims.domain.lookups.LookupInstance parent14 = instance14.getParent(); while (parent14 != null) { if (parent14.getImage() != null) { img = new ims.framework.utils.ImagePath( parent14.getImage().getImageId(), parent14.getImage().getImagePath()); } else { img = null; } color = parent14.getColor(); if (color != null) color.getValue(); parentVoLookup14.setParent( new ims.core.vo.lookups.PatientStatus( parent14.getId(), parent14.getText(), parent14.isActive(), null, img, color)); parentVoLookup14 = parentVoLookup14.getParent(); parent14 = parent14.getParent(); } valueObject.setPatientCategory(voLookup14); } // IsEmergencyReferral valueObject.setIsEmergencyReferral(domainObject.isIsEmergencyReferral()); return valueObject; }