Ejemplo n.º 1
0
  public Facility getOperativeFacilityByCode(String facilityCode) {
    Facility facility = getFacilityByCode(facilityCode);

    Facility parentFacility = null;
    if (facility.getVirtualFacility()) {
      parentFacility = facilityRepository.getById(facility.getParentFacilityId());
    }

    if (!facility.isValid(parentFacility)) {
      throw new DataException("error.facility.inoperative");
    }

    return facility;
  }
Ejemplo n.º 2
0
 private void notify(List<Facility> facilities) {
   // TODO newFacility doesn't have modifiedDate populated
   for (Facility facility : facilities) {
     try {
       Facility parentFacility = facilityRepository.getById(facility.getParentFacilityId());
       FacilityFeedDTO facilityFeedDTO = new FacilityFeedDTO(facility, parentFacility);
       String content = facilityFeedDTO.getSerializedContents();
       eventService.notify(
           new Event(
               UUID.randomUUID().toString(),
               FACILITY_TITLE,
               DateTime.now(),
               "",
               content,
               FACILITY_CATEGORY));
     } catch (URISyntaxException e) {
       logger.error("Unable to generate facility event", e);
     }
   }
 }