use of org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.OperationPolicyDTO in project carbon-apimgt by wso2.
the class OperationPolicyMappingUtil method fromDTOToOperationPolicy.
public static OperationPolicy fromDTOToOperationPolicy(OperationPolicyDTO operationPolicyDTO) {
OperationPolicy operationPolicy = new OperationPolicy();
operationPolicy.setPolicyName(operationPolicyDTO.getPolicyName());
operationPolicy.setPolicyId(operationPolicyDTO.getPolicyId());
operationPolicy.setParameters(operationPolicyDTO.getParameters());
return operationPolicy;
}
use of org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.OperationPolicyDTO in project carbon-apimgt by wso2.
the class OperationPolicyMappingUtil method fromOperationPolicyToDTO.
public static OperationPolicyDTO fromOperationPolicyToDTO(OperationPolicy operationPolicy) {
OperationPolicyDTO dto = new OperationPolicyDTO();
dto.setPolicyName(operationPolicy.getPolicyName());
dto.setPolicyId(operationPolicy.getPolicyId());
dto.setOrder(operationPolicy.getOrder());
dto.setParameters(operationPolicy.getParameters());
return dto;
}
use of org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.OperationPolicyDTO in project carbon-apimgt by wso2.
the class OperationPolicyMappingUtil method fromOperationPolicyListToDTO.
public static APIOperationPoliciesDTO fromOperationPolicyListToDTO(List<OperationPolicy> operationPolicyList) {
APIOperationPoliciesDTO dto = new APIOperationPoliciesDTO();
List<OperationPolicyDTO> request = new ArrayList<>();
List<OperationPolicyDTO> response = new ArrayList<>();
List<OperationPolicyDTO> fault = new ArrayList<>();
for (OperationPolicy op : operationPolicyList) {
OperationPolicyDTO policyDTO = fromOperationPolicyToDTO(op);
if (APIConstants.OPERATION_SEQUENCE_TYPE_REQUEST.equals(op.getDirection())) {
request.add(policyDTO);
} else if (APIConstants.OPERATION_SEQUENCE_TYPE_RESPONSE.equals(op.getDirection())) {
response.add(policyDTO);
} else if (APIConstants.OPERATION_SEQUENCE_TYPE_FAULT.equals(op.getDirection())) {
fault.add(policyDTO);
}
}
dto.setRequest(request);
dto.setResponse(response);
dto.setFault(fault);
return dto;
}
use of org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.OperationPolicyDTO in project carbon-apimgt by wso2.
the class OperationPolicyMappingUtil method fromDTOToAPIOperationPoliciesList.
public static List<OperationPolicy> fromDTOToAPIOperationPoliciesList(APIOperationPoliciesDTO apiOperationPoliciesDTO) {
List<OperationPolicy> operationPoliciesList = new ArrayList<>();
if (apiOperationPoliciesDTO != null) {
List<OperationPolicyDTO> request = apiOperationPoliciesDTO.getRequest();
List<OperationPolicyDTO> response = apiOperationPoliciesDTO.getResponse();
List<OperationPolicyDTO> fault = apiOperationPoliciesDTO.getFault();
int requestCount = 1;
int responseCount = 1;
int faultCount = 1;
for (OperationPolicyDTO op : request) {
OperationPolicy operationPolicy = fromDTOToOperationPolicy(op);
operationPolicy.setDirection(APIConstants.OPERATION_SEQUENCE_TYPE_REQUEST);
operationPolicy.setOrder(requestCount);
operationPoliciesList.add(operationPolicy);
requestCount += 1;
}
for (OperationPolicyDTO op : response) {
OperationPolicy operationPolicy = fromDTOToOperationPolicy(op);
operationPolicy.setDirection(APIConstants.OPERATION_SEQUENCE_TYPE_RESPONSE);
operationPolicy.setOrder(responseCount);
operationPoliciesList.add(operationPolicy);
responseCount += 1;
}
for (OperationPolicyDTO op : fault) {
OperationPolicy operationPolicy = fromDTOToOperationPolicy(op);
operationPolicy.setDirection(APIConstants.OPERATION_SEQUENCE_TYPE_FAULT);
operationPolicy.setOrder(faultCount);
operationPoliciesList.add(operationPolicy);
faultCount += 1;
}
}
return operationPoliciesList;
}
use of org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.OperationPolicyDTO in project carbon-apimgt by wso2.
the class OperationPolicyMappingUtil method fromDTOListToOperationPolicyList.
public static List<OperationPolicy> fromDTOListToOperationPolicyList(List<OperationPolicyDTO> operationPolicyDTOList) {
List<OperationPolicy> operationPolicyList = new ArrayList<>();
for (OperationPolicyDTO operationPolicyDto : operationPolicyDTOList) {
OperationPolicy operationPolicy = fromDTOToOperationPolicy(operationPolicyDto);
operationPolicyList.add(operationPolicy);
}
return operationPolicyList;
}
Aggregations