public LocMostVoCollection listLocation(LocMostVo locationFilter) { List locations; if (locationFilter == null) { // wdev-2730 StringBuffer hql = new StringBuffer(); hql.append(" from LocSite as ls"); hql.append(" where"); hql.append(" and ls.isActive =:active"); hql.append(" and ls.isRIE is null"); hql.append(" and ls.isVirtual =:virtual"); locations = getDomainFactory().find(hql.toString(), new String[]{"active", "virtual"}, new Object[]{Boolean.TRUE, Boolean.FALSE}); } else { locations = listLocationsByParentLocation(locationFilter.getType(),locationFilter.getParentLocation(),locationFilter.getIsActive(),locationFilter.getReferringHospital(),locationFilter.getTreatingHosp(), null); } return LocMostVoAssembler.createLocMostVoCollectionFromLocation(locations).sort(); }
public LocMostVo getLocationByPostCode(String postCode) { if (postCode == null) return null; DomainFactory factory = getDomainFactory(); String hql = " from Location l where l.address.postCode = :postCode "; List locList = factory.find(hql,new String[]{"postCode"}, new Object[]{postCode}); if (locList != null && locList.size() == 1) { return LocMostVoAssembler.create((Location) locList.get(0)); } else if (locList != null && locList.size() > 1) { throw new DomainRuntimeException("Non unique hit on Location by Post Code " + postCode); } return null; }
private LocationRefVo getHospital(ims.core.resource.place.vo.LocationRefVo voRef) { LocMostVo voLocation = LocMostVoAssembler.create((Location)getDomainFactory().getDomainObject(voRef)); if(voLocation != null && voLocation.getType().equals(getDomLookup(LocationType.HOSP))) return (LocationRefVo) voLocation; while(voLocation != null && voLocation.getParentLocation() != null) { voLocation = voLocation.getParentLocation(); if((voLocation instanceof LocMostVo) && (voLocation.getType().equals(LocationType.HOSP))) return (LocationRefVo) voLocation; } return voRef; }
private LocationRefVo getHospital(ims.core.resource.place.vo.LocationRefVo voRef) { LocMostVo voLocation = LocMostVoAssembler.create((Location)getDomainFactory().getDomainObject(voRef)); if(voLocation != null && voLocation.getType().equals(getDomLookup(LocationType.HOSP))) return (LocationRefVo) voLocation; while(voLocation != null && voLocation.getParentLocation() != null) { voLocation = voLocation.getParentLocation(); if(voLocation instanceof LocMostVo && voLocation.getType().equals(LocationType.HOSP)) return (LocationRefVo) voLocation; } return voRef; }
public LocMostVoCollection listLocation(LocMostVo locationFilter) { List locations; if (locationFilter == null) { // wdev-2730 StringBuffer hql = new StringBuffer(); hql.append(" from LocSite as ls"); hql.append(" where"); hql.append(" and ls.isActive =:active"); hql.append(" and ls.isRIE is null"); hql.append(" and ls.isVirtual =:virtual"); locations = getDomainFactory().find(hql.toString(), new String[]{"active", "virtual"}, new Object[]{Boolean.TRUE, Boolean.FALSE}); } else { locations = listLocationsByParentLocation(locationFilter.getType(),locationFilter.getParentLocation(),locationFilter.getIsActive(),locationFilter.getReferringHospital(),locationFilter.getTreatingHosp(),null, null); //WDEV-20395 } return LocMostVoAssembler.createLocMostVoCollectionFromLocation(locations).sort(); }
public void deleteLocation(LocMostVo locToDelete) throws ForeignKeyViolationException { DomainFactory factory = getDomainFactory(); Location doLocation = LocMostVoAssembler.extractLocation(factory, locToDelete); if (doLocation.getServices().size() > 0) { throw new ForeignKeyViolationException("There are Services associated with this Location. Cannot delete."); } if (doLocation.getActivityLimitGroup().size() > 0) { throw new ForeignKeyViolationException("There are Activity Limits associated with this Location. Cannot delete."); } Location doParentLocation = doLocation.getParentLocation(); if (doParentLocation != null) doParentLocation.getLocations().remove(doLocation); // WDEV - 12551 - Display an appropriate message // when deleting fails try { factory.delete(doLocation); } catch (Exception ex) { throw new ForeignKeyViolationException("Location is in use and can not be deleted."); } }
public LocMostVoCollection listLocSite(OrgShortVo organisation) { LocMostVoCollection voCollLocation = new LocMostVoCollection(); DomainFactory factory = getDomainFactory(); Organisation doOrganisation = (Organisation) factory.getDomainObject(Organisation.class, organisation.getID_Organisation()); populateLocationCollection(LocMostVoAssembler.createLocMostVoCollectionFromLocation(doOrganisation.getLocationSites()), voCollLocation); return voCollLocation; }
public ims.core.vo.LocMostVo getLocation(ims.core.resource.place.vo.LocationRefVo location) { if (location == null || location.getID_Location() == null) return null; DomainFactory factory = getDomainFactory(); return LocMostVoAssembler.create((Location) factory.getDomainObject(Location.class, location.getID_Location())); }
public LocMostVo getLocation(LocationRefVo voLocRef) { DomainFactory factory = getDomainFactory(); return LocMostVoAssembler.create((Location) factory.getDomainObject(Location.class, voLocRef.getID_Location())); }
public LocMostVo getLocation(ims.core.resource.place.vo.LocationRefVo voLocRef) { DomainFactory factory = getDomainFactory(); return LocMostVoAssembler.create((Location) factory.getDomainObject(Location.class, voLocRef.getID_Location())); }
/** * Save Location */ public LocMostVo saveLocation(LocMostVo location) throws StaleObjectException, UniqueKeyViolationException { if (!location.isValidated()) throw new DomainRuntimeException("Location not Validated."); DomainFactory factory = getDomainFactory(); HashMap<?,?> map = new HashMap<Object, Object>(); Location doLocation = LocMostVoAssembler.extractLocation(factory, location,map); // uniqueness constraint removed form the database - must be implemented in code. if (checkLocationNameIsUnique(location.getName(), location.getID_Location())!= null ) { throw new UniqueKeyViolationException("A record with the same name already exists, Please change"); } try { doLocation.setUpperNames(); factory.save(doLocation); // wdev-6404 Clear REMOTE_LOC_CACHE on save REMOTE_LOC_CACHE.clear(); } catch (UnqViolationUncheckedException e) { String dupMessage = Keywords.checkDuplicateTaxonomy(factory, doLocation, "codeMappings", location.getCodeMappings(), "getName"); if(dupMessage != null) throw new UniqueKeyViolationException(dupMessage); //WDEV-12600 - Check if the child location don't contain duplicate mappings if (location.getLocationsIsNotNull()) { checkChildsForDuplicateTaxonoy(location.getLocations(), map, factory); } throw new UniqueKeyViolationException("An Location with this name already exists, Please change", e); } return LocMostVoAssembler.create(doLocation); }
/** * moveLocation */ @SuppressWarnings("unchecked") public void moveLocation(LocMostVo locToMove, ims.core.vo.LocSiteVo locSiteCurrentParent, LocMostVo locCurrentParent, ims.core.vo.LocSiteVo locSiteDestParent, LocMostVo locDestParent) throws StaleObjectException { DomainFactory factory = getDomainFactory(); Location doLocToMove = LocMostVoAssembler.extractLocation(factory, locToMove); Location doLocCurrentParent = LocMostVoAssembler.extractLocation(factory, locCurrentParent); Location doLocDestParent = LocMostVoAssembler.extractLocation(factory, locDestParent); LocSite doLocSiteCurrentParent = LocSiteVoAssembler.extractLocSite(factory, locSiteCurrentParent); LocSite doLocSiteDestParent = LocSiteVoAssembler.extractLocSite(factory, locSiteDestParent); if (doLocCurrentParent != null) { doLocToMove.setParentLocation(null); if (doLocCurrentParent.getLocations().size() > 0) doLocCurrentParent.getLocations().remove(doLocToMove); } else if (doLocSiteCurrentParent != null) { doLocToMove.setParentLocation(null); if (doLocSiteCurrentParent.getLocations().size() > 0) doLocSiteCurrentParent.getLocations().remove(doLocToMove); } if (locSiteDestParent != null) { doLocToMove.setParentLocation(doLocSiteDestParent); doLocSiteDestParent.getLocations().add(doLocToMove); } else if (locDestParent != null) { doLocToMove.setParentLocation(doLocDestParent); doLocDestParent.getLocations().add(doLocToMove); } if(doLocCurrentParent != null) factory.refresh(doLocCurrentParent); if(doLocSiteCurrentParent != null) factory.refresh(doLocSiteCurrentParent); factory.save(doLocToMove); //WDEV-10574 REMOTE_LOC_CACHE.clear(); }
public LocMostVo getLocMost(Integer id) { DomainFactory factory = getDomainFactory(); return LocMostVoAssembler.create((Location)factory.getDomainObject(Location.class, id)); }
public ims.core.vo.LocMostVo getLocation(ims.core.resource.place.vo.LocationRefVo voLocRef) { DomainFactory factory = getDomainFactory(); return LocMostVoAssembler.create((Location) factory.getDomainObject(Location.class, voLocRef.getID_Location())); }