use of org.wso2.carbon.apimgt.rest.api.store.v1.dto.APISearchResultDTO in project carbon-apimgt by wso2.
the class SearchResultMappingUtil method fromAPIToAPIResultDTO.
/**
* Get API result representation for content search.
*
* @param api API
* @return APISearchResultDTO
*/
public static APISearchResultDTO fromAPIToAPIResultDTO(API api) {
APISearchResultDTO apiResultDTO = new APISearchResultDTO();
apiResultDTO.setId(api.getUUID());
APIIdentifier apiId = api.getId();
apiResultDTO.setName(apiId.getApiName());
apiResultDTO.setVersion(apiId.getVersion());
apiResultDTO.setProvider(APIUtil.replaceEmailDomainBack(apiId.getProviderName()));
String context = api.getContextTemplate();
if (context.endsWith("/" + RestApiConstants.API_VERSION_PARAM)) {
context = context.replace("/" + RestApiConstants.API_VERSION_PARAM, "");
}
apiResultDTO.setContext(context);
apiResultDTO.setContextTemplate(api.getContextTemplate());
apiResultDTO.setType(SearchResultDTO.TypeEnum.API);
apiResultDTO.setTransportType(api.getType());
apiResultDTO.setDescription(api.getDescription());
apiResultDTO.setStatus(api.getStatus());
apiResultDTO.setThumbnailUri(api.getThumbnailUrl());
apiResultDTO.setAdvertiseOnly(api.isAdvertiseOnly());
return apiResultDTO;
}
use of org.wso2.carbon.apimgt.rest.api.store.v1.dto.APISearchResultDTO in project carbon-apimgt by wso2.
the class SearchResultMappingUtil method fromAPIToAPIResultDTO.
/**
* Get API result representation for content search
* @param apiProduct API product
* @return APISearchResultDTO
*/
public static APISearchResultDTO fromAPIToAPIResultDTO(APIProduct apiProduct) {
APISearchResultDTO apiResultDTO = new APISearchResultDTO();
apiResultDTO.setId(apiProduct.getUuid());
APIProductIdentifier apiId = apiProduct.getId();
apiResultDTO.setName(apiId.getName());
apiResultDTO.setVersion(apiId.getVersion());
apiResultDTO.setProvider(APIUtil.replaceEmailDomainBack(apiId.getProviderName()));
String context = apiProduct.getContextTemplate();
if (context.endsWith("/" + RestApiConstants.API_VERSION_PARAM)) {
context = context.replace("/" + RestApiConstants.API_VERSION_PARAM, "");
}
apiResultDTO.setContext(context);
apiResultDTO.setAvgRating(String.valueOf(apiProduct.getRating()));
APIBusinessInformationDTO apiBusinessInformationDTO = new APIBusinessInformationDTO();
apiBusinessInformationDTO.setBusinessOwner(apiProduct.getBusinessOwner());
apiBusinessInformationDTO.setBusinessOwnerEmail(apiProduct.getBusinessOwnerEmail());
apiBusinessInformationDTO.setTechnicalOwner(apiProduct.getTechnicalOwner());
apiBusinessInformationDTO.setTechnicalOwnerEmail(apiProduct.getTechnicalOwnerEmail());
apiResultDTO.setBusinessInformation(apiBusinessInformationDTO);
apiResultDTO.setType(SearchResultDTO.TypeEnum.API);
apiResultDTO.setTransportType(apiProduct.getType());
apiResultDTO.setDescription(apiProduct.getDescription());
apiResultDTO.setStatus(apiProduct.getState());
apiResultDTO.setThumbnailUri(apiProduct.getThumbnailUrl());
return apiResultDTO;
}
use of org.wso2.carbon.apimgt.rest.api.store.v1.dto.APISearchResultDTO in project carbon-apimgt by wso2.
the class SearchResultMappingUtil method fromAPIToAPIResultDTO.
/**
* Get API result representation for content search
* @param api API
* @return
*/
public static APISearchResultDTO fromAPIToAPIResultDTO(API api) {
APISearchResultDTO apiResultDTO = new APISearchResultDTO();
apiResultDTO.setId(api.getUUID());
APIIdentifier apiId = api.getId();
apiResultDTO.setName(apiId.getApiName());
apiResultDTO.setVersion(apiId.getVersion());
apiResultDTO.setProvider(APIUtil.replaceEmailDomainBack(apiId.getProviderName()));
String context = api.getContextTemplate();
if (context.endsWith("/" + RestApiConstants.API_VERSION_PARAM)) {
context = context.replace("/" + RestApiConstants.API_VERSION_PARAM, "");
}
apiResultDTO.setContext(context);
apiResultDTO.setAvgRating(String.valueOf(api.getRating()));
APIBusinessInformationDTO apiBusinessInformationDTO = new APIBusinessInformationDTO();
apiBusinessInformationDTO.setBusinessOwner(api.getBusinessOwner());
apiBusinessInformationDTO.setBusinessOwnerEmail(api.getBusinessOwnerEmail());
apiBusinessInformationDTO.setTechnicalOwner(api.getTechnicalOwner());
apiBusinessInformationDTO.setTechnicalOwnerEmail(api.getTechnicalOwnerEmail());
apiResultDTO.setBusinessInformation(apiBusinessInformationDTO);
apiResultDTO.setType(SearchResultDTO.TypeEnum.API);
apiResultDTO.setTransportType(api.getType());
apiResultDTO.setDescription(api.getDescription());
apiResultDTO.setStatus(api.getStatus());
apiResultDTO.setThumbnailUri(api.getThumbnailUrl());
return apiResultDTO;
}
Aggregations