use of org.wso2.carbon.apimgt.rest.api.admin.v1.dto.ApplicationThrottlePolicyDTO in project carbon-apimgt by wso2.
the class ApplicationThrottlePolicyMappingUtil method fromApplicationThrottlePolicyDTOToModel.
/**
* Converts a single Application Policy DTO into a model object
*
* @param dto Application Policy DTO Object
* @return Converted Application Policy Model object
* @throws UnsupportedThrottleLimitTypeException
*/
public static ApplicationPolicy fromApplicationThrottlePolicyDTOToModel(ApplicationThrottlePolicyDTO dto) throws UnsupportedThrottleLimitTypeException {
// update mandatory fields such as tenantDomain etc.
dto = CommonThrottleMappingUtil.updateDefaultMandatoryFieldsOfThrottleDTO(dto);
ApplicationPolicy appPolicy = new ApplicationPolicy(dto.getPolicyName());
appPolicy = CommonThrottleMappingUtil.updateFieldsFromDTOToPolicy(dto, appPolicy);
if (dto.getDefaultLimit() != null) {
appPolicy.setDefaultQuotaPolicy(CommonThrottleMappingUtil.fromDTOToQuotaPolicy(dto.getDefaultLimit()));
}
return appPolicy;
}
Aggregations