use of org.wso2.carbon.apimgt.core.models.policy.Condition in project carbon-apimgt by wso2.
the class BlockingConditionMappingUtil method fromBlockConditionToIpConditionDTO.
/**
* Block condition IP range details to IPConditionDTO.
*
* @param blockConditions blockCondition to be converted into IPConditionDTO.
* @return IPConditionDTO Object
*/
private static IPConditionDTO fromBlockConditionToIpConditionDTO(BlockConditions blockConditions) {
IPConditionDTO ipConditionDTO = new IPConditionDTO();
ipConditionDTO.setStartingIP(blockConditions.getStartingIP());
ipConditionDTO.setEndingIP(blockConditions.getEndingIP());
return ipConditionDTO;
}
use of org.wso2.carbon.apimgt.core.models.policy.Condition in project carbon-apimgt by wso2.
the class CommonThrottleMappingUtil method fromJWTClaimsConditionToDTO.
/**
* Converts a JWT Claims Condition model object into a DTO
*
* @param condition JWT Claims Condition model object
* @return DTO object that was derived from JWT Claims Condition model object
*/
public static ThrottleConditionDTO fromJWTClaimsConditionToDTO(JWTClaimsCondition condition) {
ThrottleConditionDTO throttleConditionDTO = new ThrottleConditionDTO();
throttleConditionDTO.setType(PolicyConstants.JWT_CLAIMS_CONDITION_TYPE);
throttleConditionDTO.setJwtClaimsCondition(new JWTClaimsConditionDTO());
throttleConditionDTO = updateFieldsFromConditionToDTO(condition, throttleConditionDTO);
throttleConditionDTO.getJwtClaimsCondition().setClaimUrl(condition.getClaimUrl());
throttleConditionDTO.getJwtClaimsCondition().setAttribute(condition.getAttribute());
return throttleConditionDTO;
}
use of org.wso2.carbon.apimgt.core.models.policy.Condition in project carbon-apimgt by wso2.
the class CommonThrottleMappingUtil method fromDTOToJWTClaimsCondition.
/**
* Converts a JWT Claims Condition DTO object into a model object
*
* @param dto JWT Claims Condition DTO object
* @return JWT Claims Condition model object derived from JWT Claims Condition DTO
*/
public static JWTClaimsCondition fromDTOToJWTClaimsCondition(ThrottleConditionDTO dto) {
JWTClaimsCondition jwtClaimsCondition = new JWTClaimsCondition();
jwtClaimsCondition = updateFieldsFromDTOToCondition(dto, jwtClaimsCondition);
jwtClaimsCondition.setAttribute(dto.getJwtClaimsCondition().getAttribute());
jwtClaimsCondition.setClaimUrl(dto.getJwtClaimsCondition().getClaimUrl());
return jwtClaimsCondition;
}
use of org.wso2.carbon.apimgt.core.models.policy.Condition in project carbon-apimgt by wso2.
the class CommonThrottleMappingUtil method fromIPConditionToDTO.
/**
* Converts an IP Condition model object into a DTO
*
* @param ipCondition IP Condition model object
* @return DTO object derived from model object
*/
public static ThrottleConditionDTO fromIPConditionToDTO(IPCondition ipCondition) throws UnsupportedThrottleConditionTypeException {
String ipConditionType = mapIPConditionTypeFromModelToDTO(ipCondition.getType());
ThrottleConditionDTO throttleConditionDTO = new ThrottleConditionDTO();
throttleConditionDTO.setType(PolicyConstants.IP_CONDITION_TYPE);
throttleConditionDTO.setIpCondition(new IPConditionDTO());
throttleConditionDTO = updateFieldsFromConditionToDTO(ipCondition, throttleConditionDTO);
throttleConditionDTO.getIpCondition().setIpConditionType(ipConditionType);
throttleConditionDTO.getIpCondition().setSpecificIP(ipCondition.getSpecificIP());
throttleConditionDTO.getIpCondition().setStartingIP(ipCondition.getStartingIP());
throttleConditionDTO.getIpCondition().setEndingIP(ipCondition.getEndingIP());
return throttleConditionDTO;
}
use of org.wso2.carbon.apimgt.core.models.policy.Condition in project carbon-apimgt by wso2.
the class CommonThrottleMappingUtil method fromConditionalGroupDTOToPipeline.
/**
* Converts a single Conditional Group DTO into a Pipeline object
*
* @param dto Conditional Group DTO
* @return Derived Pipeline object from Conditional Group DTO
* @throws UnsupportedThrottleLimitTypeException - If error occurs
* @throws UnsupportedThrottleConditionTypeException - If error occurs
*/
public static Pipeline fromConditionalGroupDTOToPipeline(ConditionalGroupDTO dto) throws UnsupportedThrottleLimitTypeException, UnsupportedThrottleConditionTypeException {
Pipeline pipeline = new Pipeline();
pipeline.setDescription(dto.getDescription());
pipeline.setEnabled(true);
pipeline.setQuotaPolicy(fromDTOToQuotaPolicy(dto.getLimit()));
List<Condition> conditions = fromDTOListToConditionList(dto.getConditions());
pipeline.setConditions(conditions);
return pipeline;
}
Aggregations