public TrackingConfigurationVo save(TrackingConfigurationVo trackingConfigToSave) throws StaleObjectException, UniqueKeyViolationException { if (trackingConfigToSave == null ) throw new CodingRuntimeException("Cannot save TrackingConfiguration if null or get TrackingConfiguration on null ID . "); if (!trackingConfigToSave.isValidated()) throw new CodingRuntimeException("TrackingConfigurationVo not Validated"); try { DomainFactory factory = getDomainFactory(); TrackingConfiguration trackingConfig = TrackingConfigurationVoAssembler.extractTrackingConfiguration(factory,trackingConfigToSave); factory.save(trackingConfig); return TrackingConfigurationVoAssembler.create(trackingConfig); } catch (UnqViolationUncheckedException e) { throw new UniqueKeyViolationException("This Configuration Already Exist!", e); } }
public TrackingConfigurationVo getTrackingConfig(LocationRefVo locationID) { if(locationID == null) throw new CodingRuntimeException("Can not get TrackingConfiguration value on null locationID."); StringBuffer hql = new StringBuffer(); hql.append("select trackConfig 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[] {locationID.getID_Location()}); if (list!=null && list.size()>0) { return TrackingConfigurationVoAssembler.createTrackingConfigurationVoCollectionFromTrackingConfiguration(list).get(0); } return null; }
public TrackingConfigurationVo getTrackingConfig(LocationRefVo locationId) { if(locationId == null) throw new CodingRuntimeException("Can not get TrackingConfiguration value on null locationID."); StringBuffer hql = new StringBuffer(); hql.append("select trackConfig 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[] {locationId.getID_Location()}); if (list!=null && list.size()>0) { return TrackingConfigurationVoAssembler.createTrackingConfigurationVoCollectionFromTrackingConfiguration(list).get(0); } return null; }
public TrackingConfigurationVo getTrackingConfig(LocationRefVo locationRef) { if(locationRef == null) throw new CodingRuntimeException("Can not get TrackingConfiguration value on null locationID."); StringBuffer hql = new StringBuffer(); hql.append("select trackConfig 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()}); if (list!=null && list.size()>0) { return TrackingConfigurationVoAssembler.createTrackingConfigurationVoCollectionFromTrackingConfiguration(list).get(0); } return null; }
public TrackingConfigurationVoCollection listEDLocations() { DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer(); //List only Emergency Departments hql.append(" select edloc from TrackingConfiguration as edloc left join edloc.eDLocation as loc where loc.type = " + LocationType.ANE.getId()); hql.append(" and loc.isActive =:active"); hql.append(" and loc.isRIE is null"); hql.append(" and loc.isVirtual =:virtual"); hql.append(" order by loc.name asc "); List<?> locationList = factory.find(hql.toString(), new String[]{"active", "virtual"}, new Object[]{Boolean.TRUE, Boolean.FALSE}); return TrackingConfigurationVoAssembler.createTrackingConfigurationVoCollectionFromTrackingConfiguration(locationList); }
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; }