use of org.wso2.carbon.apimgt.rest.api.admin.v1.dto.BotDetectionAlertSubscriptionListDTO in project carbon-apimgt by wso2.
the class AlertSubscriptionsApiServiceImpl method getBotDetectionAlertSubscriptions.
/**
* Retrieve a list of bot detection alert subscriptions
*
* @param messageContext CXF Message Context
* @return list of bot detection alert subscriptions
* @throws APIManagementException if an error occurs when retrieving bot detection alert subscriptions
*/
@Override
public Response getBotDetectionAlertSubscriptions(MessageContext messageContext) throws APIManagementException {
APIAdmin apiAdmin = new APIAdminImpl();
List<BotDetectionData> botDetectionDataList = apiAdmin.getBotDetectionAlertSubscriptions();
BotDetectionAlertSubscriptionListDTO listDTO = BotDetectionMappingUtil.fromAlertSubscriptionListToListDTO(botDetectionDataList);
return Response.ok().entity(listDTO).build();
}
use of org.wso2.carbon.apimgt.rest.api.admin.v1.dto.BotDetectionAlertSubscriptionListDTO in project carbon-apimgt by wso2.
the class BotDetectionMappingUtil method fromAlertSubscriptionListToListDTO.
/**
* Converts a list of Bot Detection Alert Subscription model objects into a list DTO
*
* @param alertSubscriptionList list of Bot Detection Alert Subscriptions
* @return A List DTO of converted Bot Detection Alert Subscriptions
*/
public static BotDetectionAlertSubscriptionListDTO fromAlertSubscriptionListToListDTO(List<BotDetectionData> alertSubscriptionList) {
BotDetectionAlertSubscriptionListDTO listDTO = new BotDetectionAlertSubscriptionListDTO();
List<BotDetectionAlertSubscriptionDTO> alertSubscriptionDTOs = new ArrayList<>();
for (BotDetectionData alertSubscription : alertSubscriptionList) {
alertSubscriptionDTOs.add(fromAlertSubscriptionToDTO(alertSubscription));
}
listDTO.setList(alertSubscriptionDTOs);
listDTO.setCount(alertSubscriptionDTOs.size());
return listDTO;
}
Aggregations