use of org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.OperationPolicySpecAttributeDTO in project carbon-apimgt by wso2.
the class OperationPolicyMappingUtil method fromOperationPolicySpecAttributesToDTO.
public static OperationPolicySpecAttributeDTO fromOperationPolicySpecAttributesToDTO(OperationPolicySpecAttribute specAttribute) {
OperationPolicySpecAttributeDTO specAttributeDTO = new OperationPolicySpecAttributeDTO();
specAttributeDTO.setName(specAttribute.getName());
specAttributeDTO.setDisplayName(specAttribute.getDisplayName());
specAttributeDTO.setDescription(specAttribute.getDescription());
specAttributeDTO.setType(specAttribute.getType().toString());
specAttributeDTO.setValidationRegex(specAttribute.getValidationRegex());
specAttributeDTO.setRequired(specAttribute.isRequired());
specAttributeDTO.setDefaultValue(specAttribute.getDefaultValue());
if (specAttribute.getType().equals(OperationPolicySpecAttribute.AttributeType.Enum)) {
specAttributeDTO.setAllowedValues(specAttribute.getAllowedValues());
}
return specAttributeDTO;
}
use of org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.OperationPolicySpecAttributeDTO in project carbon-apimgt by wso2.
the class OperationPolicyMappingUtil method fromOperationPolicyDataToDTO.
public static OperationPolicyDataDTO fromOperationPolicyDataToDTO(OperationPolicyData policyData) {
OperationPolicyDataDTO policyDataDTO = new OperationPolicyDataDTO();
OperationPolicySpecification policySpecification = policyData.getSpecification();
policyDataDTO.setId(policyData.getPolicyId());
policyDataDTO.setMd5(policyData.getMd5Hash());
policyDataDTO.setIsAPISpecific(policyData.isApiSpecificPolicy());
policyDataDTO.setName(policySpecification.getName());
policyDataDTO.setDisplayName(policySpecification.getDisplayName());
policyDataDTO.setDescription(policySpecification.getDescription());
policyDataDTO.setSupportedGateways(policySpecification.getSupportedGateways());
policyDataDTO.setSupportedApiTypes(policySpecification.getSupportedApiTypes());
policyDataDTO.setApplicableFlows(policySpecification.getApplicableFlows());
policyDataDTO.setMultipleAllowed(policySpecification.isMultipleAllowed());
policyDataDTO.setCategory(policySpecification.getCategory().toString());
if (policySpecification.getPolicyAttributes() != null) {
List<OperationPolicySpecAttributeDTO> specAttributeDtoList = new ArrayList<>();
for (OperationPolicySpecAttribute specAttribute : policySpecification.getPolicyAttributes()) {
OperationPolicySpecAttributeDTO specAttributeDTO = fromOperationPolicySpecAttributesToDTO(specAttribute);
specAttributeDtoList.add(specAttributeDTO);
}
policyDataDTO.setPolicyAttributes(specAttributeDtoList);
}
return policyDataDTO;
}
Aggregations