Search in sources :

Example 1 with APILoggingConfigDTO

use of org.wso2.carbon.apimgt.internal.service.dto.APILoggingConfigDTO in project carbon-apimgt by wso2.

the class ApiLoggingConfigsApiServiceImpl method apiLoggingConfigsGet.

public Response apiLoggingConfigsGet(MessageContext messageContext) {
    ErrorDTO errorObject = new ErrorDTO();
    Response.Status status = Response.Status.NOT_IMPLEMENTED;
    errorObject.setCode(200);
    errorObject.setMessage(status.toString());
    List<APILoggingConfigDTO> loggingAPIDTOList = new ArrayList<>();
    try {
        List<APILogInfoDTO> apiLoggerList = LoggingMgtDAO.getInstance().retrieveAllAPILoggerList();
        for (APILogInfoDTO apiLogInfo : apiLoggerList) {
            APILoggingConfigDTO apiLoggingConfigDTO = new APILoggingConfigDTO();
            apiLoggingConfigDTO.setContext(apiLogInfo.getContext());
            apiLoggingConfigDTO.setLogLevel(apiLogInfo.getLogLevel());
            loggingAPIDTOList.add(apiLoggingConfigDTO);
        }
    } catch (APIManagementException e) {
        log.error("Error while retrieving api logger list");
    }
    APILoggingConfigListDTO apiLoggingConfigListDTO = new APILoggingConfigListDTO();
    apiLoggingConfigListDTO.apis(loggingAPIDTOList);
    return Response.ok().entity(apiLoggingConfigListDTO).build();
}
Also used : Response(javax.ws.rs.core.Response) APILoggingConfigDTO(org.wso2.carbon.apimgt.internal.service.dto.APILoggingConfigDTO) APIManagementException(org.wso2.carbon.apimgt.api.APIManagementException) ErrorDTO(org.wso2.carbon.apimgt.internal.service.dto.ErrorDTO) ArrayList(java.util.ArrayList) APILoggingConfigListDTO(org.wso2.carbon.apimgt.internal.service.dto.APILoggingConfigListDTO) APILogInfoDTO(org.wso2.carbon.apimgt.impl.dto.APILogInfoDTO)

Aggregations

ArrayList (java.util.ArrayList)1 Response (javax.ws.rs.core.Response)1 APIManagementException (org.wso2.carbon.apimgt.api.APIManagementException)1 APILogInfoDTO (org.wso2.carbon.apimgt.impl.dto.APILogInfoDTO)1 APILoggingConfigDTO (org.wso2.carbon.apimgt.internal.service.dto.APILoggingConfigDTO)1 APILoggingConfigListDTO (org.wso2.carbon.apimgt.internal.service.dto.APILoggingConfigListDTO)1 ErrorDTO (org.wso2.carbon.apimgt.internal.service.dto.ErrorDTO)1