Source Code Cross Referenced for BORelationalEntityTableAssociationRoleImpl.java in  » UML » MetaBoss » com » metaboss » sdlctools » domains » storagemodel » impl » 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.domains.storagemodel.impl 
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.domains.storagemodel.impl;
016:
017:        import javax.naming.Context;
018:        import javax.naming.InitialContext;
019:        import javax.naming.NamingException;
020:
021:        import com.metaboss.enterprise.bo.BOException;
022:        import com.metaboss.enterprise.bo.BOInvalidOperationForReadOnlyObjectException;
023:        import com.metaboss.enterprise.bo.BONamingAndDirectoryServiceInvocationException;
024:        import com.metaboss.enterprise.bo.BOPersistenceServiceInvocationException;
025:        import com.metaboss.enterprise.ps.PSException;
026:        import com.metaboss.sdlctools.domains.storagemodel.BORelationalEntityTable;
027:        import com.metaboss.sdlctools.domains.storagemodel.BORelationalEntityTableAssociationRole;
028:        import com.metaboss.sdlctools.domains.storagemodel.storage.PSRelationalDomainStorage;
029:        import com.metaboss.sdlctools.domains.storagemodel.storage.STDomainStorageKey;
030:        import com.metaboss.sdlctools.domains.storagemodel.storage.STRelationalEntityTableAssociationRole;
031:        import com.oldboss.framework.bo.BOTransaction;
032:        import com.oldboss.framework.bo.impl.BOObjectImpl;
033:
034:        public class BORelationalEntityTableAssociationRoleImpl extends
035:                BOObjectImpl implements  BORelationalEntityTableAssociationRole {
036:            private BOMetaBossDomainImpl mMetaBossDomainImpl = null;
037:            private BORelationalEntityTable mEntityTable = null;
038:            private String mAssociationRoleRef = null;
039:            private STRelationalEntityTableAssociationRole mRelationalEntityTableAssociationRoleDetails = null;
040:
041:            /* Instance creator */
042:            public static BORelationalEntityTableAssociationRole createInstanceForExisting(
043:                    BOMetaBossDomainImpl pMetaBossDomainImpl,
044:                    BORelationalEntityTable pEntityTable,
045:                    String pAssociationRoleRef) throws BOException {
046:                BORelationalEntityTableAssociationRoleImpl lImpl = new BORelationalEntityTableAssociationRoleImpl();
047:                lImpl.setupInstanceForExisting(pMetaBossDomainImpl,
048:                        pEntityTable, pAssociationRoleRef);
049:                lImpl.setupForExisting();
050:                return lImpl;
051:            }
052:
053:            /* Instance creator */
054:            public static BORelationalEntityTableAssociationRole createInstanceForNew(
055:                    BOTransaction pTransaction,
056:                    BOMetaBossDomainImpl pMetaBossDomainImpl,
057:                    BORelationalEntityTable pEntityTable,
058:                    String pAssociationRoleRef) throws BOException {
059:                BORelationalEntityTableAssociationRoleImpl lImpl = new BORelationalEntityTableAssociationRoleImpl();
060:                lImpl.setupInstanceForNew(pMetaBossDomainImpl, pEntityTable,
061:                        pAssociationRoleRef);
062:                lImpl.setupForNew(pTransaction);
063:                return lImpl;
064:            }
065:
066:            /* Protect an access to this constructor */
067:            protected BORelationalEntityTableAssociationRoleImpl()
068:                    throws BOException {
069:            }
070:
071:            /* Setup instance representing an existing entity */
072:            protected void setupInstanceForExisting(
073:                    BOMetaBossDomainImpl pMetaBossDomainImpl,
074:                    BORelationalEntityTable pEntityTable,
075:                    String pAssociationRoleRef) throws BOException {
076:                mMetaBossDomainImpl = pMetaBossDomainImpl;
077:                mEntityTable = pEntityTable;
078:                mAssociationRoleRef = pAssociationRoleRef;
079:            }
080:
081:            /* Setup instance representing new entity */
082:            protected void setupInstanceForNew(
083:                    BOMetaBossDomainImpl pMetaBossDomainImpl,
084:                    BORelationalEntityTable pEntityTable,
085:                    String pAssociationRoleRef) throws BOException {
086:                mMetaBossDomainImpl = pMetaBossDomainImpl;
087:                mEntityTable = pEntityTable;
088:                mAssociationRoleRef = pAssociationRoleRef;
089:                mRelationalEntityTableAssociationRoleDetails = new STRelationalEntityTableAssociationRole();
090:                mRelationalEntityTableAssociationRoleDetails.AssociationRoleRef = pAssociationRoleRef;
091:            }
092:
093:            /* Retrieves associated attribute  ref */
094:            public String getAssociationRoleRef() throws BOException {
095:                return mAssociationRoleRef;
096:            }
097:
098:            /* Getter for the suggested name of the column */
099:            public String getInstanceIdColumnNameSuggestion()
100:                    throws BOException {
101:                loadDetailsIfNecessary();
102:                return mRelationalEntityTableAssociationRoleDetails.InstanceIdColumnNameSuggestion;
103:            }
104:
105:            /* Getter for the overriden name of the column */
106:            public String getInstanceIdColumnNameOverride() throws BOException {
107:                loadDetailsIfNecessary();
108:                return mRelationalEntityTableAssociationRoleDetails.InstanceIdColumnNameOverride;
109:            }
110:
111:            /* Getter for the suggested name of the referential constraint */
112:            public String getReferentialConstraintNameSuggestion()
113:                    throws BOException {
114:                loadDetailsIfNecessary();
115:                return mRelationalEntityTableAssociationRoleDetails.ReferentialConstraintNameSuggestion;
116:            }
117:
118:            /* Getter for the overriden name of the referential constraint */
119:            public String getReferentialConstraintNameOverride()
120:                    throws BOException {
121:                loadDetailsIfNecessary();
122:                return mRelationalEntityTableAssociationRoleDetails.ReferentialConstraintNameOverride;
123:            }
124:
125:            /* Setter for the suggested name of the column */
126:            public void setInstanceIdColumnNameSuggestion(String pName)
127:                    throws BOException {
128:                if (!isBeingEdited())
129:                    throw new BOInvalidOperationForReadOnlyObjectException();
130:                mRelationalEntityTableAssociationRoleDetails.InstanceIdColumnNameSuggestion = pName;
131:            }
132:
133:            /* Setter for the suggested name of the referential constraint */
134:            public void setReferentialConstraintNameSuggestion(String pName)
135:                    throws BOException {
136:                if (!isBeingEdited())
137:                    throw new BOInvalidOperationForReadOnlyObjectException();
138:                mRelationalEntityTableAssociationRoleDetails.ReferentialConstraintNameSuggestion = pName;
139:            }
140:
141:            /* Overridable method. Called when existing object enters being edited stage */
142:            protected void onBeginEdit() throws BOException {
143:                loadDetailsIfNecessary();
144:            }
145:
146:            /* Encapsulates commit action by this object */
147:            protected void onCommitUpdate() throws BOException {
148:                try {
149:                    Context ctx = new InitialContext();
150:                    PSRelationalDomainStorage lPs = (PSRelationalDomainStorage) ctx
151:                            .lookup(PSRelationalDomainStorage.COMPONENT_URL);
152:                    STDomainStorageKey lKey = new STDomainStorageKey();
153:                    lKey.StorageTechnologyRef = mEntityTable.getDomainStorage()
154:                            .getStorageTechnology().getRef();
155:                    lKey.DomainRef = mEntityTable.getDomainStorage()
156:                            .getDomainRef();
157:                    lPs.updateEntityTableAssociationRole(lKey, mEntityTable
158:                            .getEntityRef(),
159:                            mRelationalEntityTableAssociationRoleDetails);
160:                } catch (NamingException e) {
161:                    throw new BONamingAndDirectoryServiceInvocationException(
162:                            "", e);
163:                } catch (PSException e) {
164:                    throw new BOPersistenceServiceInvocationException("", e);
165:                }
166:            }
167:
168:            /* Encapsulates commit action by this object */
169:            protected void onCommitDeletion() throws BOException {
170:                try {
171:                    Context ctx = new InitialContext();
172:                    PSRelationalDomainStorage lPs = (PSRelationalDomainStorage) ctx
173:                            .lookup(PSRelationalDomainStorage.COMPONENT_URL);
174:                    STDomainStorageKey lKey = new STDomainStorageKey();
175:                    lKey.StorageTechnologyRef = mEntityTable.getDomainStorage()
176:                            .getStorageTechnology().getRef();
177:                    lKey.DomainRef = mEntityTable.getDomainStorage()
178:                            .getDomainRef();
179:                    lPs.deleteEntityTableAssociationRole(lKey, mEntityTable
180:                            .getEntityRef(), mAssociationRoleRef);
181:                } catch (NamingException e) {
182:                    throw new BONamingAndDirectoryServiceInvocationException(
183:                            "", e);
184:                } catch (PSException e) {
185:                    throw new BOPersistenceServiceInvocationException("", e);
186:                }
187:            }
188:
189:            /* Encapsulates commit action by this object */
190:            protected void onCommitCreation() throws BOException {
191:                try {
192:                    Context ctx = new InitialContext();
193:                    PSRelationalDomainStorage lPs = (PSRelationalDomainStorage) ctx
194:                            .lookup(PSRelationalDomainStorage.COMPONENT_URL);
195:                    STDomainStorageKey lKey = new STDomainStorageKey();
196:                    lKey.StorageTechnologyRef = mEntityTable.getDomainStorage()
197:                            .getStorageTechnology().getRef();
198:                    lKey.DomainRef = mEntityTable.getDomainStorage()
199:                            .getDomainRef();
200:                    lPs.insertEntityTableAssociationRole(lKey, mEntityTable
201:                            .getEntityRef(),
202:                            mRelationalEntityTableAssociationRoleDetails);
203:                } catch (NamingException e) {
204:                    throw new BONamingAndDirectoryServiceInvocationException(
205:                            "", e);
206:                } catch (PSException e) {
207:                    throw new BOPersistenceServiceInvocationException("", e);
208:                }
209:            }
210:
211:            private void loadDetailsIfNecessary() throws BOException {
212:                if (mRelationalEntityTableAssociationRoleDetails == null) {
213:                    try {
214:                        // Get the instance of the enterprise ps home via jndi
215:                        Context ctx = new InitialContext();
216:                        PSRelationalDomainStorage lPs = (PSRelationalDomainStorage) ctx
217:                                .lookup(PSRelationalDomainStorage.COMPONENT_URL);
218:                        STDomainStorageKey lKey = new STDomainStorageKey();
219:                        lKey.StorageTechnologyRef = mEntityTable
220:                                .getDomainStorage().getStorageTechnology()
221:                                .getRef();
222:                        lKey.DomainRef = mEntityTable.getDomainStorage()
223:                                .getDomainRef();
224:                        mRelationalEntityTableAssociationRoleDetails = lPs
225:                                .getEntityTableAssociationRole(lKey,
226:                                        mEntityTable.getEntityRef(),
227:                                        mAssociationRoleRef);
228:                        if (mRelationalEntityTableAssociationRoleDetails == null)
229:                            throw new BOException(
230:                                    "Entity Table Association Role column definition not found. StorageTechnologyRef: "
231:                                            + mEntityTable.getDomainStorage()
232:                                                    .getStorageTechnology()
233:                                                    .getRef()
234:                                            + " EntityRef: "
235:                                            + mEntityTable.getEntityRef()
236:                                            + " AssociationRoleRef: "
237:                                            + mAssociationRoleRef);
238:                    } catch (NamingException e) {
239:                        throw new BONamingAndDirectoryServiceInvocationException(
240:                                "", e);
241:                    } catch (PSException e) {
242:                        throw new BOPersistenceServiceInvocationException(
243:                                "Exception caught during loading of Entity Table Association Role column.  StorageTechnologyRef: "
244:                                        + mEntityTable.getDomainStorage()
245:                                                .getStorageTechnology()
246:                                                .getRef()
247:                                        + " AssociationRoleRef: "
248:                                        + mAssociationRoleRef, e);
249:                    }
250:                }
251:            }
252:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.