Source Code Cross Referenced for CommonExpressionParticipants.java in  » Workflow-Engines » JaWE » org » enhydra » jawe » components » graph » 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 » Workflow Engines » JaWE » org.enhydra.jawe.components.graph 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.enhydra.jawe.components.graph;
002:
003:        import java.util.ArrayList;
004:        import java.util.HashMap;
005:        import java.util.HashSet;
006:        import java.util.Iterator;
007:        import java.util.List;
008:        import java.util.Map;
009:        import java.util.Set;
010:
011:        import org.enhydra.jawe.ResourceManager;
012:        import org.enhydra.shark.xpdl.XMLCollectionElement;
013:        import org.enhydra.shark.xpdl.XMLElement;
014:        import org.enhydra.shark.xpdl.elements.Participants;
015:        import org.enhydra.shark.xpdl.elements.WorkflowProcess;
016:
017:        /**
018:         * Represents collection of imaginary participants for entering 
019:         * common expressions for activity performers.
020:         *
021:         *  @author Sasa Bojanic
022:         */
023:        public class CommonExpressionParticipants extends Participants {
024:
025:            private static CommonExpressionParticipants instance;
026:
027:            private Map wpOrAsToCEPs = new HashMap();
028:
029:            public static CommonExpressionParticipants getInstance() {
030:                if (instance == null) {
031:                    instance = new CommonExpressionParticipants();
032:                }
033:                return instance;
034:            }
035:
036:            private CommonExpressionParticipants() {
037:                super ((WorkflowProcess) null);
038:            }
039:
040:            public XMLElement generateNewElement() {
041:                throw new RuntimeException(
042:                        "Please use method generateCommonExpressionParticipant (XMLCollectionElement wpOrAs)");
043:            }
044:
045:            public CommonExpressionParticipant generateCommonExpressionParticipant(
046:                    XMLCollectionElement wpOrAs) {
047:                CommonExpressionParticipant cep = new CommonExpressionParticipant(
048:                        this , wpOrAs);
049:                int i = 1;
050:                String prefix = ResourceManager
051:                        .getLanguageDependentString("CommonExpressionParticipantPrefix")
052:                        + " ";
053:                String id = prefix + String.valueOf(i);
054:                while (getCommonExpressionParticipant(wpOrAs, id) != null) {
055:                    i++;
056:                    id = prefix + String.valueOf(i);
057:                }
058:                cep.setId(id);
059:                Set ceps = (Set) wpOrAsToCEPs.get(wpOrAs);
060:                if (ceps == null) {
061:                    ceps = new HashSet();
062:                }
063:                ceps.add(cep);
064:                wpOrAsToCEPs.put(wpOrAs, ceps);
065:                return cep;
066:            }
067:
068:            public Set getCommonExpressionParticipants(
069:                    XMLCollectionElement wpOrAs) {
070:                Set ceps = (Set) wpOrAsToCEPs.get(wpOrAs);
071:                if (ceps == null) {
072:                    ceps = new HashSet();
073:                }
074:                return ceps;
075:            }
076:
077:            public CommonExpressionParticipant getUpdatedCommonExpressionParticipant(
078:                    List vo, XMLCollectionElement wpOrAs) {
079:                Set ceps = (Set) wpOrAsToCEPs.get(wpOrAs);
080:                CommonExpressionParticipant cep = null;
081:                if (ceps != null) {
082:                    Iterator it = ceps.iterator();
083:                    while (it.hasNext()) {
084:                        CommonExpressionParticipant p = (CommonExpressionParticipant) it
085:                                .next();
086:                        String idToSearch = GraphEAConstants.COMMON_EXPRESSION_PARTICIPANT_PREFIX
087:                                + p.getId()
088:                                + GraphEAConstants.COMMON_EXPRESSION_PARTICIPANT_SUFIX;
089:                        if (!vo.contains(idToSearch)) {
090:                            cep = p;
091:                            break;
092:                        }
093:                    }
094:                }
095:                if (cep == null) {
096:                    //         System.err.println("CAN'T FIND UPDATEDCEP !!!");
097:                } else {
098:                    //         System.err.println("GETUPDATEDCEP -> "+cep.getId());         
099:                }
100:                return cep;
101:            }
102:
103:            public void removeUnusedCommonExpressionParticipants(List vo,
104:                    XMLCollectionElement wpOrAs) {
105:                List cepsToRemove = new ArrayList();
106:                Set s = (Set) wpOrAsToCEPs.get(wpOrAs);
107:                if (s != null) {
108:                    Iterator it = s.iterator();
109:                    while (it.hasNext()) {
110:                        CommonExpressionParticipant cep = (CommonExpressionParticipant) it
111:                                .next();
112:                        String idToSearch = GraphEAConstants.COMMON_EXPRESSION_PARTICIPANT_PREFIX
113:                                + cep.getId()
114:                                + GraphEAConstants.COMMON_EXPRESSION_PARTICIPANT_SUFIX;
115:                        if (!vo.contains(idToSearch)) {
116:                            cepsToRemove.add(cep);
117:                        }
118:                    }
119:                    it = cepsToRemove.iterator();
120:                    while (it.hasNext()) {
121:                        CommonExpressionParticipant cepToRemove = (CommonExpressionParticipant) it
122:                                .next();
123:                        s.remove(cepToRemove);
124:                        //            System.err.println("REMUNUSEDCEPS -> removing cep "+cepToRemove.getId());
125:                    }
126:                }
127:            }
128:
129:            public CommonExpressionParticipant getCommonExpressionParticipant(
130:                    XMLCollectionElement wpOrAs, String id) {
131:                Set ceps = (Set) wpOrAsToCEPs.get(wpOrAs);
132:                CommonExpressionParticipant cep = null;
133:                if (ceps != null) {
134:                    Iterator it = ceps.iterator();
135:                    while (it.hasNext()) {
136:                        CommonExpressionParticipant p = (CommonExpressionParticipant) it
137:                                .next();
138:                        if (p.getId().equals(id)) {
139:                            cep = p;
140:                            break;
141:                        }
142:                    }
143:                }
144:                if (cep != null) {
145:                    //         System.err.println("GETCEP -> Found cep "+id);
146:                } else {
147:                    //         System.err.println("GETCEP -> Can't find cep "+id);
148:                }
149:                return cep;
150:            }
151:
152:            public void printList(XMLCollectionElement wpOrAs) {
153:                Set ceps = getCommonExpressionParticipants(wpOrAs);
154:                Iterator it = ceps.iterator();
155:                int i = 1;
156:                while (it.hasNext()) {
157:                    System.err
158:                            .println("cep "
159:                                    + (i++)
160:                                    + " is "
161:                                    + ((CommonExpressionParticipant) it.next())
162:                                            .getId());
163:                }
164:            }
165:
166:            public String getIdForVisualOrderEA(String pId) {
167:                return GraphEAConstants.COMMON_EXPRESSION_PARTICIPANT_PREFIX
168:                        + pId
169:                        + GraphEAConstants.COMMON_EXPRESSION_PARTICIPANT_SUFIX;
170:            }
171:
172:            public String getIdFromVisualOrderEA(String pId) {
173:                return pId
174:                        .substring(
175:                                GraphEAConstants.COMMON_EXPRESSION_PARTICIPANT_PREFIX
176:                                        .length(),
177:                                pId.length()
178:                                        - GraphEAConstants.COMMON_EXPRESSION_PARTICIPANT_SUFIX
179:                                                .length());
180:            }
181:
182:            public boolean isCommonExpressionParticipantId(String pId) {
183:                return pId
184:                        .startsWith(GraphEAConstants.COMMON_EXPRESSION_PARTICIPANT_PREFIX)
185:                        && pId
186:                                .endsWith(GraphEAConstants.COMMON_EXPRESSION_PARTICIPANT_SUFIX);
187:            }
188:
189:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.