KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > infoglue > cms > workflow > taglib > WorkflowTag


1 /* ===============================================================================
2 *
3 * Part of the InfoGlue Content Management Platform (www.infoglue.org)
4 *
5 * ===============================================================================
6 *
7 * Copyright (C)
8 *
9 * This program is free software; you can redistribute it and/or modify it under
10 * the terms of the GNU General Public License version 2, as published by the
11 * Free Software Foundation. See the file LICENSE.html for more information.
12 *
13 * This program is distributed in the hope that it will be useful, but WITHOUT
14 * ANY WARRANTY, including the implied warranty of MERCHANTABILITY or FITNESS
15 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along with
18 * this program; if not, write to the Free Software Foundation, Inc. / 59 Temple
19 * Place, Suite 330 / Boston, MA 02111-1307 / USA.
20 *
21 * ===============================================================================
22 */

23 package org.infoglue.cms.workflow.taglib;
24
25 import org.infoglue.cms.applications.workflowtool.util.InfogluePropertySet;
26 import org.infoglue.cms.controllers.kernel.impl.simple.WorkflowController;
27 import org.infoglue.cms.security.InfoGluePrincipal;
28 import org.infoglue.deliver.taglib.AbstractTag;
29
30 /**
31  * Base class for all workflow related tags.
32  *
33  * Provides access to the propertyset associated with the workflow and
34  * the parameters used to identify a workflow.
35  */

36 public abstract class WorkflowTag extends AbstractTag
37 {
38     /**
39      * The name used to identify the current workflow action.
40      */

41     public static final String JavaDoc ACTION_ID_PARAMETER = "actionId";
42     
43     /**
44      * The name used to identify the current workflow.
45      */

46     public static final String JavaDoc WORKFLOW_ID_PARAMETER = "workflowId";
47
48     /**
49      * Default constructor.
50      */

51     protected WorkflowTag()
52     {
53         super();
54     }
55
56     /**
57      * Returns the identifier of the current workflow.
58      *
59      * @return the workflow identifier.
60      */

61     protected final String JavaDoc getWorkflowID()
62     {
63         return pageContext.getRequest().getParameter(WORKFLOW_ID_PARAMETER);
64     }
65
66     /**
67      * Returns the identifier of the current workflow action.
68      *
69      * @return the action identifier.
70      */

71     protected final String JavaDoc getActionID()
72     {
73         return pageContext.getRequest().getParameter(ACTION_ID_PARAMETER);
74     }
75
76     /**
77      * Returns the principal associated with the current session.
78      *
79      * @return the principal associated with the current session.
80      */

81     protected final InfoGluePrincipal getPrincipal()
82     {
83         return (InfoGluePrincipal) pageContext.getSession().getAttribute("org.infoglue.cms.security.user");
84     }
85
86     /**
87      * Returns the propertyset associated with the current workflow.
88      *
89      * @return the propertyset associated with the current workflow.
90      */

91     protected final InfogluePropertySet getPropertySet()
92     {
93         return new InfogluePropertySet(WorkflowController.getController().getPropertySet(getPrincipal(), Long.valueOf(getWorkflowID()).longValue()));
94     }
95 }
96
Popular Tags