use of org.wso2.carbon.bpel.ui.bpel2svg.Link in project carbon-apimgt by wso2.
the class WSDL11SOAPOperationExtractor method getSOAPOperation.
/**
* Retrieves WSDL operation given the soap binding operation
*
* @param bindingOperation {@link BindingOperation} object
* @return a set of {@link WSDLOperation} defined in the provided Binding
*/
private WSDLSOAPOperation getSOAPOperation(BindingOperation bindingOperation) throws APIMgtWSDLException {
WSDLSOAPOperation wsdlOperation = null;
for (Object boExtElement : bindingOperation.getExtensibilityElements()) {
if (boExtElement instanceof SOAPOperation) {
SOAPOperation soapOperation = (SOAPOperation) boExtElement;
wsdlOperation = new WSDLSOAPOperation();
wsdlOperation.setName(bindingOperation.getName());
wsdlOperation.setSoapAction(soapOperation.getSoapActionURI());
wsdlOperation.setTargetNamespace(getTargetNamespace(bindingOperation));
wsdlOperation.setStyle(soapOperation.getStyle());
wsdlOperation.setInputParameterModel(getSoapInputParameterModel(bindingOperation));
wsdlOperation.setOutputParameterModel(getSoapOutputParameterModel(bindingOperation));
wsdlOperation.setMessageType(getSoapMessageType(bindingOperation));
} else if (boExtElement instanceof SOAP12Operation) {
SOAP12Operation soapOperation = (SOAP12Operation) boExtElement;
wsdlOperation = new WSDLSOAPOperation();
wsdlOperation.setName(bindingOperation.getName());
wsdlOperation.setSoapAction(soapOperation.getSoapActionURI());
wsdlOperation.setTargetNamespace(getTargetNamespace(bindingOperation));
wsdlOperation.setStyle(soapOperation.getStyle());
wsdlOperation.setInputParameterModel(getSoapInputParameterModel(bindingOperation));
wsdlOperation.setOutputParameterModel(getSoapOutputParameterModel(bindingOperation));
wsdlOperation.setMessageType(getSoapMessageType(bindingOperation));
}
}
return wsdlOperation;
}
use of org.wso2.carbon.bpel.ui.bpel2svg.Link in project carbon-apimgt by wso2.
the class WSDL11SOAPOperationExtractor method getSoapBindingOperations.
/**
* Retrieves all the operations defined in the provided WSDL definition.
*
* @param definition WSDL Definition
* @return a set of {@link WSDLOperation} defined in the provided WSDL definition
*/
private Set<WSDLSOAPOperation> getSoapBindingOperations(Definition definition) throws APIMgtWSDLException {
Set<WSDLSOAPOperation> allOperations = new HashSet<>();
for (Object bindingObj : definition.getAllBindings().values()) {
if (bindingObj instanceof Binding) {
Binding binding = (Binding) bindingObj;
Set<WSDLSOAPOperation> operations = getSOAPBindingOperations(binding);
allOperations.addAll(operations);
}
}
return allOperations;
}
use of org.wso2.carbon.bpel.ui.bpel2svg.Link in project carbon-apimgt by wso2.
the class ApiMgtDAO method getApplicationPolicy.
/**
* Retrieves {@link ApplicationPolicy} with name <code>policyName</code> and tenant Id <code>tenantNId</code>
*
* @param policyName name of the policy to retrieve from the database
* @param tenantId tenantId of the policy
* @return {@link ApplicationPolicy}
* @throws APIManagementException
*/
public ApplicationPolicy getApplicationPolicy(String policyName, int tenantId) throws APIManagementException {
ApplicationPolicy policy = null;
Connection connection = null;
PreparedStatement selectStatement = null;
ResultSet resultSet = null;
String sqlQuery = SQLConstants.GET_APPLICATION_POLICY_SQL;
if (forceCaseInsensitiveComparisons) {
sqlQuery = SQLConstants.GET_APPLICATION_POLICY_SQL;
}
try {
connection = APIMgtDBUtil.getConnection();
selectStatement = connection.prepareStatement(sqlQuery);
selectStatement.setString(1, policyName);
selectStatement.setInt(2, tenantId);
// Should return only single row
resultSet = selectStatement.executeQuery();
if (resultSet.next()) {
policy = new ApplicationPolicy(resultSet.getString(ThrottlePolicyConstants.COLUMN_NAME));
setCommonPolicyDetails(policy, resultSet);
}
} catch (SQLException e) {
handleException("Failed to get application policy: " + policyName + '-' + tenantId, e);
} finally {
APIMgtDBUtil.closeAllConnections(selectStatement, connection, resultSet);
}
return policy;
}
use of org.wso2.carbon.bpel.ui.bpel2svg.Link in project carbon-apimgt by wso2.
the class ApiMgtDAO method setQueryParameterConditions.
/**
* Add Query parameter conditions of pipeline with pipeline Id: <code>pipelineId</code> to a
* provided {@link Condition} array
*
* @param pipelineId Id of the pipeline
* @param conditions condition array to populate
* @throws APIManagementException
*/
private void setQueryParameterConditions(int pipelineId, ArrayList<Condition> conditions) throws APIManagementException {
Connection connection = null;
PreparedStatement conditionsStatement = null;
ResultSet resultSet = null;
try {
connection = APIMgtDBUtil.getConnection();
conditionsStatement = connection.prepareStatement(SQLConstants.ThrottleSQLConstants.GET_QUERY_PARAMETER_CONDITIONS_SQL);
conditionsStatement.setInt(1, pipelineId);
resultSet = conditionsStatement.executeQuery();
while (resultSet.next()) {
QueryParameterCondition queryParameterCondition = new QueryParameterCondition();
queryParameterCondition.setParameter(resultSet.getString(ThrottlePolicyConstants.COLUMN_PARAMETER_NAME));
queryParameterCondition.setValue(resultSet.getString(ThrottlePolicyConstants.COLUMN_PARAMETER_VALUE));
queryParameterCondition.setInvertCondition(resultSet.getBoolean(ThrottlePolicyConstants.COLUMN_IS_PARAM_MAPPING));
conditions.add(queryParameterCondition);
}
} catch (SQLException e) {
handleException("Failed to get query parameter conditions for pipelineId: " + pipelineId, e);
} finally {
APIMgtDBUtil.closeAllConnections(conditionsStatement, connection, resultSet);
}
}
use of org.wso2.carbon.bpel.ui.bpel2svg.Link in project carbon-apimgt by wso2.
the class ApiMgtDAO method getAPIPolicyByUUID.
/**
* Retrieves {@link APIPolicy} with name <code>uuid</code>
* <p>This will retrieve complete details about the APIPolicy with all pipelines and conditions.</p>
*
* @param uuid uuid of the policy to retrieve from the database
* @return {@link APIPolicy}
* @throws APIManagementException
*/
public APIPolicy getAPIPolicyByUUID(String uuid) throws APIManagementException {
APIPolicy policy = null;
Connection connection = null;
PreparedStatement selectStatement = null;
ResultSet resultSet = null;
String sqlQuery = SQLConstants.ThrottleSQLConstants.GET_API_POLICY_BY_UUID_SQL;
if (forceCaseInsensitiveComparisons) {
sqlQuery = SQLConstants.ThrottleSQLConstants.GET_API_POLICY_BY_UUID_SQL;
}
try {
connection = APIMgtDBUtil.getConnection();
selectStatement = connection.prepareStatement(sqlQuery);
selectStatement.setString(1, uuid);
// Should return only single result
resultSet = selectStatement.executeQuery();
if (resultSet.next()) {
policy = new APIPolicy(resultSet.getString(ThrottlePolicyConstants.COLUMN_NAME));
setCommonPolicyDetails(policy, resultSet);
policy.setUserLevel(resultSet.getString(ThrottlePolicyConstants.COLUMN_APPLICABLE_LEVEL));
policy.setPipelines(getPipelines(policy.getPolicyId()));
}
} catch (SQLException e) {
handleException("Failed to get api policy: " + uuid, e);
} finally {
APIMgtDBUtil.closeAllConnections(selectStatement, connection, resultSet);
}
return policy;
}
Aggregations