package com.eksad.masterdata.controller; import com.eksad.ddms.common.util.response.ResponseDTO; import com.eksad.ddms.common.util.status.ResponseStatus; import com.eksad.masterdata.common.dto.ConfigurationDTO; import com.eksad.masterdata.common.dto.responseDto.ResponseConfigurationGetDTO; import com.eksad.masterdata.service.ConfigurationService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; @Slf4j @RestController @RequestMapping("/configuration") public class ConfigurationRESTController { @Autowired ConfigurationService configurationService; @RequestMapping(value = "/get/{key}/{ahassId}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<ResponseConfigurationGetDTO> getConfigurationByKeyAndAhassID(@PathVariable("key") String key, @PathVariable("ahassId") String ahassId) throws ClassNotFoundException, InstantiationException, IllegalAccessException, NoSuchFieldException { ConfigurationDTO configurationDTO = configurationService.getConfigurationByKeyAndAhassID(key, ahassId); ResponseConfigurationGetDTO responseConfigurationGetDTO = new ResponseConfigurationGetDTO(); responseConfigurationGetDTO.setResponse(new ResponseDTO(ResponseStatus.S, HttpStatus.OK.toString(), "Found Configuration")); responseConfigurationGetDTO.setConfigurationDTO(configurationDTO); return ResponseEntity.ok(responseConfigurationGetDTO); } }