use of org.wso2.carbon.apimgt.rest.api.store.v1.dto.DocumentDTO in project carbon-apimgt by wso2.
the class DocumentationMappingUtil method fromDocumentationToDTO.
/**
* Converts a APIM core Document object into corresponding REST API Document DTO object.
*
* @param documentation Documentation object
* @return a new DocumentDTO object corresponding to given Documentation object
*/
public static DocumentDTO fromDocumentationToDTO(Documentation documentation) {
DocumentDTO documentDTO = new DocumentDTO();
documentDTO.setDocumentId(documentation.getId());
documentDTO.setName(documentation.getName());
documentDTO.setSummary(documentation.getSummary());
documentDTO.setType(DocumentDTO.TypeEnum.fromValue(documentation.getType().toString()));
documentDTO.setOtherTypeName(documentation.getOtherTypeName());
documentDTO.setFileName(documentation.getFilePath());
if (documentation.getSourceType() != null) {
documentDTO.setSourceType(DocumentDTO.SourceTypeEnum.fromValue(documentation.getSourceType().toString()));
}
documentDTO.setSourceUrl(documentation.getSourceUrl());
if (documentation.getVisibility() != null) {
documentDTO.setVisibility(DocumentDTO.VisibilityEnum.fromValue(documentation.getVisibility().toString()));
}
return documentDTO;
}
use of org.wso2.carbon.apimgt.rest.api.store.v1.dto.DocumentDTO in project carbon-apimgt by wso2.
the class DocumentationMappingUtil method fromDTOtoDocumentation.
/**
* Converts a REST API Document DTO object into corresponding APIM core Document object.
*
* @param documentDTO DocumentDTO object
* @return a new Documentation object corresponding to given DocumentDTO object
*/
public static Documentation fromDTOtoDocumentation(DocumentDTO documentDTO) {
Documentation documentation = new Documentation(DocumentationType.valueOf(documentDTO.getType().toString()), documentDTO.getName());
documentation.setSummary(documentDTO.getSummary());
if (documentDTO.getSourceType() != null) {
documentation.setSourceType(Documentation.DocumentSourceType.valueOf(documentDTO.getSourceType().toString()));
}
documentation.setSourceUrl(documentDTO.getSourceUrl());
documentation.setOtherTypeName(documentDTO.getOtherTypeName());
documentation.setFilePath(documentDTO.getFileName());
if (documentDTO.getVisibility() != null) {
documentation.setVisibility(Documentation.DocumentVisibility.valueOf(documentDTO.getVisibility().toString()));
}
return documentation;
}
Aggregations