public LocationDepartmentTypesVo getLocationDepartmentTypes(LocationRefVo edLocation) { if(edLocation == null || edLocation.getID_Location() == null) return null; DomainFactory factory = getDomainFactory(); String query = "from LocationDepartmentTypes as ldt where ldt.eDLocation.id = :EmergencyLocation"; List<?> departments = factory.find(query, new String[] {"EmergencyLocation"}, new Object[] {edLocation.getID_Location()}); if(departments != null && departments.size() > 0) { return LocationDepartmentTypesVoAssembler.create((LocationDepartmentTypes) departments.get(0)); } return null; }
public ims.emergency.vo.LocationDepartmentTypesVo save(ims.emergency.vo.LocationDepartmentTypesVo locationDepartmentTypes) throws ims.domain.exceptions.StaleObjectException { if(locationDepartmentTypes == null) throw new CodingRuntimeException("Cannnot save a null LocationDepartmentType."); if(!locationDepartmentTypes.isValidated()) throw new CodingRuntimeException("LocationDepartmentType is not validated."); DomainFactory factory = getDomainFactory(); LocationDepartmentTypes doLocationDepartmentType = LocationDepartmentTypesVoAssembler.extractLocationDepartmentTypes(factory, locationDepartmentTypes); if(locationDepartmentTypes.getID_LocationDepartmentTypes() == null) { LocationDepartmentTypesVo locationDepartmentTypesFromDB = get(locationDepartmentTypes.getEDLocation()); if(locationDepartmentTypesFromDB != null && locationDepartmentTypesFromDB.getID_LocationDepartmentTypes() != null) throw new StaleObjectException(doLocationDepartmentType); } factory.save(doLocationDepartmentType); return LocationDepartmentTypesVoAssembler.create(doLocationDepartmentType); }
public LocationDepartmentTypesVo get(LocationRefVo edLocation) { if(edLocation == null || edLocation.getID_Location() == null) return null; String query = "from LocationDepartmentTypes as locConfig where locConfig.eDLocation.id = :EDLocationId"; DomainFactory factory = getDomainFactory(); List<?> list = factory.find(query, new String[] {"EDLocationId"}, new Object[] {edLocation.getID_Location()}); if(list != null && list.size() > 0) return LocationDepartmentTypesVoAssembler.create((LocationDepartmentTypes) list.get(0)); return null; }