Source Code Cross Referenced for ServicemoduleUserObject.java in  » UML » MetaBoss » com » metaboss » applications » designstudio » userobjects » 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 » UML » MetaBoss » com.metaboss.applications.designstudio.userobjects 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // THIS SOFTWARE IS PROVIDED BY SOFTARIS PTY.LTD. AND OTHER METABOSS
002:        // CONTRIBUTORS ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING,
003:        // BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
004:        // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SOFTARIS PTY.LTD.
005:        // OR OTHER METABOSS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
006:        // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
007:        // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
008:        // OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
009:        // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
010:        // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
011:        // EVEN IF SOFTARIS PTY.LTD. OR OTHER METABOSS CONTRIBUTORS ARE ADVISED OF THE
012:        // POSSIBILITY OF SUCH DAMAGE.
013:        //
014:        // Copyright 2000-2005 © Softaris Pty.Ltd. All Rights Reserved.
015:        package com.metaboss.applications.designstudio.userobjects;
016:
017:        import java.awt.event.ActionEvent;
018:        import java.util.ArrayList;
019:        import java.util.Iterator;
020:        import java.util.SortedSet;
021:
022:        import com.metaboss.applications.designstudio.Application;
023:        import com.metaboss.applications.designstudio.BaseAction;
024:        import com.metaboss.applications.designstudio.BasePropertiesDialog;
025:        import com.metaboss.applications.designstudio.BaseUserObject;
026:        import com.metaboss.applications.designstudio.auxilarydialogs.DiagramSelectDialog;
027:        import com.metaboss.applications.designstudio.components.SeparatorAction;
028:        import com.metaboss.applications.designstudio.propertiesdialogs.SimpleObjectPropertiesdialog;
029:        import com.metaboss.applications.designstudio.structuresmodel.StructuresPanel;
030:        import com.metaboss.sdlctools.models.metabossmodel.MetaBossModelPackage;
031:        import com.metaboss.sdlctools.models.metabossmodel.ModelElementUtils;
032:        import com.metaboss.sdlctools.models.metabossmodel.datadictionarymodel.Structure;
033:        import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.EnterpriseModelPackage;
034:        import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.EventSubscription;
035:        import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.Message;
036:        import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.Service;
037:        import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.Servicemodule;
038:        import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.ServicemoduleClass;
039:        import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.System;
040:        import com.metaboss.sdlctools.models.metabossmodel.visualmodel.ServicemoduleStructuresDiagram;
041:
042:        /*		BOServiceModule user object class		*/
043:
044:        public class ServicemoduleUserObject extends BaseUserObject {
045:            public static final int ADD_SERVICE = 1;
046:            public static final int ADD_MESSAGE = 2;
047:            public static final int ADD_STRUCTURE = 3;
048:            public static final int ADD_EVENTESUBSCRIPTION = 4;
049:            public static final int ADD_DIAGRAM = 5;
050:
051:            private Servicemodule mServiceModule = null;
052:            private StructuresDiagramAction mStructuresDiagramAction = new StructuresDiagramAction();
053:            private AddNewServiceModuleServiceAction mAddServiceModuleAction = new AddNewServiceModuleServiceAction();
054:            private AddMessageAction mAddMessageAction = new AddMessageAction();
055:            private AddStructureAction mAddStructureAction = new AddStructureAction();
056:            private AddEventSubscriptionAction mAddEventSubscriptionAction = new AddEventSubscriptionAction();
057:            private AddDiagramAction mAddDiagramAction = new AddDiagramAction();
058:            private StudyDependenciesAction mShowDataTypeDependenciesAction = new StudyDependenciesAction();
059:
060:            public ServicemoduleUserObject(Servicemodule pServicemodule) {
061:                super (pServicemodule, Application.SERVICEMODULE_ICON);
062:                mServiceModule = pServicemodule;
063:            }
064:
065:            public ServicemoduleUserObject(Servicemodule pServicemodule,
066:                    String pCaption, int pMode) {
067:                super (pServicemodule, pCaption, pMode);
068:                mServiceModule = pServicemodule;
069:            }
070:
071:            // create new service module
072:            public static void addNewServiceModule(System pSystem)
073:                    throws Exception {
074:                new ServicemoduleUserObject(null).addNewObject(
075:                        getObjectPackage(pSystem), pSystem.getServicemodules());
076:            }
077:
078:            public BaseUserObject createNewObject(MetaBossModelPackage pPackage) {
079:                EnterpriseModelPackage lEnterpriseModelPackage = pPackage
080:                        .getEnterpriseModel();
081:                ServicemoduleClass lClass = lEnterpriseModelPackage
082:                        .getServicemodule();
083:                return new ServicemoduleUserObject(lClass.createServicemodule());
084:            }
085:
086:            // return object root node captions
087:            public String getRootNodeName() {
088:                return Application.getString("publicinterfaces_node") + "."
089:                        + Application.getString("servicemodules_node");
090:            }
091:
092:            public Servicemodule getServiceModule() {
093:                return mServiceModule;
094:            }
095:
096:            // fill actions list
097:            public void fillActionsList(ArrayList pList) {
098:                switch (mMode) {
099:                case ALL_ACTIONS:
100:                    super .fillActionsList(pList);
101:                    pList.add(new SeparatorAction());
102:                    pList.add(mStructuresDiagramAction);
103:                    pList.add(new SeparatorAction());
104:                    pList.add(mAddMessageAction);
105:                    pList.add(mAddServiceModuleAction);
106:                    pList.add(mAddStructureAction);
107:                    pList.add(mAddEventSubscriptionAction);
108:                    pList.add(mAddDiagramAction);
109:                    pList.add(new SeparatorAction());
110:                    pList.add(mShowDataTypeDependenciesAction);
111:                    break;
112:                case ADD_SERVICE:
113:                    pList.add(mAddServiceModuleAction);
114:                    break;
115:                case ADD_MESSAGE:
116:                    pList.add(mAddMessageAction);
117:                    break;
118:                case ADD_STRUCTURE:
119:                    pList.add(mAddStructureAction);
120:                    break;
121:                case ADD_EVENTESUBSCRIPTION:
122:                    pList.add(mAddEventSubscriptionAction);
123:                    break;
124:                case ADD_DIAGRAM:
125:                    pList.add(mAddDiagramAction);
126:                    break;
127:                }
128:            }
129:
130:            // get object editor
131:            public BasePropertiesDialog getObjectEditor() {
132:                return new SimpleObjectPropertiesdialog("Service Module");
133:            }
134:
135:            // convert tree element to an action code
136:            public int convertCaptionToAction(String pCaption) {
137:                if (pCaption.equals(Application.getString("services_node")))
138:                    return ADD_SERVICE;
139:                else if (pCaption
140:                        .equals(Application.getString("messages_node")))
141:                    return ADD_MESSAGE;
142:                else if (pCaption.equals(Application
143:                        .getString("structures_node")))
144:                    return ADD_STRUCTURE;
145:                else if (pCaption.equals(Application
146:                        .getString("eventsubscriptions_node")))
147:                    return ADD_EVENTESUBSCRIPTION;
148:                else if (pCaption
149:                        .equals(Application.getString("diagrams_node")))
150:                    return ADD_DIAGRAM;
151:                else
152:                    return super .convertCaptionToAction(pCaption);
153:            }
154:
155:            // add new service module service
156:            public void addNewServiceModuleService() throws Exception {
157:                ServiceUserObject.addNewService(mServiceModule);
158:            }
159:
160:            // add new service module service
161:            public void addNewMessage() throws Exception {
162:                MessageUserObject.addNewMessage(mServiceModule);
163:            }
164:
165:            // add new structure
166:            public void addNewStructure() throws Exception {
167:                StructureUserObject.addNewStructure(mServiceModule);
168:            }
169:
170:            // add new event subscription
171:            public void addNewEventSubscription() throws Exception {
172:                EventSubscriptionUserObject
173:                        .addNewEventSubscription(mServiceModule);
174:            }
175:
176:            // show structures diagram
177:            private void showStructuresDiagram() {
178:                if (mServiceModule == null)
179:                    return;
180:
181:                try {
182:                    SortedSet lDiagrams = ModelElementUtils
183:                            .getSetOfModelElementsInAlphabeticalOrder(mServiceModule
184:                                    .getServicemoduleStructuresDiagrams());
185:                    if (lDiagrams != null) {
186:                        if (lDiagrams.size() == 0) {
187:                            ServicemoduleStructuresDiagramUserObject lDiagramObject = ServicemoduleStructuresDiagramUserObject
188:                                    .addNewServicemoduleStructuresDiagram(mServiceModule);
189:                            if (lDiagramObject != null)
190:                                lDiagramObject.viewDiagram();
191:                        } else if (lDiagrams.size() == 1) {
192:                            ServicemoduleStructuresDiagram lDiagram = (ServicemoduleStructuresDiagram) lDiagrams
193:                                    .first();
194:                            Application.fireShowContainer(new StructuresPanel(
195:                                    lDiagram), this ,
196:                                    Application.CLASSDIAGRAM_ICON);
197:                        } else {
198:                            ArrayList lDiagramsArray = new ArrayList();
199:                            for (Iterator lIterator = lDiagrams.iterator(); lIterator
200:                                    .hasNext();) {
201:                                ServicemoduleStructuresDiagram lDiagram = (ServicemoduleStructuresDiagram) lIterator
202:                                        .next();
203:                                lDiagramsArray
204:                                        .add(new ServicemoduleStructuresDiagramUserObject(
205:                                                lDiagram));
206:                            }
207:                            DiagramSelectDialog lDialog = new DiagramSelectDialog(
208:                                    Application.mainFrame, lDiagramsArray);
209:                            if (lDialog.getModalResult() == DiagramSelectDialog.MR_OK) {
210:                                for (int i = 0; i < lDiagramsArray.size(); i++) {
211:                                    ServicemoduleStructuresDiagramUserObject lServicemoduleStructuresDiagramUserObject = (ServicemoduleStructuresDiagramUserObject) lDiagramsArray
212:                                            .get(i);
213:                                    Application
214:                                            .fireShowContainer(
215:                                                    new StructuresPanel(
216:                                                            lServicemoduleStructuresDiagramUserObject
217:                                                                    .getServicemoduleStructuresDiagram()),
218:                                                    this ,
219:                                                    Application.CLASSDIAGRAM_ICON);
220:                                }
221:                            }
222:                        }
223:                    }
224:                } catch (Exception e) {
225:                    e.printStackTrace();
226:                }
227:            }
228:
229:            // add new diagram
230:            protected void addNewDiagram() {
231:                try {
232:                    ServicemoduleStructuresDiagramUserObject
233:                            .addNewServicemoduleStructuresDiagram(mServiceModule);
234:                } catch (Throwable t) {
235:                    Application.processError(t);
236:                }
237:            }
238:
239:            // returns true if drop object could be accepted
240:            public boolean canAcceptDropObject(BaseUserObject pUserObject,
241:                    boolean pCopy) {
242:                if (pUserObject != null
243:                        && super .canAcceptDropObject(pUserObject, pCopy)) {
244:                    if ((pUserObject instanceof  ServiceUserObject && (mMode == BaseUserObject.ALL_ACTIONS || mMode == ServicemoduleUserObject.ADD_SERVICE))
245:                            || (pUserObject instanceof  MessageUserObject && (mMode == BaseUserObject.ALL_ACTIONS || mMode == ServicemoduleUserObject.ADD_MESSAGE))
246:                            || (pUserObject instanceof  EventSubscriptionUserObject && (mMode == BaseUserObject.ALL_ACTIONS || mMode == ServicemoduleUserObject.ADD_EVENTESUBSCRIPTION))
247:                            || (pUserObject instanceof  StructureUserObject && (mMode == BaseUserObject.ALL_ACTIONS || mMode == ServicemoduleUserObject.ADD_STRUCTURE))) {
248:                        return (pCopy) ? pUserObject.canDuplicate() : true;
249:                    }
250:                }
251:                return false;
252:            }
253:
254:            // acccept drop target in transaction
255:            protected void transactionalAccept(BaseUserObject pUserObject,
256:                    boolean pCopy) throws Exception {
257:                if (pUserObject != null) {
258:                    if (pUserObject instanceof  ServiceUserObject) {
259:                        ServiceUserObject lUserObject = (ServiceUserObject) pUserObject;
260:                        if (pCopy) {
261:                            Service lService = (Service) Application.sModelRepository
262:                                    .duplicateModelElement(lUserObject
263:                                            .getService());
264:                            lService.setServicemodule(mServiceModule);
265:                        } else
266:                            lUserObject.getService().setServicemodule(
267:                                    mServiceModule);
268:                    } else if (pUserObject instanceof  MessageUserObject) {
269:                        MessageUserObject lUserObject = (MessageUserObject) pUserObject;
270:                        if (pCopy) {
271:                            Message lMessage = (Message) Application.sModelRepository
272:                                    .duplicateModelElement(lUserObject
273:                                            .getMessage());
274:                            lMessage.setServicemodule(mServiceModule);
275:                        } else {
276:                            lUserObject.getMessage().setNamespace(null);
277:                            lUserObject.getMessage().setServicemodule(
278:                                    mServiceModule);
279:                        }
280:                    } else if (pUserObject instanceof  StructureUserObject) {
281:                        StructureUserObject lUserObject = (StructureUserObject) pUserObject;
282:                        if (pCopy) {
283:                            Structure lStructure = (Structure) Application.sModelRepository
284:                                    .duplicateModelElement(lUserObject
285:                                            .getStructure());
286:                            lStructure.setServicemodule(mServiceModule);
287:                        } else {
288:                            // Ensure that all other possible owners are set to null
289:                            lUserObject.getStructure().setNamespace(null);
290:                            lUserObject.getStructure().setServicemodule(
291:                                    mServiceModule);
292:                        }
293:                    } else if (pUserObject instanceof  EventSubscriptionUserObject) {
294:                        EventSubscriptionUserObject lUserObject = (EventSubscriptionUserObject) pUserObject;
295:                        if (pCopy) {
296:                            EventSubscription lEventSubscription = (EventSubscription) Application.sModelRepository
297:                                    .duplicateModelElement(lUserObject
298:                                            .getEventSubscription());
299:                            lEventSubscription.setServicemodule(mServiceModule);
300:                        } else
301:                            lUserObject.getEventSubscription()
302:                                    .setServicemodule(mServiceModule);
303:                    }
304:                }
305:            }
306:
307:            /*				Actions				*/
308:
309:            /*		Structures Diagram 			*/
310:
311:            public class StructuresDiagramAction extends BaseAction {
312:                public StructuresDiagramAction() {
313:                    super (Application.getString("view_structuresdiagram"),
314:                            Application.CLASSDIAGRAM_ICON);
315:                }
316:
317:                public void actionPerformed(ActionEvent arg0) {
318:                    showStructuresDiagram();
319:                }
320:            }
321:
322:            public class AddNewServiceModuleServiceAction extends BaseAction {
323:                public AddNewServiceModuleServiceAction() {
324:                    super ("Add New Service", Application
325:                            .getAddIcon(Application.SERVICEMODULE_ICON));
326:                }
327:
328:                public void actionPerformed(ActionEvent e) {
329:                    try {
330:                        addNewServiceModuleService();
331:                    } catch (Throwable t) {
332:                        t.printStackTrace();
333:                    }
334:                }
335:            }
336:
337:            public class AddMessageAction extends BaseAction {
338:                public AddMessageAction() {
339:                    super ("Add New Message", Application
340:                            .getAddIcon(Application.MESSAGE_ICON));
341:                }
342:
343:                public void actionPerformed(ActionEvent e) {
344:                    try {
345:                        addNewMessage();
346:                    } catch (Throwable t) {
347:                        t.printStackTrace();
348:                    }
349:                }
350:            }
351:
352:            public class AddStructureAction extends BaseAction {
353:                public AddStructureAction() {
354:                    super ("Add New Structure", Application
355:                            .getAddIcon(Application.STRUCTURE_ICON));
356:                }
357:
358:                public void actionPerformed(ActionEvent e) {
359:                    try {
360:                        addNewStructure();
361:                    } catch (Throwable t) {
362:                        t.printStackTrace();
363:                    }
364:                }
365:            }
366:
367:            public class AddEventSubscriptionAction extends BaseAction {
368:                public AddEventSubscriptionAction() {
369:                    super ("Add New Event Subscription", Application
370:                            .getAddIcon(Application.EVENTSUBSCRIPTION_ICON));
371:                }
372:
373:                public void actionPerformed(ActionEvent e) {
374:                    try {
375:                        addNewEventSubscription();
376:                    } catch (Throwable t) {
377:                        t.printStackTrace();
378:                    }
379:                }
380:            }
381:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.