use of org.wso2.carbon.apimgt.core.models.CompositeAPI in project carbon-apimgt by wso2.
the class ApiDAOImpl method getCompositeAPIs.
@Override
@SuppressFBWarnings("SQL_PREPARED_STATEMENT_GENERATED_FROM_NONCONSTANT_STRING")
public List<CompositeAPI> getCompositeAPIs(Set<String> roles, String user, int offset, int limit) throws APIMgtDAOException {
// TODO: 6/5/17 Implement pagination support when implementing pagination support for
// other list operations.
final String query = COMPOSITE_API_SUMMARY_SELECT + " WHERE API_TYPE_ID = " + "(SELECT TYPE_ID FROM AM_API_TYPES WHERE TYPE_NAME = ?) AND PROVIDER = ?";
try (Connection connection = DAOUtil.getConnection();
PreparedStatement statement = connection.prepareStatement(query)) {
statement.setString(1, ApiType.COMPOSITE.toString());
statement.setString(2, user);
return getCompositeAPISummaryList(connection, statement);
} catch (SQLException e) {
throw new APIMgtDAOException(DAOUtil.DAO_ERROR_PREFIX + "getting Composite APIs", e);
}
}
use of org.wso2.carbon.apimgt.core.models.CompositeAPI 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.CompositeAPI 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.CompositeAPI in project carbon-apimgt by wso2.
the class CompositeAPIMappingUtil method toCompositeAPIListDTO.
/**
* Converts API list to CompositeAPIListDTO list.
*
* @param apisResult List of APIs
* @return CompositeAPIListDTO object
*/
public static CompositeAPIListDTO toCompositeAPIListDTO(List<CompositeAPI> apisResult) {
CompositeAPIListDTO apiListDTO = new CompositeAPIListDTO();
apiListDTO.setCount(apisResult.size());
// apiListDTO.setNext(next);
// apiListDTO.setPrevious(previous);
apiListDTO.setList(toCompositeAPIInfo(apisResult));
return apiListDTO;
}
use of org.wso2.carbon.apimgt.core.models.CompositeAPI 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;
}
Aggregations