Class LocationController

    • Constructor Detail

      • LocationController

        public LocationController()
    • Method Detail

      • createDistrict

        @RequestMapping(value="/district",
                        method=POST)
        @ResponseStatus(CREATED)
        @ResponseBody
        public DistrictCreationDto createDistrict​(@RequestBody @Valid
                                                  @Valid DistrictCreationDto districtCreationDto,
                                                  org.springframework.validation.BindingResult bindingResult)
        Creates District from given dto.
        Parameters:
        districtCreationDto - DTO of District to be created
        bindingResult - spring object used for validation
        Returns:
        created District
      • createSector

        @RequestMapping(value="/sector",
                        method=POST)
        @ResponseStatus(CREATED)
        @ResponseBody
        public SectorCreationDto createSector​(@RequestBody @Valid
                                              @Valid SectorCreationDto sectorCreationDto,
                                              org.springframework.validation.BindingResult bindingResult)
        Creates Sector from given dto.
        Parameters:
        sectorCreationDto - DTO of sector to be created
        bindingResult - spring object used for validation
        Returns:
        created Sector
      • createFacility

        @RequestMapping(value="/facility",
                        method=POST)
        @ResponseStatus(CREATED)
        @ResponseBody
        public FacilityCreationDto createFacility​(@RequestBody @Valid
                                                  @Valid FacilityCreationDto facilityCreationDto,
                                                  org.springframework.validation.BindingResult bindingResult)
        Creates Facility from given dto.
        Parameters:
        facilityCreationDto - DTO of facility to be created
        bindingResult - spring object used for validation
        Returns:
        created Facility
      • createVillage

        @RequestMapping(value="/village",
                        method=POST)
        @ResponseStatus(CREATED)
        @ResponseBody
        public VillageCreationDto createVillage​(@RequestBody @Valid
                                                @Valid VillageCreationDto villageCreationDto,
                                                org.springframework.validation.BindingResult bindingResult)
        Creates Village from it's dto.
        Parameters:
        villageCreationDto - DTO of village to be created
        bindingResult - spring object used for validation
        Returns:
        created Village
      • saveDistrict

        @RequestMapping(value="/district/{id}",
                        method=PUT)
        @ResponseStatus(OK)
        @ResponseBody
        public DistrictCreationDto saveDistrict​(@PathVariable("id")
                                                java.util.UUID id,
                                                @RequestBody @Valid
                                                @Valid DistrictCreationDto districtCreationDto,
                                                org.springframework.validation.BindingResult bindingResult)
        Update District from given dto.
        Parameters:
        id - id of District to update
        districtCreationDto - DTO of District to be updated
        bindingResult - spring object used for validation
        Returns:
        updated District
      • saveSector

        @RequestMapping(value="/sector/{id}",
                        method=PUT)
        @ResponseStatus(OK)
        @ResponseBody
        public SectorCreationDto saveSector​(@PathVariable("id")
                                            java.util.UUID id,
                                            @RequestBody @Valid
                                            @Valid SectorCreationDto sectorCreationDto,
                                            org.springframework.validation.BindingResult bindingResult)
        Update Sector from it's dto.
        Parameters:
        id - id of Sector to update
        sectorCreationDto - DTO of Sector to be updated
        bindingResult - spring object used for validation
        Returns:
        updated Sector
      • saveVillage

        @RequestMapping(value="/village/{id}",
                        method=PUT)
        @ResponseStatus(OK)
        @ResponseBody
        public VillageCreationDto saveVillage​(@PathVariable("id")
                                              java.util.UUID id,
                                              @RequestBody @Valid
                                              @Valid VillageCreationDto villageCreationDto,
                                              org.springframework.validation.BindingResult bindingResult)
        Update Village. from it's dto
        Parameters:
        id - id of Village to update
        villageCreationDto - DTO of Village to be updated
        bindingResult - spring object used for validation
        Returns:
        updated Village
      • saveFacility

        @RequestMapping(value="/facility/{id}",
                        method=PUT)
        @ResponseStatus(OK)
        @ResponseBody
        public FacilityCreationDto saveFacility​(@PathVariable("id")
                                                java.util.UUID id,
                                                @RequestBody @Valid
                                                @Valid FacilityCreationDto facilityCreationDto,
                                                org.springframework.validation.BindingResult bindingResult)
        Update Facility from it's dto.
        Parameters:
        id - id of Facility to update
        facilityCreationDto - DTO of Facility to be updated
        bindingResult - spring object used for validation
        Returns:
        updated Facility FacilityCreationDto
      • getDistrict

        @RequestMapping(value="/district/{id}",
                        method=GET)
        @ResponseStatus(OK)
        @ResponseBody
        public DistrictCreationDto getDistrict​(@PathVariable("id")
                                               java.util.UUID id)
        Get District with given id.
        Parameters:
        id - id of District to find
        Returns:
        DistrictCreationDto with given id
      • getSector

        @RequestMapping(value="/sector/{id}",
                        method=GET)
        @ResponseStatus(OK)
        @ResponseBody
        public SectorCreationDto getSector​(@PathVariable("id")
                                           java.util.UUID id)
        Get Sector with given id.
        Parameters:
        id - id of Sector to find
        Returns:
        SectorCreationDto with given id
      • getFacility

        @RequestMapping(value="/facility/{id}",
                        method=GET)
        @ResponseStatus(OK)
        @ResponseBody
        public FacilityExtendedInfoDto getFacility​(@PathVariable("id")
                                                   java.util.UUID id)
        Get Facility with given id.
        Parameters:
        id - id of Facility to find
        Returns:
        FacilityCreationDto with given id
      • getVillage

        @RequestMapping(value="/village/{id}",
                        method=GET)
        @ResponseStatus(OK)
        @ResponseBody
        public VillageExtendedInfoDto getVillage​(@PathVariable("id")
                                                 java.util.UUID id)
        Get Village with given id.
        Parameters:
        id - id of Village to find
        Returns:
        VillageCreationDto with given id
      • getDistricts

        @RequestMapping(value="/districts",
                        method=GET)
        @ResponseStatus(OK)
        @ResponseBody
        public java.util.List<DistrictDto> getDistricts()
        Get list of Districts.
        Returns:
        list of all districts
      • getDistrictsOnly

        @RequestMapping(value="/districtsOnly",
                        method=GET)
        @ResponseStatus(OK)
        @ResponseBody
        public java.util.Set<LocationPreviewDto> getDistrictsOnly()
        Get list of Districts for preview.
        Returns:
        list of all districts
      • getSectorsOnly

        @RequestMapping(value="/sectorsOnly",
                        method=GET)
        @ResponseStatus(OK)
        @ResponseBody
        public java.util.Set<LocationPreviewDto> getSectorsOnly()
        Get list of Sectors for preview.
        Returns:
        list of all Sectors
      • getFacilitiesOnly

        @RequestMapping(value="/facilitiesOnly",
                        method=GET)
        @ResponseStatus(OK)
        @ResponseBody
        public java.util.Set<LocationPreviewDto> getFacilitiesOnly()
        Get list of Facilitys for preview.
        Returns:
        list of all facilities
      • getVillagesOnly

        @RequestMapping(value="/villagesOnly",
                        method=GET)
        @ResponseStatus(OK)
        @ResponseBody
        public java.util.Set<LocationPreviewDto> getVillagesOnly()
        Get list of Villages for preview.
        Returns:
        list of all villages
      • searchDistricts

        @RequestMapping(value="district/locations/search",
                        method=GET)
        @ResponseStatus(OK)
        @ResponseBody
        public org.springframework.data.domain.Page<LocationPreviewDto> searchDistricts​(@RequestParam(value="name",required=false)
                                                                                        java.lang.String name,
                                                                                        org.springframework.data.domain.Pageable pageable)
        Finds Districts matching all of the provided parameters. If there are no parameters, return all districts.
        Parameters:
        name - of the district
        pageable - pagination parameters (page size, page number, sort order)
        Returns:
        page with districts
      • searchSectors

        @RequestMapping(value="sector/locations/search",
                        method=GET)
        @ResponseStatus(OK)
        @ResponseBody
        public org.springframework.data.domain.Page<LocationPreviewDto> searchSectors​(@RequestParam(value="name",required=false)
                                                                                      java.lang.String name,
                                                                                      @RequestParam(value="parent",required=false)
                                                                                      java.lang.String parentDistrict,
                                                                                      org.springframework.data.domain.Pageable pageable)
        Finds Sectors matching all of the provided parameters. If there are no parameters, return all Sectors.
        Parameters:
        pageable - pagination parameters (page size, page number, sort order)
        name - name of the sector
        parentDistrict - district to which sector may belong
        Returns:
        page with sectors
      • searchVillages

        @RequestMapping(value="village/locations/search",
                        method=GET)
        @ResponseStatus(OK)
        @ResponseBody
        public org.springframework.data.domain.Page<LocationPreviewDto> searchVillages​(@RequestParam(value="name",required=false)
                                                                                       java.lang.String name,
                                                                                       @RequestParam(value="parent",required=false)
                                                                                       java.lang.String parentFacility,
                                                                                       @RequestParam(value="sectorName",required=false)
                                                                                       java.lang.String sector,
                                                                                       @RequestParam(value="districtName",required=false)
                                                                                       java.lang.String district,
                                                                                       org.springframework.data.domain.Pageable pageable)
        Finds Villages matching all of the provided parameters. If there are no parameters, return all Villages.
        Parameters:
        name - name of the village
        pageable - pagination parameters (page size, page number, sort order)
        district - District to which villages may belong
        parentFacility - Facility to which villages may belong
        sector - Sector to which villages may belong
        Returns:
        page with villages
      • searchFacilities

        @RequestMapping(value="facility/locations/search",
                        method=GET)
        @ResponseStatus(OK)
        @ResponseBody
        public org.springframework.data.domain.Page<LocationPreviewDto> searchFacilities​(@RequestParam(value="name",required=false)
                                                                                         java.lang.String name,
                                                                                         @RequestParam(value="inchargeFullName",required=false)
                                                                                         java.lang.String inchargeFullName,
                                                                                         @RequestParam(value="inchargePhone",required=false)
                                                                                         java.lang.String inchargePhone,
                                                                                         @RequestParam(value="inchargeEmail",required=false)
                                                                                         java.lang.String inchargeEmail,
                                                                                         @RequestParam(value="parent",required=false)
                                                                                         java.lang.String parentSector,
                                                                                         @RequestParam(value="districtName",required=false)
                                                                                         java.lang.String district,
                                                                                         org.springframework.data.domain.Pageable pageable)
        Finds facilities matching all of the provided parameters. If there are no parameters, return all facilities.
        Parameters:
        district - name of the District to which facility may belong
        pageable - pagination parameters (page size, page number, sort order)
        name - name of facility
        inchargeEmail - email of person in charge
        inchargeFullName - full name of person in charge
        inchargePhone - phone of person in charge
        parentSector - name Sector to which facility may belong
        Returns:
        page with facilities
      • importSectorCsv

        @RequestMapping(value="/sector/import",
                        method=POST)
        @ResponseStatus(OK)
        @ResponseBody
        public java.util.Map<java.lang.Integer,​java.lang.String> importSectorCsv​(@RequestPart("file")
                                                                                       org.springframework.web.multipart.MultipartFile file)
                                                                                throws java.io.IOException
        Import list of Sectors in ".csv" format to mots, parse it and save records in DB.
        Parameters:
        file - File in ".csv" format to upload
        Returns:
        map with row numbers as keys and errors as values.
        Throws:
        java.io.IOException - if there is an error while reading a file
      • importVillageCsv

        @RequestMapping(value="/village/import",
                        method=POST)
        @ResponseStatus(OK)
        @ResponseBody
        public java.util.Map<java.lang.Integer,​java.lang.String> importVillageCsv​(@RequestPart("file")
                                                                                        org.springframework.web.multipart.MultipartFile file)
                                                                                 throws java.io.IOException
        Import list of Villages in ".csv" format to mots, parse it and save records in DB.
        Parameters:
        file - File in ".csv" format to upload
        Returns:
        map with row numbers as keys and errors as values.
        Throws:
        java.io.IOException - if there is an error while reading a file
      • importFacilityCsv

        @RequestMapping(value="/facility/import",
                        method=POST)
        @ResponseStatus(OK)
        @ResponseBody
        public java.util.Map<java.lang.Integer,​java.lang.String> importFacilityCsv​(@RequestPart("file")
                                                                                         org.springframework.web.multipart.MultipartFile file)
                                                                                  throws java.io.IOException
        Import list of Facilities in ".csv" format to mots, parse it and save records in DB.
        Parameters:
        file - File in ".csv" format to upload
        Returns:
        map with row numbers as keys and errors as values.
        Throws:
        java.io.IOException - if there is an error while reading a file