use of org.wso2.carbon.identity.workflow.mgt.bean.WorkflowRequestAssociation in project carbon-identity-framework by wso2.
the class WorkflowRequestAssociationDAO method getWorkflowsOfRequest.
/**
* Get array of Workflows of a request
*
* @param requestId
* @return
* @throws InternalWorkflowException
*/
public WorkflowRequestAssociation[] getWorkflowsOfRequest(String requestId) throws InternalWorkflowException {
Connection connection = IdentityDatabaseUtil.getDBConnection(false);
PreparedStatement prepStmt = null;
String query = SQLConstants.GET_WORKFLOWS_OF_REQUEST;
ResultSet resultSet = null;
try {
prepStmt = connection.prepareStatement(query);
prepStmt.setString(1, requestId);
resultSet = prepStmt.executeQuery();
ArrayList<WorkflowRequestAssociation> workflowDTOs = new ArrayList<>();
while (resultSet.next()) {
WorkflowRequestAssociation workflowDTO = new WorkflowRequestAssociation();
workflowDTO.setWorkflowId(resultSet.getString(SQLConstants.ID_COLUMN));
workflowDTO.setWorkflowName(resultSet.getString(SQLConstants.WF_NAME_COLUMN));
workflowDTO.setLastUpdatedTime(resultSet.getTimestamp(SQLConstants.REQUEST_UPDATED_AT_COLUMN).toString());
workflowDTO.setStatus(resultSet.getString(SQLConstants.REQUEST_STATUS_COLUMN));
workflowDTOs.add(workflowDTO);
}
WorkflowRequestAssociation[] requestArray = new WorkflowRequestAssociation[workflowDTOs.size()];
for (int i = 0; i < workflowDTOs.size(); i++) {
requestArray[i] = workflowDTOs.get(i);
}
return requestArray;
} catch (SQLException e) {
throw new InternalWorkflowException("Error when executing the sql query:" + query, e);
} finally {
IdentityDatabaseUtil.closeAllConnections(connection, resultSet, prepStmt);
}
}
use of org.wso2.carbon.identity.workflow.mgt.bean.WorkflowRequestAssociation in project carbon-identity-framework by wso2.
the class WorkflowManagementServiceImpl method getWorkflowsOfRequest.
/**
* Get list of workflows of a request
*
* @param requestId
* @return
* @throws WorkflowException
*/
@Override
public WorkflowRequestAssociation[] getWorkflowsOfRequest(String requestId) throws WorkflowException {
List<WorkflowListener> workflowListenerList = WorkflowServiceDataHolder.getInstance().getWorkflowListenerList();
for (WorkflowListener workflowListener : workflowListenerList) {
if (workflowListener.isEnable()) {
workflowListener.doPreGetWorkflowsOfRequest(requestId);
}
}
WorkflowRequestAssociation[] requestAssociations = workflowRequestAssociationDAO.getWorkflowsOfRequest(requestId);
for (WorkflowListener workflowListener : workflowListenerList) {
if (workflowListener.isEnable()) {
workflowListener.doPostGetWorkflowsOfRequest(requestId, requestAssociations);
}
}
return requestAssociations;
}
Aggregations