Search in sources :

Example 1 with DocumentSearchResultDTO

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

the class SearchResultMappingUtil method fromDocumentationToDocumentResultDTO.

/**
 * Get Document result representation for content search
 * @param document
 * @return
 */
public static DocumentSearchResultDTO fromDocumentationToDocumentResultDTO(Documentation document, API api) {
    DocumentSearchResultDTO docResultDTO = new DocumentSearchResultDTO();
    docResultDTO.setId(document.getId());
    docResultDTO.setName(document.getName());
    docResultDTO.setDocType(DocumentSearchResultDTO.DocTypeEnum.valueOf(document.getType().toString()));
    docResultDTO.setType(SearchResultDTO.TypeEnum.DOC);
    docResultDTO.setSummary(document.getSummary());
    docResultDTO.setVisibility(DocumentSearchResultDTO.VisibilityEnum.valueOf(document.getVisibility().toString()));
    docResultDTO.setSourceType(DocumentSearchResultDTO.SourceTypeEnum.valueOf(document.getSourceType().toString()));
    docResultDTO.setOtherTypeName(document.getOtherTypeName());
    APIIdentifier apiId = api.getId();
    docResultDTO.setApiName(apiId.getApiName());
    docResultDTO.setApiVersion(apiId.getVersion());
    docResultDTO.setApiProvider(apiId.getProviderName());
    docResultDTO.setApiUUID(api.getUUID());
    return docResultDTO;
}
Also used : APIIdentifier(org.wso2.carbon.apimgt.api.model.APIIdentifier) DocumentSearchResultDTO(org.wso2.carbon.apimgt.rest.api.store.v1.dto.DocumentSearchResultDTO)

Example 2 with DocumentSearchResultDTO

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

the class SearchResultMappingUtil method fromDocumentationToDocumentResultDTO.

/**
 * Get Document result representation for content search.
 *
 * @param document Api Document
 * @return DocumentSearchResultDTO
 */
public static DocumentSearchResultDTO fromDocumentationToDocumentResultDTO(Documentation document, API api) throws APIManagementException {
    DocumentSearchResultDTO docResultDTO = new DocumentSearchResultDTO();
    docResultDTO.setId(document.getId());
    docResultDTO.setName(document.getName());
    docResultDTO.setDocType(DocumentSearchResultDTO.DocTypeEnum.valueOf(document.getType().toString()));
    docResultDTO.setType(SearchResultDTO.TypeEnum.DOC);
    docResultDTO.setSummary(document.getSummary());
    docResultDTO.associatedType(APIConstants.AuditLogConstants.API);
    docResultDTO.setVisibility(mapVisibilityFromDocumentToDTO(document.getVisibility()));
    docResultDTO.setSourceType(mapSourceTypeFromDocumentToDTO(document.getSourceType()));
    docResultDTO.setOtherTypeName(document.getOtherTypeName());
    APIIdentifier apiId = api.getId();
    docResultDTO.setApiName(apiId.getApiName());
    docResultDTO.setApiVersion(apiId.getVersion());
    docResultDTO.setApiProvider(APIUtil.replaceEmailDomainBack(apiId.getProviderName()));
    docResultDTO.setApiUUID(api.getUUID());
    return docResultDTO;
}
Also used : APIIdentifier(org.wso2.carbon.apimgt.api.model.APIIdentifier) DocumentSearchResultDTO(org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.DocumentSearchResultDTO)

Example 3 with DocumentSearchResultDTO

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

the class SearchResultMappingUtil method fromDocumentationToProductDocumentResultDTO.

public static DocumentSearchResultDTO fromDocumentationToProductDocumentResultDTO(Documentation document, APIProduct apiProduct) throws APIManagementException {
    DocumentSearchResultDTO docResultDTO = new DocumentSearchResultDTO();
    docResultDTO.setId(document.getId());
    docResultDTO.setName(document.getName());
    docResultDTO.setDocType(DocumentSearchResultDTO.DocTypeEnum.valueOf(document.getType().toString()));
    docResultDTO.setType(SearchResultDTO.TypeEnum.DOC);
    docResultDTO.associatedType(APIConstants.AuditLogConstants.API_PRODUCT);
    docResultDTO.setSummary(document.getSummary());
    docResultDTO.setVisibility(mapVisibilityFromDocumentToDTO(document.getVisibility()));
    docResultDTO.setSourceType(mapSourceTypeFromDocumentToDTO(document.getSourceType()));
    docResultDTO.setOtherTypeName(document.getOtherTypeName());
    APIProductIdentifier apiId = apiProduct.getId();
    docResultDTO.setApiName(apiId.getName());
    docResultDTO.setApiVersion(apiId.getVersion());
    docResultDTO.setApiProvider(APIUtil.replaceEmailDomainBack(apiId.getProviderName()));
    docResultDTO.setApiUUID(apiProduct.getUuid());
    return docResultDTO;
}
Also used : APIProductIdentifier(org.wso2.carbon.apimgt.api.model.APIProductIdentifier) DocumentSearchResultDTO(org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.DocumentSearchResultDTO)

Aggregations

APIIdentifier (org.wso2.carbon.apimgt.api.model.APIIdentifier)2 DocumentSearchResultDTO (org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.DocumentSearchResultDTO)2 APIProductIdentifier (org.wso2.carbon.apimgt.api.model.APIProductIdentifier)1 DocumentSearchResultDTO (org.wso2.carbon.apimgt.rest.api.store.v1.dto.DocumentSearchResultDTO)1