KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > openharmonise > workfloweditor > vfs > VFSWorkflowStageDefinition


1 /*
2  * The contents of this file are subject to the
3  * Mozilla Public License Version 1.1 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at http://www.mozilla.org/MPL/
6  *
7  * Software distributed under the License is distributed on an "AS IS"
8  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
9  * See the License for the specific language governing rights and
10  * limitations under the License.
11  *
12  * The Initial Developer of the Original Code is Simulacra Media Ltd.
13  * Portions created by Simulacra Media Ltd are Copyright (C) Simulacra Media Ltd, 2004.
14  *
15  * All Rights Reserved.
16  *
17  * Contributor(s):
18  */

19 package org.openharmonise.workfloweditor.vfs;
20
21 import java.util.*;
22
23 import org.openharmonise.commons.xml.namespace.*;
24 import org.openharmonise.vfs.*;
25 import org.openharmonise.vfs.metadata.*;
26 import org.openharmonise.vfs.metadata.value.*;
27 import org.openharmonise.workfloweditor.model.*;
28
29
30 /**
31  * Virtual file system implementation of {@link org.openharmonise.workfloweditor.model.WorkflowStageDefinition}.
32  *
33  * @author Matthew Large
34  * @version $Revision: 1.2 $
35  *
36  */

37 public class VFSWorkflowStageDefinition extends WorkflowStageDefinition {
38
39     /**
40      * Virtual file for the value for this definition.
41      */

42     private VirtualFile m_valueResource = null;
43     
44     /**
45      * Property instance for the roles.
46      */

47     private PropertyInstance m_rolesPropInst = null;
48
49     
50     private VFSWorkflowStageDefinition(String JavaDoc sTitle, VFSWorkflowModel model) {
51         super(model);
52     }
53
54     /**
55      * Constructs a new virtual file system workflow stage definition.
56      *
57      * @param valueResource Virtual file for the value
58      * @param model Model
59      */

60     public VFSWorkflowStageDefinition(VirtualFile valueResource, VFSWorkflowModel model) {
61         super(model);
62         this.m_valueResource = valueResource;
63         this.setup();
64     }
65
66     /**
67      * Configures this stage definition.
68      *
69      */

70     private void setup() {
71         String JavaDoc sTitle = this.m_valueResource.getVFS().getVirtualFileSystemView().getDisplayName(m_valueResource);
72         this.setTitle(sTitle);
73         
74         m_rolesPropInst = this.m_valueResource.getProperty(NamespaceType.OHRM.getURI(), "WORKFLOW_ROLES");
75         Iterator itor = m_rolesPropInst.getValues().iterator();
76         while (itor.hasNext()) {
77             ValueValue value = (ValueValue) itor.next();
78             String JavaDoc sValuePath = value.getValue();
79             Iterator itor2 = this.getModel().getAvailableRoles().iterator();
80             while (itor2.hasNext()) {
81                 VFSRole role = (VFSRole) itor2.next();
82                 if(role.getValuePath().equals(sValuePath)) {
83                     super.addRole(role);
84                 }
85             }
86         }
87     }
88
89     /**
90      * Returns the full path to the virtual file for the value for this
91      * workflow stage definition.
92      *
93      * @return Full path
94      */

95     public String JavaDoc getPath() {
96         return this.m_valueResource.getFullPath();
97     }
98 }
99
Popular Tags