use of org.wso2.carbon.apimgt.internal.service.dto.GlobalPolicyListDTO in project carbon-apimgt by wso2.
the class SubscriptionValidationDataUtil method fromGlobalPolicyToGlobalPolicyListDTO.
/**
* Converts a list of global policy objects into a global policy list DTO object.
*
* @param globalPolicies list of global policy objects
* @return global policy list DTO
*/
public static GlobalPolicyListDTO fromGlobalPolicyToGlobalPolicyListDTO(List<GlobalPolicy> globalPolicies) {
GlobalPolicyListDTO globalPolicyListDTO = new GlobalPolicyListDTO();
if (globalPolicies != null) {
for (GlobalPolicy globalPolicy : globalPolicies) {
GlobalPolicyDTO globalPolicyDTO = new GlobalPolicyDTO();
globalPolicyDTO.setId(globalPolicy.getId());
globalPolicyDTO.setName(globalPolicy.getName());
globalPolicyDTO.setTenantId(globalPolicy.getTenantId());
globalPolicyDTO.setTenantDomain(globalPolicy.getTenantDomain());
globalPolicyDTO.setSiddhiQuery(globalPolicy.getSiddhiQuery());
globalPolicyDTO.setKeyTemplate(globalPolicy.getKeyTemplate());
globalPolicyListDTO.getList().add(globalPolicyDTO);
}
globalPolicyListDTO.setCount(globalPolicies.size());
} else {
globalPolicyListDTO.setCount(0);
}
return globalPolicyListDTO;
}
Aggregations