use of org.wso2.carbon.apimgt.rest.api.admin.v1.dto.ThrottleConditionDTO in project carbon-apimgt by wso2.
the class CommonThrottleMappingUtil method fromDTOToIPCondition.
/**
* Converts a IP Condition DTO object into a model object
*
* @param dto IP Condition DTO object
* @return IP Condition model object derived from DTO
*/
public static IPCondition fromDTOToIPCondition(ThrottleConditionDTO dto) throws UnsupportedThrottleConditionTypeException {
String ipConditionType = mapIPConditionTypeFromDTOToModel(dto.getIpCondition().getIpConditionType());
IPCondition ipCondition = new IPCondition(ipConditionType);
ipCondition = updateFieldsFromDTOToCondition(dto, ipCondition);
ipCondition.setSpecificIP(dto.getIpCondition().getSpecificIP());
ipCondition.setStartingIP(dto.getIpCondition().getStartingIP());
ipCondition.setEndingIP(dto.getIpCondition().getEndingIP());
return ipCondition;
}
use of org.wso2.carbon.apimgt.rest.api.admin.v1.dto.ThrottleConditionDTO in project carbon-apimgt by wso2.
the class CommonThrottleMappingUtil method fromQueryParameterConditionToDTO.
/**
* Converts a Query Parameter Condition model object into a DTO
*
* @param condition Query Parameter Condition model object
* @return DTO object that was derived from Query Parameter Condition model object
*/
public static ThrottleConditionDTO fromQueryParameterConditionToDTO(QueryParameterCondition condition) {
ThrottleConditionDTO throttleConditionDTO = new ThrottleConditionDTO();
throttleConditionDTO.setType(PolicyConstants.QUERY_PARAMS_CONDITION_TYPE);
throttleConditionDTO.setQueryParameterCondition(new QueryParameterConditionDTO());
throttleConditionDTO = updateFieldsFromConditionToDTO(condition, throttleConditionDTO);
throttleConditionDTO.getQueryParameterCondition().setParameterName(condition.getParameter());
throttleConditionDTO.getQueryParameterCondition().setParameterValue(condition.getValue());
return throttleConditionDTO;
}
use of org.wso2.carbon.apimgt.rest.api.admin.v1.dto.ThrottleConditionDTO in project carbon-apimgt by wso2.
the class CommonThrottleMappingUtil method fromDTOToQueryParameterCondition.
/**
* Converts a Query Parameter Condition DTO object into a model object
*
* @param dto Query Parameter Condition DTO object
* @return Query Parameter Condition model object derived from Query Parameter Condition DTO
*/
public static QueryParameterCondition fromDTOToQueryParameterCondition(ThrottleConditionDTO dto) {
QueryParameterCondition queryParameterCondition = new QueryParameterCondition();
queryParameterCondition = updateFieldsFromDTOToCondition(dto, queryParameterCondition);
queryParameterCondition.setParameter(dto.getQueryParameterCondition().getParameterName());
queryParameterCondition.setValue(dto.getQueryParameterCondition().getParameterValue());
return queryParameterCondition;
}
use of org.wso2.carbon.apimgt.rest.api.admin.v1.dto.ThrottleConditionDTO in project carbon-apimgt by wso2.
the class CommonThrottleMappingUtil method fromPipelineToConditionalGroupDTO.
/**
* Converts a single Pipeline object into a Conditional Group DTO object
*
* @param pipeline Pipeline object
* @return Derived DTO object from Pipeline object
* @throws UnsupportedThrottleLimitTypeException - If error occurs
* @throws UnsupportedThrottleConditionTypeException - If error occurs
*/
public static ConditionalGroupDTO fromPipelineToConditionalGroupDTO(Pipeline pipeline) throws UnsupportedThrottleLimitTypeException, UnsupportedThrottleConditionTypeException {
ConditionalGroupDTO groupDTO = new ConditionalGroupDTO();
groupDTO.setDescription(pipeline.getDescription());
groupDTO.setLimit(fromQuotaPolicyToDTO(pipeline.getQuotaPolicy()));
List<ThrottleConditionDTO> conditionDTOList = fromConditionListToDTOList(pipeline.getConditions());
groupDTO.setConditions(conditionDTOList);
return groupDTO;
}
use of org.wso2.carbon.apimgt.rest.api.admin.v1.dto.ThrottleConditionDTO in project carbon-apimgt by wso2.
the class CommonThrottleMappingUtil method fromDTOToHeaderCondition.
/**
* Converts a Header Condition DTO object into a model object
*
* @param dto Header Condition DTO object
* @return Header Condition model object derived from Header Condition DTO
*/
public static HeaderCondition fromDTOToHeaderCondition(ThrottleConditionDTO dto) {
HeaderCondition headerCondition = new HeaderCondition();
headerCondition = updateFieldsFromDTOToCondition(dto, headerCondition);
headerCondition.setHeader(dto.getHeaderCondition().getHeaderName());
headerCondition.setValue(dto.getHeaderCondition().getHeaderValue());
return headerCondition;
}
Aggregations