use of org.wso2.carbon.identity.workflow.mgt.dto.WorkflowEvent in project carbon-identity-framework by wso2.
the class WorkflowManagementServiceImpl method listWorkflowEvents.
@Override
public List<WorkflowEvent> listWorkflowEvents() {
List<WorkflowListener> workflowListenerList = WorkflowServiceDataHolder.getInstance().getWorkflowListenerList();
for (WorkflowListener workflowListener : workflowListenerList) {
if (workflowListener.isEnable()) {
workflowListener.doPreListWorkflowEvents();
}
}
List<WorkflowRequestHandler> workflowRequestHandlers = WorkflowServiceDataHolder.getInstance().listRequestHandlers();
List<WorkflowEvent> eventList = new ArrayList<>();
if (workflowRequestHandlers != null) {
for (WorkflowRequestHandler requestHandler : workflowRequestHandlers) {
WorkflowEvent event = new WorkflowEvent();
event.setEventId(requestHandler.getEventId());
event.setEventFriendlyName(requestHandler.getFriendlyName());
event.setEventDescription(requestHandler.getDescription());
event.setEventCategory(requestHandler.getCategory());
// note: parameters are not set at here in list operation. It's set only at get operation
if (requestHandler.getParamDefinitions() != null) {
Parameter[] parameterDTOs = new Parameter[requestHandler.getParamDefinitions().size()];
int i = 0;
for (Map.Entry<String, String> paramEntry : requestHandler.getParamDefinitions().entrySet()) {
Parameter parameterDTO = new Parameter();
parameterDTO.setParamName(paramEntry.getKey());
parameterDTO.setParamValue(paramEntry.getValue());
parameterDTOs[i] = parameterDTO;
i++;
}
event.setParameters(parameterDTOs);
}
eventList.add(event);
}
}
for (WorkflowListener workflowListener : workflowListenerList) {
if (workflowListener.isEnable()) {
if (workflowListener.isEnable()) {
workflowListener.doPostListWorkflowEvents(eventList);
}
}
}
return eventList;
}
use of org.wso2.carbon.identity.workflow.mgt.dto.WorkflowEvent in project carbon-identity-framework by wso2.
the class WorkflowManagementServiceImpl method getEvent.
@Override
public WorkflowEvent getEvent(String id) {
List<WorkflowListener> workflowListenerList = WorkflowServiceDataHolder.getInstance().getWorkflowListenerList();
for (WorkflowListener workflowListener : workflowListenerList) {
if (workflowListener.isEnable()) {
workflowListener.doPreGetEvent(id);
}
}
WorkflowRequestHandler requestHandler = WorkflowServiceDataHolder.getInstance().getRequestHandler(id);
WorkflowEvent event = null;
if (requestHandler != null) {
event = new WorkflowEvent();
event.setEventId(requestHandler.getEventId());
event.setEventFriendlyName(requestHandler.getFriendlyName());
event.setEventDescription(requestHandler.getDescription());
event.setEventCategory(requestHandler.getCategory());
if (requestHandler.getParamDefinitions() != null) {
Parameter[] parameters = new Parameter[requestHandler.getParamDefinitions().size()];
int i = 0;
for (Map.Entry<String, String> paramEntry : requestHandler.getParamDefinitions().entrySet()) {
Parameter parameter = new Parameter();
parameter.setParamName(paramEntry.getKey());
parameter.setParamValue(paramEntry.getValue());
parameters[i] = parameter;
i++;
}
event.setParameters(parameters);
}
}
for (WorkflowListener workflowListener : workflowListenerList) {
if (workflowListener.isEnable()) {
workflowListener.doPostGetEvent(id, event);
}
}
return event;
}
Aggregations