當前位置: 首頁>>代碼示例>>Java>>正文


Java Event類代碼示例

本文整理匯總了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";
}
 
開發者ID:ilscipio,項目名稱:scipio-erp,代碼行數:20,代碼來源:TaskEvents.java

示例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";
}
 
開發者ID:ilscipio,項目名稱:scipio-erp,代碼行數:20,代碼來源:TaskEvents.java

示例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
}
 
開發者ID:ilscipio,項目名稱:scipio-erp,代碼行數:32,代碼來源:JavaEventHandler.java

示例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";
    }
}
 
開發者ID:gildaslemoal,項目名稱:elpi,代碼行數:30,代碼來源:SimpleEventHandler.java

示例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);
}
 
開發者ID:gildaslemoal,項目名稱:elpi,代碼行數:32,代碼來源:JavaEventHandler.java

示例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;
 
開發者ID:ilscipio,項目名稱:scipio-erp,代碼行數:12,代碼來源:EventHandler.java


注:本文中的org.ofbiz.webapp.control.ConfigXMLReader.Event類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。