⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 owfesession.java

📁 一个工作流设计及定义的系统,可以直接与数据库结合进行系统工作流程的定义及应用.
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/* * Copyright (c) 2005, John Mettraux, OpenWFE.org * All rights reserved. *  * Redistribution and use in source and binary forms, with or without  * modification, are permitted provided that the following conditions are met: *  * . Redistributions of source code must retain the above copyright notice, this *   list of conditions and the following disclaimer.   *  * . Redistributions in binary form must reproduce the above copyright notice,  *   this list of conditions and the following disclaimer in the documentation  *   and/or other materials provided with the distribution. *  * . Neither the name of the "OpenWFE" nor the names of its contributors may be *   used to endorse or promote products derived from this software without *   specific prior written permission. *  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE  * POSSIBILITY OF SUCH DAMAGE. * * $Id: OwfeSession.java,v 1.20 2005/05/17 16:41:01 jmettraux Exp $ *///// OwfeSession.java//// john.mettraux@openwfe.org//// generated with // jtmpl 1.1.00 16.08.2003 John Mettraux (jmettraux@openwfe.org)//package openwfe.org.webclient;import java.rmi.RemoteException;import javax.servlet.http.HttpServletRequest;import openwfe.org.OpenWfeException;import openwfe.org.ApplicationContext;import openwfe.org.engine.workitem.WorkItem;import openwfe.org.engine.workitem.LaunchItem;import openwfe.org.engine.workitem.InFlowWorkItem;import openwfe.org.engine.expressions.FlowExpressionId;import openwfe.org.worklist.Header;import openwfe.org.worklist.Launchable;import openwfe.org.worklist.WorkSession;import openwfe.org.worklist.LaunchException;import openwfe.org.worklist.WorkListException;import openwfe.org.input.InputHelper;/** * Gathering all that is necessary here... * * <p><font size=2>CVS Info : * <br>$Author: jmettraux $ * <br>$Id: OwfeSession.java,v 1.20 2005/05/17 16:41:01 jmettraux Exp $ </font> * * @author john.mettraux@openwfe.org */public class OwfeSession{    private final static org.apache.log4j.Logger log = org.apache.log4j.Logger        .getLogger(OwfeSession.class.getName());    //    // CONSTANTS & co    private final static String OWFE_SESSION        = "owfe.session";    private final static String DROFLO_PREFIX        = "droflo-prefix";    private final static String DROFLO_SERVLET        = "/servlet/droflo.action?action=load&flowUrl=";    private static long drofloLinkCounter = Long.MIN_VALUE;        // this is used to share workitems between this webclient        // and droflo in display mode            /**     * The parameter named 'headers.limit' should be used to set the number     * of workitem headers displayed at max for each store. A negative     * value will make the webclient display every headers for the store.     * If this param is not specified, 30 workitem headers at most will     * be queried and displayed.     */    public final static String P_HEADERS_LIMIT        = "headers.limit";    private final static int DEFAULT_HEADERS_LIMIT = 30;    //    // MISC    private static int headerLimit = -6;        // 6 is the imperfection number...    //    // FIELDS    private String userName = null;    private HeaderMap headerMap = null;    private WorkItem workItem = null;    private String storeName = null;    private WorkSession workSession = null;    private String engineId = null;    private boolean displayHistory = false;    private Header header = null;    //    // CONSTRUCTORS    public OwfeSession (final String userName)    {        this.userName = userName;    }    //    // METHODS (gets and sets)    public String getUserName () { return this.userName; }    public HeaderMap getHeaderMap () { return this.headerMap; }    public void setHeaderMap (HeaderMap m) { this.headerMap = m; }    public WorkItem getWorkItem () { return this.workItem; }    public void setWorkItem (WorkItem i) { this.workItem = i; }    public String getStoreName () { return this.storeName; }    public void setStoreName (String s) { this.storeName = s; }    public WorkSession getWorkSession () { return this.workSession; }    public void setWorkSession (WorkSession s) { this.workSession = s; }    public Header getHeader () { return this.header; }    public void setHeader (final Header h) { this.header = h; }    public String getEngineId () { return this.engineId; }    public boolean shouldDisplayHistory () { return this.displayHistory; }    public void toggleDisplayHistory ()    {        this.displayHistory = ! this.displayHistory;    }    //    // PRIVATE MEMBER METHODS    private void saveWorkItem ()        throws RemoteException, WorkListException    {        this.workSession.save(this.storeName, (InFlowWorkItem)this.workItem);    }    private void releaseWorkItem ()        throws RemoteException, WorkListException    {        if (this.workItem instanceof InFlowWorkItem)        {            this.workSession.release                (this.storeName, (InFlowWorkItem)this.workItem);        }    }    private void cleanWorkItem ()    {        this.workItem = null;        this.storeName = null;    }    private void setLaunchItem (LaunchItem li, String engineId)    {        this.workItem = li;        this.engineId = engineId;    }    private void delegate (String targetStoreName)        throws RemoteException, WorkListException    {        log.debug("delegating to store '"+targetStoreName+"'...");        this.workSession.delegate            (this.storeName,              (InFlowWorkItem)this.workItem,              targetStoreName);    }    private void delegateToParticipant (String targetParticipantName)        throws RemoteException, WorkListException    {        log.debug("delegating to participant '"+targetParticipantName+"'...");        this.workSession.delegateToParticipant            (this.storeName,              (InFlowWorkItem)this.workItem,              targetParticipantName);    }    //    // PUBLIC MEMBER METHODS    public java.util.List getLaunchables ()        throws RemoteException, WorkListException    {        // CACHE ME !        return this.workSession.getLaunchables();    }    public java.util.List getTargetStoreList ()        throws RemoteException, WorkListException    {        // CACHE ME !        java.util.List stores = this.workSession.getStoreNames();        java.util.List targetList = new java.util.ArrayList(stores.size());        java.util.Iterator it = stores.iterator();        while (it.hasNext())        {            String storeName = (String)it.next();            if (this.workSession.checkPermission(storeName, "delegate"))            {                targetList.add(storeName);            }        }        return targetList;    }    public java.util.List getTargetParticipantList ()        throws RemoteException, WorkListException    {        return this.workSession.getParticipantsForDelegation();    }    //    // PUBLIC STATIC METHODS    public static InputHelper getInputHelper (HttpServletRequest req)    {        return InputHelper.getInstance            (req.getSession().getServletContext());    }    public static OwfeSession getOwfeSession (HttpServletRequest req)    {        return (OwfeSession)req.getSession().getAttribute(OWFE_SESSION);    }    public static void setOwfeSession         (HttpServletRequest req, OwfeSession session)    {        req.getSession().setAttribute(OWFE_SESSION, session);    }    public static void parseWorkItem (HttpServletRequest req)    {        OwfeSession owfeSession = getOwfeSession(req);        getInputHelper(req).parseRequest(owfeSession.workItem, req);    }    public static String proceed (HttpServletRequest req)        throws RemoteException, OpenWfeException    {        OwfeSession owfeSession = getOwfeSession(req);        //log.debug("proceed() owfeSession "+owfeSession);        //if (owfeSession.workItem != null &&        //    owfeSession.workItem instanceof InFlowWorkItem)        //{        //    log.debug        //      ("proceed() workitem.lastExpressionId"+        //       ((InFlowWorkItem)owfeSession.workItem).getLastExpressionId());        //}        parseWorkItem(req);        if (owfeSession.workItem instanceof LaunchItem)        {            String newFlowId = owfeSession.getWorkSession().launch                (owfeSession.engineId, (LaunchItem)owfeSession.workItem);            return newFlowId;        }        //log.debug        //    ("proceed() "+        //     ((InFlowWorkItem)owfeSession.workItem).getLastExpressionId());        owfeSession.getWorkSession().forward            (owfeSession.storeName, (InFlowWorkItem)owfeSession.workItem);        return null;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -