use of org.apache.ofbiz.webapp.event.EventHandler in project ofbiz-framework by apache.
the class RequestHandler method runEvent.
/**
* Find the event handler and invoke an event.
*/
public String runEvent(HttpServletRequest request, HttpServletResponse response, ConfigXMLReader.Event event, ConfigXMLReader.RequestMap requestMap, String trigger) throws EventHandlerException {
EventHandler eventHandler = eventFactory.getEventHandler(event.type);
String eventReturn = eventHandler.invoke(event, requestMap, request, response);
if (Debug.verboseOn() || (Debug.infoOn() && "request".equals(trigger)))
Debug.logInfo("Ran Event [" + event.type + ":" + event.path + "#" + event.invoke + "] from [" + trigger + "], result is [" + eventReturn + "]", module);
return eventReturn;
}
use of org.apache.ofbiz.webapp.event.EventHandler in project ofbiz-framework by apache.
the class TaskEvents method delegateAndAcceptAssignment.
/**
* Delegate and accept assignment event
*/
public static String delegateAndAcceptAssignment(HttpServletRequest request, HttpServletResponse response) {
ServletContext ctx = (ServletContext) request.getAttribute("servletContext");
RequestHandler rh = (RequestHandler) ctx.getAttribute("_REQUEST_HANDLER_");
Locale locale = UtilHttp.getLocale(request);
if (addToOrderRole(request)) {
try {
EventHandler eh = rh.getEventFactory().getEventHandler("service");
eh.invoke(new Event("service", "", "wfAcceptRoleAssignment", true), null, request, response);
} catch (EventHandlerException e) {
Debug.logError(e, "Invocation error", module);
request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resource_error, "OrderFailedToInvokeTheWfDelegateAndAcceptAssignmentService", locale));
return "error";
}
return "success";
}
return "error";
}
use of org.apache.ofbiz.webapp.event.EventHandler in project ofbiz-framework by apache.
the class TaskEvents method acceptRoleAssignment.
/**
* Accept role assignment event
*/
public static String acceptRoleAssignment(HttpServletRequest request, HttpServletResponse response) {
ServletContext ctx = (ServletContext) request.getAttribute("servletContext");
RequestHandler rh = (RequestHandler) ctx.getAttribute("_REQUEST_HANDLER_");
Locale locale = UtilHttp.getLocale(request);
if (addToOrderRole(request)) {
try {
EventHandler eh = rh.getEventFactory().getEventHandler("service");
eh.invoke(new Event("service", "", "wfAcceptRoleAssignment", true), null, request, response);
} catch (EventHandlerException e) {
Debug.logError(e, "Invocation error", module);
request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resource_error, "OrderFailedToInvokeTheWfAcceptRoleAssignmentService", locale));
return "error";
}
return "success";
}
return "error";
}
Aggregations