Search in sources :

Example 16 with Pipeline

use of org.wso2.carbon.apimgt.core.models.policy.Pipeline 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;
}
Also used : JWTClaimsCondition(org.wso2.carbon.apimgt.core.models.policy.JWTClaimsCondition) Condition(org.wso2.carbon.apimgt.core.models.policy.Condition) QueryParameterCondition(org.wso2.carbon.apimgt.core.models.policy.QueryParameterCondition) IPCondition(org.wso2.carbon.apimgt.core.models.policy.IPCondition) HeaderCondition(org.wso2.carbon.apimgt.core.models.policy.HeaderCondition) Pipeline(org.wso2.carbon.apimgt.core.models.policy.Pipeline)

Aggregations

Pipeline (org.wso2.carbon.apimgt.core.models.policy.Pipeline)9 Condition (org.wso2.carbon.apimgt.core.models.policy.Condition)7 IPCondition (org.wso2.carbon.apimgt.core.models.policy.IPCondition)7 PreparedStatement (java.sql.PreparedStatement)6 ResultSet (java.sql.ResultSet)6 HeaderCondition (org.wso2.carbon.apimgt.core.models.policy.HeaderCondition)6 JWTClaimsCondition (org.wso2.carbon.apimgt.core.models.policy.JWTClaimsCondition)6 QueryParameterCondition (org.wso2.carbon.apimgt.core.models.policy.QueryParameterCondition)6 RequestCountLimit (org.wso2.carbon.apimgt.core.models.policy.RequestCountLimit)5 BandwidthLimit (org.wso2.carbon.apimgt.core.models.policy.BandwidthLimit)4 QuotaPolicy (org.wso2.carbon.apimgt.core.models.policy.QuotaPolicy)4 ArrayList (java.util.ArrayList)3 StringWriter (java.io.StringWriter)2 Template (org.apache.velocity.Template)2 VelocityContext (org.apache.velocity.VelocityContext)2 VelocityEngine (org.apache.velocity.app.VelocityEngine)2 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 APIPolicy (org.wso2.carbon.apimgt.core.models.policy.APIPolicy)1 Limit (org.wso2.carbon.apimgt.core.models.policy.Limit)1