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

📄 owfesession.java

📁 一个工作流设计及定义的系统,可以直接与数据库结合进行系统工作流程的定义及应用.
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
    }    public static void cancel (HttpServletRequest req)        throws RemoteException, WorkListException    {        OwfeSession owfeSession = getOwfeSession(req);        owfeSession.releaseWorkItem();        owfeSession.cleanWorkItem();    }    private static int getHeaderLimit (final HttpServletRequest req)    {        if (headerLimit != -6) return headerLimit;        headerLimit = DEFAULT_HEADERS_LIMIT;        final String shl = req.getSession().getServletContext()            .getInitParameter(P_HEADERS_LIMIT);        try        {            headerLimit = Integer.parseInt(shl);        }        catch (final Throwable t)        {        }        return headerLimit;    }    public static void refreshStores (final HttpServletRequest req)        throws RemoteException    {        final OwfeSession owfeSession = getOwfeSession(req);        if (owfeSession.headerMap == null)            owfeSession.headerMap = new HeaderMap();        //else        //    owfeSession.headerMap.clear();        final java.util.Iterator it =             owfeSession.getWorkSession().getStoreNames().iterator();        while (it.hasNext())        {            try            {                String storeName = (String)it.next();                boolean canWrite = owfeSession.workSession                    .checkPermission(storeName, "write");                final java.util.List headers = owfeSession.workSession                    .getHeaders(storeName, getHeaderLimit(req));                //                // DEBUG                int i = 0;                final java.util.Iterator hit = headers.iterator();                while (hit.hasNext())                {                    final openwfe.org.worklist.Header header =                         (openwfe.org.worklist.Header)hit.next();                    log.debug("   - "+(i++)+" "+header.getExpressionId());                }                // -----                //                                owfeSession.headerMap                    .putHeaders(storeName, canWrite, headers);            }            catch (final java.security.AccessControlException ace)            {                log.debug("refreshStores() "+ace);                continue;            }            catch (final Exception e)            {                log.warn("refreshStores() problem with a store :", e);                continue;            }        }    }    public static void delegate        (HttpServletRequest req,          String targetStoreName,          String targetParticipantName)    throws         RemoteException,         WorkListException    {        OwfeSession owfeSession = getOwfeSession(req);        if (targetStoreName != null)        {            owfeSession.delegate(targetStoreName);            return;        }        owfeSession.delegateToParticipant(targetParticipantName);    }    public static void editWorkItem         (HttpServletRequest req, String id)    throws         RemoteException, OpenWfeException    {        log.debug("editWorkItem() id >"+id+"<");        final OwfeSession owfeSession = getOwfeSession(req);        final FlowExpressionId itemId = owfeSession.getHeaderMap()            .parseExpressionId(id);        final String storeName = owfeSession.getHeaderMap()            .getStoreName(id);        final InFlowWorkItem item = owfeSession.workSession            .getAndLock(storeName, itemId);        log.debug("editWorkItem() storeName >"+storeName+"<");        log.debug("editWorkItem() itemId "+itemId);        owfeSession.workItem = item;        owfeSession.storeName = storeName;        log.debug            ("editWorkItem() item     "+             item.getLastExpressionId());        //log.debug        //    ("editWorkItem() workitem "+        //     ((InFlowWorkItem)owfeSession.workItem).getLastExpressionId());        log.debug("editWorkItem() owfeSession "+owfeSession);    }    public static void prepareLaunchItem (HttpServletRequest req, String url)        throws RemoteException, OpenWfeException    {        OwfeSession owfeSession = getOwfeSession(req);        java.util.List launchables = owfeSession.getLaunchables();        String engineId = url.split("@")[1];        LaunchItem launchItem = buildLaunchItem(launchables, url);        owfeSession.setLaunchItem(launchItem, engineId);    }    private static LaunchItem buildLaunchItem         (final java.util.List launchables, final String launchUrl)    throws        LaunchException    {        String[] ss = launchUrl.split("@");        String url = ss[0];        String engineId = ss[1];        log.debug("engineId >"+engineId+"<");        log.debug("url      >"+url+"<");        Launchable launchable = null;        java.util.Iterator it = launchables.iterator();        while (it.hasNext())        {            Launchable l = (Launchable)it.next();            //log.debug("l.engineId >"+l.getEngineId()+"<");            //log.debug("l.url      >"+l.getUrl()+"<");            if (l.getEngineId().equals(engineId) &&                 l.getUrl().equals(url))            {                launchable = l;                break;            }        }        if (launchable == null)        {            throw new LaunchException                ("No launchable found under '"+launchUrl+"'");        }        return launchable.getLaunchItem();    }    public static void releaseSession (HttpServletRequest req)        throws RemoteException    {        OwfeSession session = getOwfeSession(req);        if (session != null) session.getWorkSession().release();        setOwfeSession(req, null);    }    public static void save (HttpServletRequest req)        throws RemoteException, WorkListException    {        parseWorkItem(req);        OwfeSession session = getOwfeSession(req);        session.saveWorkItem();        session.releaseWorkItem();        session.cleanWorkItem();    }    public static void viewWorkItem (HttpServletRequest req, String id)        throws RemoteException, OpenWfeException    {        OwfeSession session = getOwfeSession(req);        FlowExpressionId itemId = session.getHeaderMap()            .parseExpressionId(id);        InFlowWorkItem item = session.workSession.get            (session.headerMap.getStoreName(id),              itemId);        session.workItem = item;        session.storeName = null;    }    public static void viewHeader         (final HttpServletRequest req, final String id)    throws         RemoteException, OpenWfeException    {        OwfeSession session = getOwfeSession(req);        session.setHeader(session.getHeaderMap().getHeader(id));    }    public static String getDrofloPrefix (final HttpServletRequest req)    {        final String sDrofloPrefix = req.getSession().getServletContext()            .getInitParameter(DROFLO_PREFIX);        if (sDrofloPrefix != null) return sDrofloPrefix;        // cache it ??                int index = 0;        String s = req.getRequestURL().toString();        for (int i=0; i<3; i++)        {            int j = s.indexOf("/");            j = j+1;            index += j;            s = s.substring(j);        }        final String result = req.getRequestURL().substring(0, index)+"droflo";        log.debug("getDrofloPrefix() returning >"+result+"<");        return result;    }    /**     * Prepares and returns a URL for displaying the droflo representation     * of the flow the workitem in 'running' in.     * This method is synchronized because it generates a unique id (dlc)     * shared by this session and the droflo session in order to retrieve     * the workitem concerned.     */    public synchronized static String getDrofloLink         (final HttpServletRequest req, final WorkItem wi)    {        StringBuffer sb = new StringBuffer();        sb.append(getDrofloPrefix(req));        sb.append(DROFLO_SERVLET);        if (wi instanceof InFlowWorkItem)        {            FlowExpressionId id = ((InFlowWorkItem)wi).getLastExpressionId();            sb.append(id.getWorkflowDefinitionUrl());            sb.append("&expName="); sb.append(id.getExpressionName());            sb.append("&expId="); sb.append(id.getExpressionId());            sb.append("&dlc="); sb.append(drofloLinkCounter);            //            // store InFlowWorkItem instance in HttpSession            // (will be used by DrofloSession)            ApplicationContext.lookupSharedContext()                .put("workitem"+drofloLinkCounter, wi);            drofloLinkCounter++;        }        else if (wi instanceof LaunchItem)        {            sb.append(((LaunchItem)wi).getWorkflowDefinitionUrl());        }        else        {            log.warn                ("Cannot compute drofloLink for wi of class "+wi.getClass());        }        return sb.toString();    }    public static void toggleDisplayHistory (HttpServletRequest req)    {        OwfeSession session = getOwfeSession(req);        session.toggleDisplayHistory();    }}

⌨️ 快捷键说明

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