Source Code Cross Referenced for ClassificationsForm.java in  » Workflow-Engines » osbl-1_0 » org » osbl » riskmanagement » gui » 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 » osbl 1_0 » org.osbl.riskmanagement.gui 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.osbl.riskmanagement.gui;
002:
003:        import org.conform.BeanMeta;
004:        import org.osbl.client.wings.form.*;
005:        import org.osbl.client.wings.form.layouter.*;
006:
007:        public class ClassificationsForm extends GenericObjectForm implements 
008:                HierarchicalContextAware {
009:            //private DuplicateClassificationAction duplicateClassificationAction = new DuplicateClassificationAction();
010:
011:            Object object;
012:
013:            @Override
014:            public Object getObject() {
015:                return object;
016:            }
017:
018:            @Override
019:            public void setObject(Object object) {
020:                this .object = object;
021:            }
022:
023:            @Override
024:            protected Object getObject(String path) {
025:                if (ComponentProvider.ROOT.equals(path))
026:                    return object;
027:
028:                return null;
029:            }
030:
031:            @Override
032:            protected void setObject(String path, Object object) {
033:                if (ComponentProvider.ROOT.equals(path))
034:                    this .object = object;
035:            }
036:
037:            @Override
038:            protected Instruction createLayoutInstruction() {
039:                return new Page("Classifications", new Division("blub",
040:                        new Column(
041:                        //new CustomEditor("duplicate")
042:                        )));
043:            }
044:
045:            /*
046:            protected SComponent createCustomComponent(String key) {
047:                return new XButton(duplicateClassificationAction);
048:            }
049:             */
050:
051:            public Class getType() {
052:                return String.class;
053:            }
054:
055:            @Override
056:            protected BeanMeta createBeanMeta(String path) {
057:                return null;
058:            }
059:
060:            public void setNode(GenericObjectTreeNode node) {
061:            }
062:
063:            /*
064:            private class DuplicateClassificationAction
065:                extends AbstractAction
066:            {
067:                private Timestamp created;
068:                private String createdBy;
069:                private String name;
070:                private Organisation newOrganisation;
071:                private SaveOrUpdateCommand saveOrUpdateCommand;
072:                private Group newGroup;
073:                Map<Member,Member> memberMap;
074:                Map<Long,Long> groupMap;
075:
076:                public DuplicateClassificationAction() {
077:                    putValue(Action.ACTION_COMMAND_KEY, Client.getInstance().getResourceProvider().getMessage(Organisation.class.getName() + ".buttons.duplicate"));
078:                }
079:
080:                public void actionPerformed(ActionEvent event) {
081:                    OrgaModel model = (OrgaModel)node.getModel();
082:                    final SComboBox combo = new SComboBox(model.getOrgaListModel());
083:                    final STextField textField = new STextField();
084:
085:                    SPanel panel = new SPanel(new SGridLayout(2, 2, 10, 10));
086:                    panel.add(new SLabel(Client.getInstance().getResourceProvider().getMessage(Organisation.class.getName() + ".titles.copyOrganisation")));
087:                    panel.add(combo);
088:                    panel.add(new SLabel(Client.getInstance().getResourceProvider().getMessage(Organisation.class.getName() + ".titles.copyName")));
089:                    panel.add(textField);
090:
091:                    XOptionPane.showInputDialog(
092:                        getComponent(),
093:                        Client.getInstance().getResourceProvider().getMessage(Organisation.class.getName() + ".titles.copyMessage"),
094:                        Client.getInstance().getResourceProvider().getMessage(Organisation.class.getName() + ".buttons.duplicate"),
095:                        panel,
096:                        new ActionListener() {
097:                        public void actionPerformed(ActionEvent event) {
098:                            if (event.getActionCommand() == XOptionPane.CANCEL_ACTION)
099:                                return;
100:
101:                            OrganisationTreeNode organisationTreeNode = (OrganisationTreeNode)combo.getSelectedItem();
102:                            Organisation organisation = organisationTreeNode.getObject();
103:
104:                            name = textField.getText();
105:                            if (name == null || organisation == null)
106:                                return;
107:
108:                            created = ConventionModifier.CREATED_INITIALIZER.getValue();
109:                            createdBy = ConventionModifier.CREATED_BY_INITIALIZER.getValue();
110:
111:                            try {
112:                                HibernateEnvironment.getInstance().beginTransaction();
113:
114:                                Persistence orgaCommandFactory = (Persistence)ServiceProvider.getInstance().getService("OrgaPersistence");
115:                                saveOrUpdateCommand = (SaveOrUpdateCommand)orgaCommandFactory.createCommand("save");
116:                                saveOrUpdateCommand.setObject(organisation);
117:                                saveOrUpdateCommand.execute();
118:
119:                                newOrganisation = new Organisation();
120:                                newOrganisation.setCreated(created);
121:                                newOrganisation.setCreatedBy(createdBy);
122:                                newOrganisation.setKey(name);
123:                                if (organisation.getRelations() != null)
124:                                    newOrganisation.setRelations(new ArrayList<String>(organisation.getRelations()));
125:                                if (organisation.getRoles() != null)
126:                                    newOrganisation.setRoles(new ArrayList<String>(organisation.getRoles()));
127:                                if (organisation.getMembers() != null)
128:                                newOrganisation.setMembers(copyMembers(organisation.getMembers()));
129:
130:                                saveOrUpdateCommand.setObject(newOrganisation);
131:                                saveOrUpdateCommand.execute();
132:
133:                                OrgaModel orgaModel = (OrgaModel)node.getModel();
134:                                RiskManagementLogic riskManagementLogic = orgaModel.getTreeLogic();
135:                                List<Group> groups = riskManagementLogic.all(organisation.getId());
136:                                copyGroups(groups);
137:
138:                                OrganisationTreeNode newOrganisationTreeNode = new OrganisationTreeNode(newOrganisation);
139:                                OrganisationsTreeNode parent = organisationTreeNode.getParent();
140:                                parent.insert(newOrganisationTreeNode, -1);
141:                            }
142:                            finally {
143:                                HibernateEnvironment.getInstance().endTransaction();
144:                            }
145:                        }
146:                    });
147:                }
148:
149:                private void copyGroups(List<Group> groups) {
150:                    groupMap = new HashMap<Long,Long>();
151:                    Collections.sort(groups, OrgaModel.PATH_LENGTH_COMPARATOR);
152:                    List<Group> copies = new ArrayList<Group>(groups.size());
153:
154:                    for (Group group : groups) {
155:                        newGroup = new Group();
156:                        newGroup.setCreated(created);
157:                        newGroup.setCreatedBy(createdBy);
158:                        newGroup.setKey(group.getKey());
159:                        newGroup.setIdentity(group.getIdentity());
160:                        newGroup.setTree(newOrganisation);
161:
162:                        saveOrUpdateCommand.setObject(newGroup);
163:                        saveOrUpdateCommand.execute();
164:
165:                        newGroup.setMemberships(copyMemberships(group.getMemberships()));
166:
167:                        groupMap.put(group.getId(), newGroup.getId());
168:                        newGroup.setPath(copyPath(group.getPath()));
169:                        copies.add(newGroup);
170:                    }
171:                }
172:
173:                private String copyPath(String path) {
174:                    StringBuilder newPath = new StringBuilder(path.length() * 2);
175:                    newPath.append('/');
176:                    for (StringTokenizer tokenizer = new StringTokenizer(path, "/"); tokenizer.hasMoreTokens();) {
177:                        String part = tokenizer.nextToken();
178:                        Long newPart = groupMap.get(new Long(part));
179:                        newPath.append(newPart);
180:                        newPath.append('/');
181:                    }
182:                    return newPath.toString();
183:                }
184:
185:                private List<Membership> copyMemberships(List<Membership> memberships) {
186:                    List<Membership> copies = new ArrayList<Membership>(memberships.size());
187:                    for (Membership membership : memberships) {
188:                        Membership newMembership = new Membership();
189:                        newMembership.setGroup(newGroup);
190:                        newMembership.setRole(membership.getRole());
191:                        newMembership.setMember(memberMap.get(membership.getMember()));
192:
193:                        saveOrUpdateCommand.setObject(newMembership);
194:                        saveOrUpdateCommand.execute();
195:
196:                        copies.add(newMembership);
197:                    }
198:                    return copies;
199:                }
200:
201:                private List<Member> copyMembers(List<Member> members) {
202:                    memberMap = new HashMap<Member,Member>();
203:                    List<Member> copies = new ArrayList<Member>(members.size());
204:                    for (Member member : members) {
205:                        Member newMember = new Member();
206:                        newMember.setCreated(created);
207:                        newMember.setCreatedBy(createdBy);
208:                        newMember.setIdentity(member.getIdentity());
209:                        newMember.setKey(name + "_" + member.getIdentity().getKey());
210:                        newMember.setTree(newOrganisation);
211:                        newMember.setRelationships(copyRelationShips(member.getRelationships()));
212:
213:                        saveOrUpdateCommand.setObject(newMember);
214:                        saveOrUpdateCommand.execute();
215:
216:                        memberMap.put(member, newMember);
217:                        copies.add(newMember);
218:                    }
219:                    return copies;
220:                }
221:
222:                private List<Relationship> copyRelationShips(List<Relationship> member) {
223:                    return null;
224:                }
225:            }
226:             */
227:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.