Source Code Cross Referenced for AssociationRoleImpl.java in  » UML » MetaBoss » com » metaboss » sdlctools » models » impl » metabossmodel » enterprisemodel » systemimplementationmodel » 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.impl.metabossmodel.enterprisemodel.systemimplementationmodel 
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.impl.metabossmodel.enterprisemodel.systemimplementationmodel;
016:
017:        import java.util.Collection;
018:        import java.util.List;
019:
020:        import javax.jmi.reflect.ConstraintViolationException;
021:
022:        import org.apache.commons.logging.Log;
023:        import org.apache.commons.logging.LogFactory;
024:        import org.netbeans.mdr.storagemodel.StorableObject;
025:
026:        import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.systemimplementationmodel.AggregationType;
027:        import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.systemimplementationmodel.AggregationTypeEnum;
028:        import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.systemimplementationmodel.Association;
029:        import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.systemimplementationmodel.AssociationRole;
030:        import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.systemimplementationmodel.AssociationRoleCardinality;
031:        import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.systemimplementationmodel.AssociationRoleCardinalityEnum;
032:        import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.systemimplementationmodel.Entity;
033:
034:        public abstract class AssociationRoleImpl extends PrimaryKeyElementImpl
035:                implements  AssociationRole {
036:            // Commons Logging instance.
037:            private static final Log sLogger = LogFactory
038:                    .getLog(AssociationRoleImpl.class);
039:
040:            // Required constructor
041:            protected AssociationRoleImpl(StorableObject storable) {
042:                super (storable);
043:            }
044:
045:            // Verify certain constraints
046:            protected Collection _verify(Collection pViolations) {
047:                // First call superclass
048:                Collection lViolations = super ._verify(pViolations);
049:
050:                // Constraint #1 - the association role with aggregation type of composition
051:                // can only have 'one and only one' multiplicity
052:                {
053:                    AggregationType lAssociationRoleAggregationType = getAggregationType();
054:                    if (lAssociationRoleAggregationType != null
055:                            && lAssociationRoleAggregationType
056:                                    .equals(AggregationTypeEnum.COMPOSITION)) {
057:                        if (!getCardinality().equals(
058:                                AssociationRoleCardinalityEnum.ONE))
059:                            lViolations
060:                                    .add(new ConstraintViolationException(
061:                                            this ,
062:                                            refMetaObject(),
063:                                            "AssociationRole with aggregation type of 'Composition' has unsupported cardinality. Only 'exactly one' cardinality is supported."));
064:                    }
065:                }
066:                return lViolations;
067:            }
068:
069:            // Returns true if this association has plural cardinality 
070:            public boolean isPlural() {
071:                AssociationRoleCardinality lCardinality = getCardinality();
072:                return lCardinality != null
073:                        && (lCardinality
074:                                .equals(AssociationRoleCardinalityEnum.ZERO_TO_MANY) || lCardinality
075:                                .equals(AssociationRoleCardinalityEnum.ONE_TO_MANY));
076:            }
077:
078:            // Returns true if this association has singular cardinality 
079:            public boolean isSingular() {
080:                AssociationRoleCardinality lCardinality = getCardinality();
081:                return lCardinality != null
082:                        && (lCardinality
083:                                .equals(AssociationRoleCardinalityEnum.ZERO_OR_ONE) || lCardinality
084:                                .equals(AssociationRoleCardinalityEnum.ONE));
085:            }
086:
087:            // Returns true if this association has optional cardinality 
088:            public boolean isOptional() {
089:                AssociationRoleCardinality lCardinality = getCardinality();
090:                return lCardinality != null
091:                        && (lCardinality
092:                                .equals(AssociationRoleCardinalityEnum.ZERO_TO_MANY) || lCardinality
093:                                .equals(AssociationRoleCardinalityEnum.ZERO_OR_ONE));
094:            }
095:
096:            // Returns true if this association has mandatory cardinality 
097:            public boolean isMandatory() {
098:                AssociationRoleCardinality lCardinality = getCardinality();
099:                return lCardinality != null
100:                        && (lCardinality
101:                                .equals(AssociationRoleCardinalityEnum.ONE_TO_MANY) || lCardinality
102:                                .equals(AssociationRoleCardinalityEnum.ONE));
103:            }
104:
105:            /** Returns the role on the other side of the association */
106:            public AssociationRole getOppositeRole() {
107:                Association lAssociation = ((AssociationRole) this )
108:                        .getAssociation();
109:                if (lAssociation == null)
110:                    return null; // Model has a problem unable to get the opposite role
111:                List lAssociationRoles = lAssociation.getRoles();
112:                if (lAssociationRoles.size() != 2)
113:                    return null; // Model has a problem unable to get the opposite role
114:                int lOppositeRoleIndex = lAssociationRoles.indexOf(this ) == 0 ? 1
115:                        : 0;
116:                return (AssociationRole) lAssociationRoles
117:                        .get(lOppositeRoleIndex);
118:            }
119:
120:            /** Returns the entity, which references this role. In other words - an entity playing the opposite role in the association */
121:            public Entity getReferencingEntity() {
122:                AssociationRole lOppositeRole = getOppositeRole();
123:                return lOppositeRole != null ? lOppositeRole.getEntity() : null;
124:            }
125:        }
w___w__w__.__j__a__v__a2_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.