Source Code Cross Referenced for SourceAttributeHelper.java in  » UML » MetaBoss » com » metaboss » sdlctools » models » modelassistant » metabossmodel » domainsupport » 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.sdlctools.models.modelassistant.metabossmodel.domainsupport 
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.sdlctools.models.modelassistant.metabossmodel.domainsupport;
016:
017:        import java.util.HashSet;
018:        import java.util.Iterator;
019:        import java.util.Set;
020:
021:        import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.Servicemodule;
022:        import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.systemimplementationmodel.Attribute;
023:        import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.systemimplementationmodel.Domain;
024:        import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.systemimplementationmodel.Entity;
025:
026:        /** This class is looking after actions on attributes */
027:        class SourceAttributeHelper {
028:            private ModelAssistantImpl mModelAssistantImpl;
029:
030:            SourceAttributeHelper(ModelAssistantImpl pModelAssistantImpl) {
031:                mModelAssistantImpl = pModelAssistantImpl;
032:            }
033:
034:            // Handle the creation
035:            void onJustCreated(Attribute pAttribute) {
036:                String lAttributeName = pAttribute.getName();
037:                if (lAttributeName == null || lAttributeName.length() == 0)
038:                    return; // Attribute does not have a name
039:                Entity lEntity = pAttribute.getEntity();
040:                if (lEntity == null)
041:                    return; // Attribute is not associated with entity
042:                Domain lDomain = lEntity.getDomain();
043:                if (lDomain == null)
044:                    return; // Entity is not associated with domain
045:                com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.System lSystem = lDomain
046:                        .getSystem();
047:                if (lSystem == null)
048:                    return; // Domain is not associated with system
049:                String lDomainName = lDomain.getName();
050:                if (lDomainName == null || lDomainName.length() == 0)
051:                    return; // Domain does not have a name
052:                String lServicemoduleName = StylesheetImpl
053:                        .getDomainSupportServicemoduleName(lDomainName);
054:                Servicemodule lServicemodule = lSystem
055:                        .findServicemodule(lServicemoduleName);
056:                if (lServicemodule == null)
057:                    return; // There is no support servicemodule yet
058:                // We will have to work on the entity and all subtypes
059:                Set lAllEntitiesToConsider = new HashSet();
060:                lAllEntitiesToConsider.add(lEntity);
061:                lAllEntitiesToConsider.addAll(lEntity.getCombinedSubtypes());
062:                for (Iterator lEntityElementsIterator = lAllEntitiesToConsider
063:                        .iterator(); lEntityElementsIterator.hasNext();) {
064:                    Entity lEntityElement = (Entity) lEntityElementsIterator
065:                            .next();
066:                    String lEntityName = lEntityElement.getName();
067:                    if (lEntityName == null || lEntityName.length() == 0)
068:                        continue; // Entity does not have a name
069:                    // Attribute may need to be put to the key structure immediately
070:                    if (lEntityElement.getPrimaryKeyElements().contains(
071:                            pAttribute)) {
072:                        mModelAssistantImpl.mTargetEntityKeyStructureHelper
073:                                .primaryKeyAttribute_EnsurePresent(
074:                                        lServicemodule, lEntityElement,
075:                                        lAttributeName, pAttribute
076:                                                .getDescription(), pAttribute
077:                                                .getDataType());
078:                        mModelAssistantImpl.mTargetDuplicateCreateFailedMessageHelper
079:                                .primaryKeyAttribute_EnsurePresent(
080:                                        lServicemodule, lEntityElement,
081:                                        lAttributeName, pAttribute
082:                                                .getDataType());
083:                    } else {
084:                        mModelAssistantImpl.mTargetEntityKeyStructureHelper
085:                                .primaryKeyAttribute_EnsureAbsent(
086:                                        lServicemodule, lEntityElement,
087:                                        lAttributeName);
088:                        mModelAssistantImpl.mTargetDuplicateCreateFailedMessageHelper
089:                                .primaryKeyAttribute_EnsureAbsent(
090:                                        lServicemodule, lEntityElement,
091:                                        lAttributeName);
092:                    }
093:                }
094:            }
095:
096:            // Handle the deletion
097:            void onDeleting(Attribute pAttribute) {
098:                String lAttributeName = pAttribute.getName();
099:                if (lAttributeName == null || lAttributeName.length() == 0)
100:                    return; // Attribute does not have a name
101:                Entity lEntity = pAttribute.getEntity();
102:                if (lEntity == null)
103:                    return; // Attribute is not associated with entity
104:                Domain lDomain = lEntity.getDomain();
105:                if (lDomain == null)
106:                    return; // Entity is not associated with domain
107:                com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.System lSystem = lDomain
108:                        .getSystem();
109:                if (lSystem == null)
110:                    return; // Domain is not associated with system
111:                String lDomainName = lDomain.getName();
112:                if (lDomainName == null || lDomainName.length() == 0)
113:                    return; // Domain does not have a name yet
114:                String lServicemoduleName = StylesheetImpl
115:                        .getDomainSupportServicemoduleName(lDomainName);
116:                Servicemodule lServicemodule = lSystem
117:                        .findServicemodule(lServicemoduleName);
118:                if (lServicemodule == null)
119:                    return; // There is no support servicemodule yet
120:                // We will have to work on the entity and all subtypes
121:                Set lAllEntitiesToConsider = new HashSet();
122:                lAllEntitiesToConsider.add(lEntity);
123:                lAllEntitiesToConsider.addAll(lEntity.getCombinedSubtypes());
124:                for (Iterator lEntityElementsIterator = lAllEntitiesToConsider
125:                        .iterator(); lEntityElementsIterator.hasNext();) {
126:                    Entity lEntityElement = (Entity) lEntityElementsIterator
127:                            .next();
128:                    String lEntityName = lEntityElement.getName();
129:                    if (lEntityName == null || lEntityName.length() == 0)
130:                        continue; // Entity does not have a name
131:                    // Attribute is being deleted. Make sure it is not present in the key and details structures
132:                    mModelAssistantImpl.mTargetEntityKeyStructureHelper
133:                            .primaryKeyAttribute_EnsureAbsent(lServicemodule,
134:                                    lEntityElement, lAttributeName);
135:                    mModelAssistantImpl.mTargetDuplicateCreateFailedMessageHelper
136:                            .primaryKeyAttribute_EnsureAbsent(lServicemodule,
137:                                    lEntityElement, lAttributeName);
138:                }
139:            }
140:        }
ww___w__.___j_a__v_a__2__s.___c__o__m_ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.