public TrackingAreaVoCollection getAreas(ILocation location) { if (location == null ) { throw new CodingRuntimeException("Cannot get Location on null Id "); } DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer(); hql.append("select t2_1 "); hql.append(" from TrackingConfiguration as t1_1 left join t1_1.eDLocation as l1_1 left join t1_1.areas as t2_1 left join t2_1.status as l2_1"); hql.append(" where "); hql.append("(l1_1.id = :Location_id and t1_1.isActive = 1 and l2_1.id = :lookup_inst and (t2_1.isOverallView = 0 or t2_1.isOverallView is null ))"); List<?> list = factory.find(hql.toString(), new String[] {"Location_id","lookup_inst"}, new Object[] {location.getID(),ims.core.vo.lookups.PreActiveActiveInactiveStatus.ACTIVE.getID()}); return TrackingAreaVoAssembler.createTrackingAreaVoCollectionFromTrackingArea(list); }
public TrackingAreaVo saveTrackingArea(TrackingAreaVo trackingAreaToSave) throws StaleObjectException, UniqueKeyViolationException { if (trackingAreaToSave == null ) throw new CodingRuntimeException("Cannot save TrackingArea if null or get TrackingArea on null ID . "); if (!trackingAreaToSave.isValidated()) throw new CodingRuntimeException("TrackingAreaVo not Validated"); try { DomainFactory factory = getDomainFactory(); TrackingArea trackingArea = TrackingAreaVoAssembler.extractTrackingArea(factory,trackingAreaToSave); factory.save(trackingArea); return TrackingAreaVoAssembler.create(trackingArea); } catch (UnqViolationUncheckedException e) { throw new UniqueKeyViolationException("This Tracking Area Configuration Already Exist!", e); } }
public TrackingAreaVo getTrackingArea(TrackingAreaRefVo trackingAreaID) { if (trackingAreaID == null || trackingAreaID.getID_TrackingArea() == null) { throw new CodingRuntimeException("Cannot get TrackingAreaRefVo on null Id "); } DomainFactory factory = getDomainFactory(); TrackingArea domainTrackingArea = (TrackingArea) factory.getDomainObject(TrackingArea.class, trackingAreaID.getID_TrackingArea()); return TrackingAreaVoAssembler.create(domainTrackingArea); }
public ims.emergency.vo.TrackingAreaVo getTrackingArea(ims.emergency.configuration.vo.TrackingAreaRefVo trackingAreaRef) { if (trackingAreaRef == null || trackingAreaRef.getID_TrackingArea() == null) { throw new CodingRuntimeException("Cannot get TrackingAreaRefVo on null Id "); } DomainFactory factory = getDomainFactory(); TrackingArea domainTrackingArea = (TrackingArea) factory.getDomainObject(TrackingArea.class, trackingAreaRef.getID_TrackingArea()); return TrackingAreaVoAssembler.create(domainTrackingArea); }
public TrackingAreaVo getTrackingArea(TrackingAreaRefVo trackingArea) { if (trackingArea == null || trackingArea.getID_TrackingArea() == null) { throw new CodingRuntimeException("Cannot get TrackingAreaRefVo on null Id "); } DomainFactory factory = getDomainFactory(); TrackingArea domainTrackingArea = (TrackingArea) factory.getDomainObject(TrackingArea.class, trackingArea.getID_TrackingArea()); return TrackingAreaVoAssembler.create(domainTrackingArea); }
public TrackingAreaVoCollection getTrackingAreasByLocation(LocationRefVo locationRef) { if(locationRef == null) throw new CodingRuntimeException("Can not get Areas value on null Location."); StringBuffer hql = new StringBuffer(); hql.append("select trackConfig.areas from TrackingConfiguration as trackConfig "); hql.append("where trackConfig.eDLocation.id = :locationID "); DomainFactory factory = getDomainFactory(); List<?> list = factory.find(hql.toString(), new String[] {"locationID"}, new Object[] {locationRef.getID_Location()}); return TrackingAreaVoAssembler.createTrackingAreaVoCollectionFromTrackingArea(list); }
public TrackingConfigurationVo saveTrackinConfig(TrackingConfigurationVo trackingConfigToSave, TrackingAreaVo trackingAreaToSave) throws StaleObjectException { if (trackingConfigToSave == null && trackingAreaToSave==null) throw new CodingRuntimeException("Cannot save TrackingConfiguration/TrackingArea if null or get TrackingConfiguration/TrackingArea on null ID . "); DomainFactory factory = getDomainFactory(); if (trackingConfigToSave!=null) { if (!trackingConfigToSave.isValidated()) throw new CodingRuntimeException("TrackingConfigurationVo not Validated"); TrackingConfiguration trackingConfig = TrackingConfigurationVoAssembler.extractTrackingConfiguration(factory,trackingConfigToSave); factory.save(trackingConfig); return TrackingConfigurationVoAssembler.create(trackingConfig); } else if (trackingAreaToSave!=null) { if (!trackingAreaToSave.isValidated()) throw new CodingRuntimeException("TrackingAreaVo not Validated"); TrackingArea trackingArea = TrackingAreaVoAssembler.extractTrackingArea(factory,trackingAreaToSave); factory.save(trackingArea); return null; } return null; }
public ims.emergency.vo.TrackingAreaVoCollection getAreasDefinitions(ims.core.resource.place.vo.LocationRefVo locationID) { if(locationID == null) throw new CodingRuntimeException("Can not get TrackingConfiguration value on null locationID."); StringBuffer hql = new StringBuffer(); hql.append("select trackArea from TrackingConfiguration as trackConfig left join trackConfig.areas as trackArea "); hql.append("where (trackConfig.eDLocation.id = :locationID and trackArea.isOverallView = :isOverallView and trackArea.isRegistrationArea = :isRegistrationArea and trackArea.status.id <> -618) "); DomainFactory factory = getDomainFactory(); List<?> list = factory.find(hql.toString(), new String[] {"locationID","isOverallView","isRegistrationArea"}, new Object[] {locationID.getID_Location(),false,false}); return TrackingAreaVoAssembler.createTrackingAreaVoCollectionFromTrackingArea(list); }