public ims.core.vo.ServiceShortVoCollection listServices(String serviceName) { StringBuilder hqlBuilder = new StringBuilder( "select s1_1 from ReferralService as r1_1 left join r1_1.referralServices as s1_1 where s1_1.upperName like :servName and s1_1.isActive = 1 "); List<?> dos = getDomainFactory().find(hqlBuilder.toString(), "servName", serviceName.toUpperCase() + "%"); if (dos == null || dos.size() == 0) return null; return ServiceShortVoAssembler.createServiceShortVoCollectionFromService(dos); }
public static java.util.Set extractServiceSet( ims.domain.ILightweightDomainFactory domainFactory, ims.core.vo.ServiceShortVoCollection voCollection, java.util.Set domainObjectSet, HashMap domMap) { int size = (null == voCollection) ? 0 : voCollection.size(); if (domainObjectSet == null) { domainObjectSet = new java.util.HashSet(); } java.util.Set newSet = new java.util.HashSet(); for (int i = 0; i < size; i++) { ims.core.vo.ServiceShortVo vo = voCollection.get(i); ims.core.clinical.domain.objects.Service domainObject = ServiceShortVoAssembler.extractService(domainFactory, vo, domMap); // TODO: This can only occur in the situation of a stale object exception. For now leave it to // the Interceptor to handle it. if (domainObject == null) { continue; } // Trying to avoid the hibernate collection being marked as dirty via its public interface // methods. (like add) if (!domainObjectSet.contains(domainObject)) domainObjectSet.add(domainObject); newSet.add(domainObject); } java.util.Set removedSet = new java.util.HashSet(); java.util.Iterator iter = domainObjectSet.iterator(); // Find out which objects need to be removed while (iter.hasNext()) { ims.domain.DomainObject o = (ims.domain.DomainObject) iter.next(); if ((o == null || o.getIsRIE() == null || !o.getIsRIE().booleanValue()) && !newSet.contains(o)) { removedSet.add(o); } } iter = removedSet.iterator(); // Remove the unwanted objects while (iter.hasNext()) { domainObjectSet.remove(iter.next()); } return domainObjectSet; }
public static java.util.List extractServiceList( ims.domain.ILightweightDomainFactory domainFactory, ims.core.vo.ServiceShortVoCollection voCollection, java.util.List domainObjectList, HashMap domMap) { int size = (null == voCollection) ? 0 : voCollection.size(); if (domainObjectList == null) { domainObjectList = new java.util.ArrayList(); } for (int i = 0; i < size; i++) { ims.core.vo.ServiceShortVo vo = voCollection.get(i); ims.core.clinical.domain.objects.Service domainObject = ServiceShortVoAssembler.extractService(domainFactory, vo, domMap); // TODO: This can only occur in the situation of a stale object exception. For now leave it to // the Interceptor to handle it. if (domainObject == null) { continue; } int domIdx = domainObjectList.indexOf(domainObject); if (domIdx == -1) { domainObjectList.add(i, domainObject); } else if (i != domIdx && i < domainObjectList.size()) { Object tmp = domainObjectList.get(i); domainObjectList.set(i, domainObjectList.get(domIdx)); domainObjectList.set(domIdx, tmp); } } // Remove all ones in domList where index > voCollection.size() as these should // now represent the ones removed from the VO collection. No longer referenced. int i1 = domainObjectList.size(); while (i1 > size) { domainObjectList.remove(i1 - 1); i1 = domainObjectList.size(); } return domainObjectList; }
/** * Update the ValueObject with the Domain Object. * * @param map DomainObjectMap of DomainObjects to already created ValueObjects. * @param valueObject to be updated * @param domainObject ims.scheduling.domain.objects.Sch_Session */ public static ims.scheduling.vo.SessionManagementVo insert( DomainObjectMap map, ims.scheduling.vo.SessionManagementVo valueObject, ims.scheduling.domain.objects.Sch_Session domainObject) { if (null == domainObject) { return valueObject; } if (null == map) { map = new DomainObjectMap(); } valueObject.setID_Sch_Session(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; // Name valueObject.setName(domainObject.getName()); // SessionDate java.util.Date SessionDate = domainObject.getSessionDate(); if (null != SessionDate) { valueObject.setSessionDate(new ims.framework.utils.Date(SessionDate)); } // StartTm String StartTm = domainObject.getStartTm(); if (null != StartTm) { valueObject.setStartTm(new ims.framework.utils.Time(StartTm)); } // EndTm String EndTm = domainObject.getEndTm(); if (null != EndTm) { valueObject.setEndTm(new ims.framework.utils.Time(EndTm)); } // Service valueObject.setService( ims.core.vo.domain.ServiceShortVoAssembler.create(map, domainObject.getService())); // SessionStatus ims.domain.lookups.LookupInstance instance6 = domainObject.getSessionStatus(); 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.scheduling.vo.lookups.Session_Status_and_Reason voLookup6 = new ims.scheduling.vo.lookups.Session_Status_and_Reason( instance6.getId(), instance6.getText(), instance6.isActive(), null, img, color); ims.scheduling.vo.lookups.Session_Status_and_Reason 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.scheduling.vo.lookups.Session_Status_and_Reason( parent6.getId(), parent6.getText(), parent6.isActive(), null, img, color)); parentVoLookup6 = parentVoLookup6.getParent(); parent6 = parent6.getParent(); } valueObject.setSessionStatus(voLookup6); } // RemainingSlots valueObject.setRemainingSlots(domainObject.getRemainingSlots()); // TotalSlots valueObject.setTotalSlots(domainObject.getTotalSlots()); // RemainingTime valueObject.setRemainingTime(domainObject.getRemainingTime()); // SchLocation valueObject.setSchLocation( ims.core.vo.domain.LocationLiteVoAssembler.create(map, domainObject.getSchLocation())); // SessionType ims.domain.lookups.LookupInstance instance11 = domainObject.getSessionType(); if (null != instance11) { ims.framework.utils.ImagePath img = null; ims.framework.utils.Color color = null; img = null; if (instance11.getImage() != null) { img = new ims.framework.utils.ImagePath( instance11.getImage().getImageId(), instance11.getImage().getImagePath()); } color = instance11.getColor(); if (color != null) color.getValue(); ims.scheduling.vo.lookups.Sched_Profile_Type voLookup11 = new ims.scheduling.vo.lookups.Sched_Profile_Type( instance11.getId(), instance11.getText(), instance11.isActive(), null, img, color); ims.scheduling.vo.lookups.Sched_Profile_Type parentVoLookup11 = voLookup11; ims.domain.lookups.LookupInstance parent11 = instance11.getParent(); while (parent11 != null) { if (parent11.getImage() != null) { img = new ims.framework.utils.ImagePath( parent11.getImage().getImageId(), parent11.getImage().getImagePath()); } else { img = null; } color = parent11.getColor(); if (color != null) color.getValue(); parentVoLookup11.setParent( new ims.scheduling.vo.lookups.Sched_Profile_Type( parent11.getId(), parent11.getText(), parent11.isActive(), null, img, color)); parentVoLookup11 = parentVoLookup11.getParent(); parent11 = parent11.getParent(); } valueObject.setSessionType(voLookup11); } // ListOwners valueObject.setListOwners( ims.scheduling.vo.domain.Session_ListOwnerVoAssembler .createSession_ListOwnerVoCollectionFromSession_ListOwner( map, domainObject.getListOwners())); // DirectoryofServices valueObject.setDirectoryofServices( ims.scheduling.vo.domain.DirectoryOfServiceVoAssembler .createDirectoryOfServiceVoCollectionFromDirectoryofService( map, domainObject.getDirectoryofServices())); // IsTheatreSession valueObject.setIsTheatreSession(domainObject.isIsTheatreSession()); return valueObject; }