Source Code Cross Referenced for PrimaryKeyElementUserObject.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.util.Collection;
018:
019:        import com.metaboss.applications.designstudio.Application;
020:        import com.metaboss.applications.designstudio.BasePropertiesDialog;
021:        import com.metaboss.applications.designstudio.BaseUserObject;
022:        import com.metaboss.applications.designstudio.propertiesdialogs.PrimaryKeyPropertiesDialog;
023:        import com.metaboss.applications.designstudio.propertiesview.PropertiesTableModel;
024:        import com.metaboss.sdlctools.models.metabossmodel.ModelElement;
025:        import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.systemimplementationmodel.AssociationRole;
026:        import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.systemimplementationmodel.Attribute;
027:        import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.systemimplementationmodel.Entity;
028:        import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.systemimplementationmodel.PrimaryKeyElement;
029:
030:        /* 		BOPrimaryKeyElement user object class		*/
031:
032:        public class PrimaryKeyElementUserObject extends BaseUserObject {
033:            private PrimaryKeyElement mObject = null;
034:            private Entity mEntity = null;
035:            private BaseUserObject mUserObject = null;
036:
037:            public PrimaryKeyElementUserObject(PrimaryKeyElement pObject) {
038:                super (pObject, Application.PRIMARYKEY_ICON);
039:                mObject = pObject;
040:                if (mObject instanceof  AssociationRole) {
041:                    AssociationRole lAssociation = (AssociationRole) mObject;
042:                    mUserObject = new AssociationRoleUserObject(lAssociation);
043:                } else if (mObject instanceof  Attribute) {
044:                    Attribute lAttribute = (Attribute) mObject;
045:                    mUserObject = new AttributeUserObject(lAttribute);
046:                }
047:            }
048:
049:            // create new primary key element
050:            public static void addNewPrimaryKeyElement(Entity pEntity)
051:                    throws Exception {
052:                PrimaryKeyElementUserObject lObject = new PrimaryKeyElementUserObject(
053:                        null);
054:                lObject.mEntity = pEntity;
055:                lObject.addNewObject(pEntity.getPrimaryKeyElements());
056:            }
057:
058:            // add new primary key element
059:            public static void createNewPrimaryKeyElement(Entity pEntity,
060:                    ModelElement pElement) throws Exception {
061:                if (pEntity == null || pElement == null)
062:                    return;
063:
064:                Application.beginTransaction();
065:                try {
066:                    pEntity.getPrimaryKeyElements().add(pElement);
067:                    Application.commit();
068:                } finally {
069:                    Application.checkAndRollback();
070:                }
071:            }
072:
073:            // delete primary key element
074:            public static void deletePrimaryKeyElement(Entity pEntity,
075:                    ModelElement pElement) throws Exception {
076:                if (pEntity == null || pElement == null)
077:                    return;
078:
079:                Application.beginTransaction();
080:                try {
081:                    pEntity.getPrimaryKeyElements().remove(pElement);
082:                    Application.commit();
083:                } finally {
084:                    Application.checkAndRollback();
085:                }
086:            }
087:
088:            // add new object
089:            public BaseUserObject addNewObject(Collection pMasterCollection)
090:                    throws Exception {
091:                BaseUserObject lResult = null;
092:                PrimaryKeyPropertiesDialog lDialog = new PrimaryKeyPropertiesDialog();
093:                if (lDialog != null) {
094:                    Application.beginTransaction();
095:                    try {
096:                        lDialog.loadProperties(mEntity);
097:                        if (lDialog.getModalResult() == BasePropertiesDialog.MR_OK) {
098:                            PrimaryKeyElement lElement = lDialog
099:                                    .getPrimaryKeyElement();
100:                            if (lElement != null && pMasterCollection != null)
101:                                pMasterCollection.add(lElement);
102:                            Application.commit();
103:                            lResult = new PrimaryKeyElementUserObject(lElement);
104:                            Application.fireObjectInserted(lResult);
105:                        }
106:                    } finally {
107:                        Application.checkAndRollback();
108:                    }
109:                }
110:                return lResult;
111:            }
112:
113:            /*public BaseUserObject addNewObject() throws Exception
114:            {
115:            	Collection lList = null;
116:            	if (mObject instanceof AssociationRole)
117:            	{
118:            		AssociationRole lAssociation = (AssociationRole)mObject;
119:            		lList = (lAssociation!=null) ? lAssociation.getEntity().getPrimaryKeyElements() : null; 
120:            	}	else
121:            	if (mObject instanceof Attribute)
122:            	{
123:            		Attribute lAttribute = (Attribute)mObject;
124:            		lList = (lAttribute!=null) ? lAttribute.getEntity().getPrimaryKeyElements() : null;
125:            	}
126:            	return addNewObject(lList);
127:            }*/
128:
129:            // delete object
130:            public void deleteObject() throws Exception {
131:                if (mObject == null)
132:                    return;
133:
134:                Application.beginTransaction();
135:                try {
136:                    Collection lList = null;
137:                    if (mObject instanceof  AssociationRole) {
138:                        AssociationRole lAssociation = (AssociationRole) mObject;
139:                        lList = (lAssociation != null) ? lAssociation
140:                                .getEntity().getPrimaryKeyElements() : null;
141:                    } else if (mObject instanceof  Attribute) {
142:                        Attribute lAttribute = (Attribute) mObject;
143:                        lList = (lAttribute != null) ? lAttribute.getEntity()
144:                                .getPrimaryKeyElements() : null;
145:                    }
146:                    if (lList != null)
147:                        lList.remove(mObject);
148:                    mObject = null;
149:                    Application.commit();
150:                } finally {
151:                    Application.checkAndRollback();
152:                }
153:                Application.fireObjectDeleted(this );
154:            }
155:
156:            public String toString() {
157:                if (mUserObject != null)
158:                    return mUserObject.toString();
159:                else
160:                    return null;
161:            }
162:
163:            public PrimaryKeyElement getObject() {
164:                return mObject;
165:            }
166:
167:            // return object root node captions
168:            public String getRootNodeName() {
169:                return Application.getString("primarykeyelements_node");
170:            }
171:
172:            public BasePropertiesDialog getObjectEditor() {
173:                if (mUserObject != null)
174:                    return mUserObject.getObjectEditor();
175:                else
176:                    return new PrimaryKeyPropertiesDialog();
177:            }
178:
179:            // load object properties into grid control
180:            public void loadObjectProperties(PropertiesTableModel pModel)
181:                    throws Exception {
182:                //super.loadObjectProperties(pModel);
183:                if (pModel == null || mUserObject == null)
184:                    return;
185:                mUserObject.loadObjectProperties(pModel);
186:            }
187:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.