Search in sources :

Example 1 with APIRevisionAPIInfoDTO

use of org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.APIRevisionAPIInfoDTO in project carbon-apimgt by wso2.

the class APIMappingUtil method fromAPIRevisiontoDTO.

public static APIRevisionDTO fromAPIRevisiontoDTO(APIRevision model) throws APIManagementException {
    APIRevisionDTO apiRevisionDTO = new APIRevisionDTO();
    apiRevisionDTO.setId(model.getRevisionUUID());
    String key = "Revision " + model.getId();
    apiRevisionDTO.setDisplayName(key);
    apiRevisionDTO.setDescription(model.getDescription());
    if (model.getCreatedTime() != null) {
        try {
            apiRevisionDTO.setCreatedTime(parseStringToDate(model.getCreatedTime()));
        } catch (java.text.ParseException e) {
            throw new APIManagementException("Error while parsing the created time:" + model.getCreatedTime(), e);
        }
    }
    APIRevisionAPIInfoDTO apiRevisionAPIInfoDTO = new APIRevisionAPIInfoDTO();
    apiRevisionAPIInfoDTO.setId(model.getApiUUID());
    apiRevisionDTO.setApiInfo(apiRevisionAPIInfoDTO);
    List<APIRevisionDeploymentDTO> apiRevisionDeploymentDTOS = new ArrayList<>();
    if (model.getApiRevisionDeploymentList() != null) {
        for (APIRevisionDeployment apiRevisionDeployment : model.getApiRevisionDeploymentList()) {
            apiRevisionDeploymentDTOS.add(fromAPIRevisionDeploymenttoDTO(apiRevisionDeployment));
        }
    }
    apiRevisionDTO.setDeploymentInfo(apiRevisionDeploymentDTOS);
    return apiRevisionDTO;
}
Also used : APIRevisionAPIInfoDTO(org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.APIRevisionAPIInfoDTO) APIManagementException(org.wso2.carbon.apimgt.api.APIManagementException) APIRevisionDeploymentDTO(org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.APIRevisionDeploymentDTO) ArrayList(java.util.ArrayList) APIRevisionDeployment(org.wso2.carbon.apimgt.api.model.APIRevisionDeployment) APIRevisionDTO(org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.APIRevisionDTO)

Aggregations

ArrayList (java.util.ArrayList)1 APIManagementException (org.wso2.carbon.apimgt.api.APIManagementException)1 APIRevisionDeployment (org.wso2.carbon.apimgt.api.model.APIRevisionDeployment)1 APIRevisionAPIInfoDTO (org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.APIRevisionAPIInfoDTO)1 APIRevisionDTO (org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.APIRevisionDTO)1 APIRevisionDeploymentDTO (org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.APIRevisionDeploymentDTO)1