private URITemplate toTemplates(org.wso2.carbon.apimgt.api.model.xsd.URITemplate dto) { URITemplate template = new URITemplate(); template.setAuthType(dto.getAuthType()); template.setHTTPVerb(dto.getHTTPVerb()); template.setResourceSandboxURI(dto.getResourceSandboxURI()); template.setUriTemplate(dto.getUriTemplate()); return template; }
private URITemplate toTemplates(org.wso2.carbon.apimgt.api.model.xsd.URITemplate dto) { URITemplate template = new URITemplate(); template.setAuthType(dto.getAuthType()); template.setHTTPVerb(dto.getHTTPVerb()); template.setResourceSandboxURI(dto.getResourceSandboxURI()); template.setUriTemplate(dto.getUriTemplate()); template.setThrottlingTier(dto.getThrottlingTier()); ConditionGroupDTO[] xsdConditionGroups = dto.getConditionGroups(); org.wso2.carbon.apimgt.api.dto.ConditionGroupDTO[] conditionGroups = new org.wso2.carbon.apimgt.api.dto.ConditionGroupDTO[xsdConditionGroups.length]; for (short groupCounter = 0; groupCounter < xsdConditionGroups.length; groupCounter++) { org.wso2.carbon.apimgt.api.dto.ConditionGroupDTO conditionGroup = new org.wso2.carbon.apimgt.api.dto.ConditionGroupDTO(); ConditionGroupDTO xsdConditionGroup = xsdConditionGroups[groupCounter]; // Have to check nullity explicitly here because, in certain cases, length becomes 1 even when // there are // no elements in the array. if (xsdConditionGroup != null) { conditionGroup.setConditionGroupId(xsdConditionGroup.getConditionGroupId()); ConditionDTO[] xsdConditions = xsdConditionGroup.getConditions(); if (xsdConditions != null) { org.wso2.carbon.apimgt.api.dto.ConditionDTO[] conditions = new org.wso2.carbon.apimgt.api.dto.ConditionDTO[xsdConditions.length]; for (short conditionCounter = 0; conditionCounter < xsdConditions.length; conditionCounter++) { ConditionDTO xsdCondition = xsdConditions[conditionCounter]; if (xsdCondition != null) { org.wso2.carbon.apimgt.api.dto.ConditionDTO condition = new org.wso2.carbon.apimgt.api.dto.ConditionDTO(); condition.setConditionName(xsdCondition.getConditionName()); condition.setConditionType(xsdCondition.getConditionType()); condition.setConditionValue(xsdCondition.getConditionValue()); conditions[conditionCounter] = condition; } } conditionGroup.setConditions(conditions); } conditionGroups[groupCounter] = conditionGroup; } } template.setConditionGroups(conditionGroups); template.setThrottlingConditions((Arrays.asList(dto.getThrottlingConditions()))); return template; }