use of org.wso2.carbon.apimgt.core.models.APISummary in project carbon-apimgt by wso2.
the class CompositeAPIMappingUtil method toCompositeAPIInfo.
/**
* Converts {@link CompositeAPI} List to an {@link CompositeAPIInfoDTO} List.
*
* @param apiSummaryList
* @return
*/
private static List<CompositeAPIInfoDTO> toCompositeAPIInfo(List<CompositeAPI> apiSummaryList) {
List<CompositeAPIInfoDTO> apiInfoList = new ArrayList<>();
for (CompositeAPI apiSummary : apiSummaryList) {
CompositeAPIInfoDTO apiInfo = new CompositeAPIInfoDTO();
apiInfo.setId(apiSummary.getId());
apiInfo.setContext(apiSummary.getContext());
apiInfo.setDescription(apiSummary.getDescription());
apiInfo.setName(apiSummary.getName());
apiInfo.setProvider(apiSummary.getProvider());
apiInfo.setVersion(apiSummary.getVersion());
apiInfo.setApplicationId(apiSummary.getApplicationId());
apiInfoList.add(apiInfo);
}
return apiInfoList;
}
use of org.wso2.carbon.apimgt.core.models.APISummary in project carbon-apimgt by wso2.
the class APIPublisherImplTestCase method testGetLifeCycleEventsExceptionFindingApiSummaryResource.
@Test(description = "Exception finding APISummary Resource when getting lifecycle events list of an API", expectedExceptions = APIManagementException.class)
public void testGetLifeCycleEventsExceptionFindingApiSummaryResource() throws APIManagementException, LifecycleException {
ApiDAO apiDAO = Mockito.mock(ApiDAO.class);
Mockito.when(apiDAO.getAPISummary(API_ID)).thenThrow(new APIMgtDAOException("Couldn't find APISummary Resource for ID " + API_ID));
APIPublisherImpl apiPublisher = getApiPublisherImpl(apiDAO);
apiPublisher.getLifeCycleEvents(API_ID);
}
use of org.wso2.carbon.apimgt.core.models.APISummary in project carbon-apimgt by wso2.
the class APIMappingUtil method toAPIInfo.
/**
* Converts {@link API} List to an {@link APIInfoDTO} List.
*
* @param apiSummaryList List of APIs
* @return List of APIInfoDTO
*/
private static List<APIInfoDTO> toAPIInfo(List<API> apiSummaryList) {
List<APIInfoDTO> apiInfoList = new ArrayList<APIInfoDTO>();
for (API apiSummary : apiSummaryList) {
APIInfoDTO apiInfo = new APIInfoDTO();
apiInfo.setId(apiSummary.getId());
apiInfo.setContext(apiSummary.getContext());
apiInfo.setDescription(apiSummary.getDescription());
apiInfo.setName(apiSummary.getName());
apiInfo.setProvider(apiSummary.getProvider());
apiInfo.setLifeCycleStatus(apiSummary.getLifeCycleStatus());
apiInfo.setVersion(apiSummary.getVersion());
apiInfoList.add(apiInfo);
}
return apiInfoList;
}
use of org.wso2.carbon.apimgt.core.models.APISummary in project carbon-apimgt by wso2.
the class ApiDAOImpl method getCompositeAPISummaryList.
private List<CompositeAPI> getCompositeAPISummaryList(Connection connection, PreparedStatement statement) throws SQLException, APIMgtDAOException {
List<CompositeAPI> apiList = new ArrayList<>();
try (ResultSet rs = statement.executeQuery()) {
while (rs.next()) {
String apiPrimaryKey = rs.getString("UUID");
CompositeAPI apiSummary = new CompositeAPI.Builder().id(apiPrimaryKey).provider(rs.getString("PROVIDER")).name(rs.getString("NAME")).version(rs.getString("VERSION")).context(rs.getString("CONTEXT")).description(rs.getString("DESCRIPTION")).applicationId(getCompositeAPIApplicationId(connection, apiPrimaryKey)).workflowStatus(rs.getString("LC_WORKFLOW_STATUS")).threatProtectionPolicies(getThreatProtectionPolicies(connection, apiPrimaryKey)).build();
apiList.add(apiSummary);
}
}
return apiList;
}
Aggregations