use of org.wso2.carbon.apimgt.rest.api.admin.v1.dto.CustomRuleDTO in project carbon-apimgt by wso2.
the class GlobalThrottlePolicyMappingUtil method fromGlobalPolicyArrayToListDTO.
/**
* Converts an array of Global policy model objects into REST API DTO objects
*
* @param GlobalPolicies An array of Global Policy model objects
* @return A List DTO of Global Policy DTOs derived from the array of model objects
* @throws UnsupportedThrottleLimitTypeException
*/
public static CustomRuleListDTO fromGlobalPolicyArrayToListDTO(GlobalPolicy[] GlobalPolicies) throws UnsupportedThrottleLimitTypeException {
CustomRuleListDTO listDTO = new CustomRuleListDTO();
List<CustomRuleDTO> globalPolicyDTOList = new ArrayList<>();
if (GlobalPolicies != null) {
for (GlobalPolicy policy : GlobalPolicies) {
CustomRuleDTO dto = fromGlobalThrottlePolicyToDTO(policy);
globalPolicyDTOList.add(dto);
}
}
listDTO.setCount(globalPolicyDTOList.size());
listDTO.setList(globalPolicyDTOList);
return listDTO;
}
Aggregations