本文整理汇总了Java中org.ofbiz.webapp.control.ConfigXMLReader.Event类的典型用法代码示例。如果您正苦于以下问题:Java Event类的具体用法?Java Event怎么用?Java Event使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Event类属于org.ofbiz.webapp.control.ConfigXMLReader包,在下文中一共展示了Event类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: acceptRoleAssignment
import org.ofbiz.webapp.control.ConfigXMLReader.Event; //导入依赖的package包/类
/** 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";
}
示例2: delegateAndAcceptAssignment
import org.ofbiz.webapp.control.ConfigXMLReader.Event; //导入依赖的package包/类
/** 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";
}
示例3: invoke
import org.ofbiz.webapp.control.ConfigXMLReader.Event; //导入依赖的package包/类
/**
* @see org.ofbiz.webapp.event.EventHandler#invoke(ConfigXMLReader.Event, ConfigXMLReader.RequestMap, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
*/
public String invoke(Event event, RequestMap requestMap, HttpServletRequest request, HttpServletResponse response) throws EventHandlerException {
Class<?> eventClass = this.eventClassMap.get(event.path);
if (eventClass == null) {
synchronized (this) {
eventClass = this.eventClassMap.get(event.path);
if (eventClass == null) {
try {
ClassLoader loader = Thread.currentThread().getContextClassLoader();
eventClass = loader.loadClass(event.path);
} catch (ClassNotFoundException e) {
Debug.logError(e, "Error loading class with name: " + event.path + ", will not be able to run event...", module);
}
if (eventClass != null) {
eventClassMap.put(event.path, eventClass);
}
}
}
}
if (Debug.verboseOn()) Debug.logVerbose("[Set path/method]: " + event.path + " / " + event.invoke, module);
Class<?>[] paramTypes = new Class<?>[] {HttpServletRequest.class, HttpServletResponse.class};
Debug.logVerbose("*[[Event invocation]]*", module);
Object[] params = new Object[] {request, response};
return invoke(event.path, event.invoke, eventClass, paramTypes, params, event); // SCIPIO: pass the event
}
示例4: invoke
import org.ofbiz.webapp.control.ConfigXMLReader.Event; //导入依赖的package包/类
/**
* @see org.ofbiz.webapp.event.EventHandler#invoke(ConfigXMLReader.Event, ConfigXMLReader.RequestMap, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
*/
public String invoke(Event event, RequestMap requestMap, HttpServletRequest request, HttpServletResponse response) throws EventHandlerException {
String xmlResource = event.path;
String eventName = event.invoke;
Locale locale = UtilHttp.getLocale(request);
if (Debug.verboseOn()) Debug.logVerbose("[Set path/method]: " + xmlResource + " / " + eventName, module);
if (xmlResource == null) {
throw new EventHandlerException("XML Resource (eventPath) cannot be null");
}
if (eventName == null) {
throw new EventHandlerException("Event Name (eventMethod) cannot be null");
}
Debug.logVerbose("[Processing]: SIMPLE Event", module);
try {
String eventReturn = SimpleMethod.runSimpleEvent(xmlResource, eventName, request, response);
if (Debug.verboseOn()) Debug.logVerbose("[Event Return]: " + eventReturn, module);
return eventReturn;
} catch (MiniLangException e) {
Debug.logError(e, module);
String errMsg = UtilProperties.getMessage(SimpleEventHandler.err_resource, "simpleEventHandler.event_not_completed", (locale != null ? locale : Locale.getDefault())) + ": ";
request.setAttribute("_ERROR_MESSAGE_", errMsg + e.getMessage());
return "error";
}
}
示例5: invoke
import org.ofbiz.webapp.control.ConfigXMLReader.Event; //导入依赖的package包/类
/**
* @see org.ofbiz.webapp.event.EventHandler#invoke(ConfigXMLReader.Event, ConfigXMLReader.RequestMap, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
*/
public String invoke(Event event, RequestMap requestMap, HttpServletRequest request, HttpServletResponse response) throws EventHandlerException {
Class<?> eventClass = this.eventClassMap.get(event.path);
if (eventClass == null) {
synchronized (this) {
eventClass = this.eventClassMap.get(event.path);
if (eventClass == null) {
try {
ClassLoader loader = Thread.currentThread().getContextClassLoader();
eventClass = loader.loadClass(event.path);
} catch (ClassNotFoundException e) {
Debug.logError(e, "Error loading class with name: " + event.path + ", will not be able to run event...", module);
}
if (eventClass != null) {
eventClassMap.put(event.path, eventClass);
}
}
}
}
if (Debug.verboseOn()) Debug.logVerbose("[Set path/method]: " + event.path + " / " + event.invoke, module);
Class<?>[] paramTypes = new Class<?>[] {HttpServletRequest.class, HttpServletResponse.class};
Debug.logVerbose("*[[Event invocation]]*", module);
Object[] params = new Object[] {request, response};
return invoke(event.path, event.invoke, eventClass, paramTypes, params);
}
示例6: invoke
import org.ofbiz.webapp.control.ConfigXMLReader.Event; //导入依赖的package包/类
/**
* Invoke the web event
* @param event Contains information about what to execute
* @param requestMap Contains information about the request-map the event was called from
* @param request The servlet request object
* @param response The servlet response object
*
*@return String Result code
*@throws EventHandlerException
*/
public String invoke(Event event, RequestMap requestMap, HttpServletRequest request, HttpServletResponse response) throws EventHandlerException;