use of org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.APIProductSearchResultDTO in project carbon-apimgt by wso2.
the class SearchResultMappingUtil method fromAPIProductToAPIResultDTO.
/**
* Get API result representation for content search.
*
* @param apiProduct APIProduct
* @return APIProductSearchResultDTO
*/
public static APIProductSearchResultDTO fromAPIProductToAPIResultDTO(APIProduct apiProduct) {
APIProductSearchResultDTO apiProductResultDTO = new APIProductSearchResultDTO();
apiProductResultDTO.setId(apiProduct.getUuid());
APIProductIdentifier apiproductId = apiProduct.getId();
apiProductResultDTO.setName(apiproductId.getName());
apiProductResultDTO.setVersion(apiproductId.getVersion());
apiProductResultDTO.setProvider(APIUtil.replaceEmailDomainBack(apiproductId.getProviderName()));
String context = apiProduct.getContextTemplate();
if (context.endsWith("/" + RestApiConstants.API_VERSION_PARAM)) {
context = context.replace("/" + RestApiConstants.API_VERSION_PARAM, "");
}
apiProductResultDTO.setContext(context);
apiProductResultDTO.setType(SearchResultDTO.TypeEnum.APIPRODUCT);
apiProductResultDTO.setDescription(apiProduct.getDescription());
apiProductResultDTO.setStatus(apiProduct.getState());
apiProductResultDTO.setThumbnailUri(apiProduct.getThumbnailUrl());
return apiProductResultDTO;
}
Aggregations