Source Code Cross Referenced for VFSWorkflowStage.java in  » Content-Management-System » harmonise » org » openharmonise » workfloweditor » vfs » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Content Management System » harmonise » org.openharmonise.workfloweditor.vfs 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * The contents of this file are subject to the 
003:         * Mozilla Public License Version 1.1 (the "License"); 
004:         * you may not use this file except in compliance with the License. 
005:         * You may obtain a copy of the License at http://www.mozilla.org/MPL/
006:         *
007:         * Software distributed under the License is distributed on an "AS IS"
008:         * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. 
009:         * See the License for the specific language governing rights and 
010:         * limitations under the License.
011:         *
012:         * The Initial Developer of the Original Code is Simulacra Media Ltd.
013:         * Portions created by Simulacra Media Ltd are Copyright (C) Simulacra Media Ltd, 2004.
014:         *
015:         * All Rights Reserved.
016:         *
017:         * Contributor(s):
018:         */
019:        package org.openharmonise.workfloweditor.vfs;
020:
021:        import java.util.*;
022:
023:        import org.openharmonise.commons.xml.namespace.*;
024:        import org.openharmonise.him.*;
025:        import org.openharmonise.vfs.*;
026:        import org.openharmonise.vfs.metadata.*;
027:        import org.openharmonise.vfs.metadata.value.*;
028:        import org.openharmonise.vfs.servers.ServerList;
029:        import org.openharmonise.workfloweditor.model.*;
030:
031:        /**
032:         * Virtual file system implementation of {@link org.openharmonise.workfloweditor.model.WorkflowStage}.
033:         *  
034:         * @author Matthew Large
035:         * @version $Revision: 1.2 $
036:         *
037:         */
038:        public class VFSWorkflowStage extends WorkflowStage {
039:
040:            /**
041:             * Virtual file for the value for this workflow stage.
042:             */
043:            private VirtualFile m_valueResource = null;
044:
045:            /**
046:             * Property instance for the definition.
047:             */
048:            private PropertyInstance m_definitionPropInst = null;
049:
050:            /**
051:             * Property instance for the roles.
052:             */
053:            private PropertyInstance m_rolesPropInst = null;
054:
055:            /**
056:             * Property instance for the dependencies.
057:             */
058:            private PropertyInstance m_dependenciesPropInst = null;
059:
060:            /**
061:             * Property instance for the inheritance attribute.
062:             */
063:            private PropertyInstance m_inheritPropInst = null;
064:
065:            /**
066:             * Property instance for the mandatory attribute.
067:             */
068:            private PropertyInstance m_mandatoryPropInst = null;
069:
070:            /**
071:             * Constructs a new vitual file system workflow stage instance.
072:             * 
073:             * @param model Model
074:             * @param valueResource Value for the stage
075:             */
076:            public VFSWorkflowStage(WorkflowModel model,
077:                    VirtualFile valueResource) {
078:                super ();
079:                this .setModel(model);
080:                this .m_valueResource = valueResource;
081:                this .setup();
082:            }
083:
084:            /**
085:             * Configures this workflow stage.
086:             *
087:             */
088:            private void setup() {
089:                m_definitionPropInst = this .m_valueResource.getProperty(
090:                        NamespaceType.OHRM.getURI(), "WORKFLOW_RELN");
091:                Iterator itor = m_definitionPropInst.getValues().iterator();
092:                while (itor.hasNext()) {
093:                    ResourceValue value = (ResourceValue) itor.next();
094:                    String sDefinitionPath = value.getValue();
095:                    VirtualFile vfDefinitionFile = this .m_valueResource
096:                            .getVFS().getVirtualFile(sDefinitionPath)
097:                            .getResource();
098:                    VFSWorkflowStageDefinition stageDefinition = new VFSWorkflowStageDefinition(
099:                            vfDefinitionFile, (VFSWorkflowModel) this 
100:                                    .getModel());
101:                    super .setDefinition(stageDefinition);
102:                }
103:
104:                m_rolesPropInst = this .m_valueResource.getProperty(
105:                        NamespaceType.OHRM.getURI(), "WORKFLOW_ROLES");
106:                itor = m_rolesPropInst.getValues().iterator();
107:                while (itor.hasNext()) {
108:                    ValueValue value = (ValueValue) itor.next();
109:                    String sValuePath = value.getValue();
110:                    Iterator itor2 = this .getModel().getAvailableRoles()
111:                            .iterator();
112:                    while (itor2.hasNext()) {
113:                        VFSRole role = (VFSRole) itor2.next();
114:                        if (role.getValuePath().equals(sValuePath)) {
115:                            super .addRole(role);
116:                        }
117:                    }
118:                }
119:
120:                m_dependenciesPropInst = this .m_valueResource.getProperty(
121:                        NamespaceType.OHRM.getURI(), "WORKFLOW_DEPEND");
122:                itor = m_dependenciesPropInst.getValues().iterator();
123:                while (itor.hasNext()) {
124:                    ResourceValue value = (ResourceValue) itor.next();
125:                    String sDependencyPath = value.getValue();
126:                    VFSWorkflowStage dependencyStage = null;
127:                    Iterator itor2 = this .getModel().getWorkflowStages()
128:                            .iterator();
129:                    while (itor2.hasNext()) {
130:                        VFSWorkflowStage stage = (VFSWorkflowStage) itor2
131:                                .next();
132:                        if (stage.getPath().equals(sDependencyPath)) {
133:                            dependencyStage = stage;
134:                        }
135:                    }
136:                    if (dependencyStage != null) {
137:                        super .addDependancy(dependencyStage);
138:                    } else {
139:                        dependencyStage = new VFSWorkflowStage(this .getModel(),
140:                                this .m_valueResource.getVFS().getVirtualFile(
141:                                        sDependencyPath).getResource());
142:                        this .getModel().addWorkflowStage(dependencyStage);
143:                        super .addDependancy(dependencyStage);
144:                    }
145:                }
146:
147:                m_inheritPropInst = this .m_valueResource.getProperty(
148:                        NamespaceType.OHRM.getURI(), "WORKFLOW_INHERIT");
149:                itor = m_inheritPropInst.getValues().iterator();
150:                while (itor.hasNext()) {
151:                    BooleanValue value = (BooleanValue) itor.next();
152:                    super .setInheritable(value.getValue());
153:                }
154:                m_mandatoryPropInst = this .m_valueResource.getProperty(
155:                        NamespaceType.OHRM.getURI(), "WORKFLOW_MAND");
156:                itor = m_mandatoryPropInst.getValues().iterator();
157:                while (itor.hasNext()) {
158:                    BooleanValue value = (BooleanValue) itor.next();
159:                    super .setMandatory(value.getValue());
160:                }
161:            }
162:
163:            private PropertyInstance getMandatoryPropertyInstance() {
164:                return this .getValueResource().getProperty(
165:                        NamespaceType.OHRM.getURI(), "WORKFLOW_MAND");
166:            }
167:
168:            private PropertyInstance getInheritPropertyInstance() {
169:                return this .getValueResource().getProperty(
170:                        NamespaceType.OHRM.getURI(), "WORKFLOW_INHERIT");
171:            }
172:
173:            private PropertyInstance getDependenciesPropertyInstance() {
174:                return this .getValueResource().getProperty(
175:                        NamespaceType.OHRM.getURI(), "WORKFLOW_DEPEND");
176:            }
177:
178:            private PropertyInstance getRolesPropertyInstance() {
179:                return this .getValueResource().getProperty(
180:                        NamespaceType.OHRM.getURI(), "WORKFLOW_ROLES");
181:            }
182:
183:            private PropertyInstance getDefinitionPropertyInstance() {
184:                return this .getValueResource().getProperty(
185:                        NamespaceType.OHRM.getURI(), "WORKFLOW_RELN");
186:            }
187:
188:            /**
189:             * @param definition
190:             * @param model
191:             */
192:            private VFSWorkflowStage(WorkflowStageDefinition definition,
193:                    WorkflowModel model) {
194:                super (definition, model);
195:            }
196:
197:            /**
198:             * @param definition
199:             * @param dependancies
200:             * @param model
201:             */
202:            private VFSWorkflowStage(WorkflowStageDefinition definition,
203:                    List dependancies, WorkflowModel model) {
204:                super (definition, dependancies, model);
205:            }
206:
207:            /**
208:             * Returns the full path to the virtual file for the value for this
209:             * workflow stage.
210:             * 
211:             * @return Full path
212:             */
213:            public String getPath() {
214:                return this .m_valueResource.getFullPath();
215:            }
216:
217:            /* (non-Javadoc)
218:             * @see com.simulacramedia.workfloweditor.model.WorkflowStage#addDependancy(com.simulacramedia.workfloweditor.model.WorkflowStage)
219:             */
220:            public void addDependancy(WorkflowStage stage) {
221:                VFSWorkflowStage vfsStage = (VFSWorkflowStage) stage;
222:                ResourceValue value = (ResourceValue) this 
223:                        .getDependenciesPropertyInstance()
224:                        .getNewValueInstance();
225:                value.setValue(vfsStage.getPath());
226:                this .getDependenciesPropertyInstance().addValue(value);
227:                super .addDependancy(stage);
228:            }
229:
230:            /* (non-Javadoc)
231:             * @see com.simulacramedia.workfloweditor.model.WorkflowStage#addRole(com.simulacramedia.workfloweditor.model.Role)
232:             */
233:            public void addRole(Role role) {
234:                VFSRole vfsRole = (VFSRole) role;
235:                ValueValue value = (ValueValue) this .getRolesPropertyInstance()
236:                        .getNewValueInstance();
237:                value.setValue(vfsRole.getValuePath());
238:                this .getRolesPropertyInstance().addValue(value);
239:                super .addRole(role);
240:            }
241:
242:            /* (non-Javadoc)
243:             * @see com.simulacramedia.workfloweditor.model.WorkflowStage#removeDependancy(com.simulacramedia.workfloweditor.model.WorkflowStage)
244:             */
245:            public void removeDependancy(WorkflowStage stage) {
246:                VFSWorkflowStage vfsStage = (VFSWorkflowStage) stage;
247:                Iterator itor = this .getDependenciesPropertyInstance()
248:                        .getValues().iterator();
249:                while (itor.hasNext()) {
250:                    ResourceValue value = (ResourceValue) itor.next();
251:                    if (value.getValue().equals(vfsStage.getPath())) {
252:                        this .getDependenciesPropertyInstance().removeValue(
253:                                value);
254:                        break;
255:                    }
256:                }
257:                super .removeDependancy(stage);
258:            }
259:
260:            /* (non-Javadoc)
261:             * @see com.simulacramedia.workfloweditor.model.WorkflowStage#removeRole(com.simulacramedia.workfloweditor.model.Role)
262:             */
263:            public void removeRole(Role role) {
264:                VFSRole vfsRole = (VFSRole) role;
265:                Iterator itor = this .getRolesPropertyInstance().getValues()
266:                        .iterator();
267:                while (itor.hasNext()) {
268:                    ValueValue value = (ValueValue) itor.next();
269:                    if (value.getValue().equals(vfsRole.getValuePath())) {
270:                        this .getRolesPropertyInstance().removeValue(value);
271:                        break;
272:                    }
273:                }
274:                super .removeRole(role);
275:            }
276:
277:            /* (non-Javadoc)
278:             * @see com.simulacramedia.workfloweditor.model.WorkflowStage#setInheritable(boolean)
279:             */
280:            public void setInheritable(boolean bInheritable) {
281:                boolean bOkToSet = true;
282:                if (bInheritable) {
283:                    Iterator itor = super .getDependancies().iterator();
284:                    while (itor.hasNext()) {
285:                        WorkflowStage stage = (WorkflowStage) itor.next();
286:                        if (!stage.isInheritable()) {
287:                            bOkToSet = false;
288:                        }
289:                    }
290:                }
291:                if (bOkToSet) {
292:                    this .m_inheritPropInst.clearAllValues();
293:                    BooleanValue value = (BooleanValue) this 
294:                            .getInheritPropertyInstance().getNewValueInstance();
295:                    value.setValue(bInheritable);
296:                    this .getInheritPropertyInstance().addValue(value);
297:                    super .setInheritable(bInheritable);
298:                }
299:            }
300:
301:            /* (non-Javadoc)
302:             * @see com.simulacramedia.workfloweditor.model.WorkflowStage#setMandatory(boolean)
303:             */
304:            public void setMandatory(boolean bMandatory) {
305:                this .getMandatoryPropertyInstance().clearAllValues();
306:                BooleanValue value = (BooleanValue) this 
307:                        .getMandatoryPropertyInstance().getNewValueInstance();
308:                value.setValue(bMandatory);
309:                this .getMandatoryPropertyInstance().addValue(value);
310:                super .setMandatory(bMandatory);
311:            }
312:
313:            /* (non-Javadoc)
314:             * @see com.simulacramedia.workfloweditor.model.WorkflowStage#setDefinition(com.simulacramedia.workfloweditor.model.WorkflowStageDefinition)
315:             */
316:            public void setDefinition(WorkflowStageDefinition definition) {
317:                VFSWorkflowStageDefinition vfsDefinition = (VFSWorkflowStageDefinition) definition;
318:                if (this .getDefinitionPropertyInstance().getValues().size() > 0) {
319:                    this .getDefinitionPropertyInstance().clearAllValues();
320:                }
321:                ResourceValue value = (ResourceValue) this 
322:                        .getDefinitionPropertyInstance().getNewValueInstance();
323:                value.setValue(vfsDefinition.getPath());
324:                this .getDefinitionPropertyInstance().addValue(value);
325:                super .setDefinition(definition);
326:            }
327:
328:            private VirtualFile getValueResource() {
329:                return ServerList.getInstance().getHarmoniseServer().getVFS()
330:                        .getVirtualFile(this.getPath()).getResource();
331:            }
332:
333:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.