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;
}
Aggregations