use of org.wso2.carbon.apimgt.core.models.APISummary in project carbon-apimgt by wso2.
the class ApiDAOImpl method constructAPISummaryList.
private List<API> constructAPISummaryList(Connection connection, PreparedStatement statement) throws SQLException {
List<API> apiList = new ArrayList<>();
try (ResultSet rs = statement.executeQuery()) {
while (rs.next()) {
String apiPrimaryKey = rs.getString("UUID");
API apiSummary = new API.APIBuilder(rs.getString("PROVIDER"), rs.getString("NAME"), rs.getString("VERSION")).id(apiPrimaryKey).context(rs.getString("CONTEXT")).description(rs.getString("DESCRIPTION")).lifeCycleStatus(rs.getString("CURRENT_LC_STATUS")).lifecycleInstanceId(rs.getString("LIFECYCLE_INSTANCE_ID")).workflowStatus(rs.getString("LC_WORKFLOW_STATUS")).securityScheme(rs.getInt("SECURITY_SCHEME")).threatProtectionPolicies(getThreatProtectionPolicies(connection, apiPrimaryKey)).build();
apiList.add(apiSummary);
}
}
return apiList;
}
use of org.wso2.carbon.apimgt.core.models.APISummary in project carbon-apimgt by wso2.
the class APIGatewayPublisherImpl method addCompositeAPI.
/**
* @see APIGateway#addCompositeAPI(CompositeAPI api)
*/
@Override
public void addCompositeAPI(CompositeAPI api) throws GatewayException {
// build the message to send
APIEvent gatewayDTO = new APIEvent(APIMgtConstants.GatewayEventTypes.API_CREATE);
gatewayDTO.setLabels(api.getLabels());
APISummary apiSummary = new APISummary();
apiSummary.setName(api.getName());
apiSummary.setVersion(api.getVersion());
apiSummary.setContext(api.getContext());
apiSummary.setThreatProtectionPolicies(api.getThreatProtectionPolicies());
gatewayDTO.setApiSummary(apiSummary);
publishToPublisherTopic(gatewayDTO);
}
use of org.wso2.carbon.apimgt.core.models.APISummary in project carbon-apimgt by wso2.
the class APIGatewayPublisherImpl method toAPISummary.
/**
* Convert API definition into APISummary
*
* @param api API definition
* @return The summary of the API
*/
private APISummary toAPISummary(API api) {
APISummary apiSummary = new APISummary();
apiSummary.setId(api.getId());
apiSummary.setName(api.getName());
apiSummary.setVersion(api.getVersion());
apiSummary.setContext(api.getContext());
apiSummary.setLifeCycleStatus(api.getLifeCycleStatus());
apiSummary.setLifeCycleStatus(api.getLifeCycleStatus());
apiSummary.setCreatedTime(api.getCreatedTime());
apiSummary.setLastUpdatedTime(api.getLastUpdatedTime());
apiSummary.setSecurityScheme(api.getSecurityScheme());
apiSummary.setThreatProtectionPolicies(api.getThreatProtectionPolicies());
return apiSummary;
}
use of org.wso2.carbon.apimgt.core.models.APISummary in project carbon-apimgt by wso2.
the class APIGatewayPublisherImpl method deleteCompositeAPI.
@Override
public void deleteCompositeAPI(CompositeAPI api) throws GatewayException {
// build the message to send
APIEvent gatewayDTO = new APIEvent(APIMgtConstants.GatewayEventTypes.API_DELETE);
gatewayDTO.setLabels(api.getLabels());
APISummary apiSummary = new APISummary();
apiSummary.setName(api.getName());
apiSummary.setVersion(api.getVersion());
apiSummary.setContext(api.getContext());
apiSummary.setThreatProtectionPolicies(api.getThreatProtectionPolicies());
gatewayDTO.setApiSummary(apiSummary);
publishToPublisherTopic(gatewayDTO);
}
use of org.wso2.carbon.apimgt.core.models.APISummary in project carbon-apimgt by wso2.
the class MappingUtil method toAPIInfo.
/**
* Converts {@link API} List to an {@link APIInfoDTO} List.
*
* @param apiSummaryList
* @return
*/
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());
apiInfo.setWorkflowStatus(apiSummary.getWorkflowStatus());
apiInfo.setSecurityScheme(mapSecuritySchemeIntToList(apiSummary.getSecurityScheme()));
apiInfoList.add(apiInfo);
}
return apiInfoList;
}
Aggregations