Source Code Cross Referenced for BORelationalAssociationTableImpl.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.BORelationalAssociationTable;
027:        import com.metaboss.sdlctools.domains.storagemodel.BORelationalDomainStorage;
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.STRelationalAssociationTable;
031:        import com.oldboss.framework.bo.BOTransaction;
032:
033:        public class BORelationalAssociationTableImpl extends
034:                BOStorageTechnologyImpl implements  BORelationalAssociationTable {
035:            private BOMetaBossDomainImpl mMetaBossDomainImpl = null;
036:            private BORelationalDomainStorage mDomainStorage = null;
037:            private String mAssociationRef = null;
038:            private STRelationalAssociationTable mRelationalAssociationTableDetails = null;
039:
040:            /* Instance creator */
041:            public static BORelationalAssociationTable createInstanceForExisting(
042:                    BOMetaBossDomainImpl pMetaBossDomainImpl,
043:                    BORelationalDomainStorage pDomainStorage,
044:                    String pAssociationRef) throws BOException {
045:                BORelationalAssociationTableImpl lImpl = new BORelationalAssociationTableImpl();
046:                lImpl.setupInstanceForExisting(pMetaBossDomainImpl,
047:                        pDomainStorage, pAssociationRef);
048:                lImpl.setupForExisting();
049:                return lImpl;
050:            }
051:
052:            /* Instance creator */
053:            public static BORelationalAssociationTable createInstanceForNew(
054:                    BOTransaction pTransaction,
055:                    BOMetaBossDomainImpl pMetaBossDomainImpl,
056:                    BORelationalDomainStorage pDomainStorage,
057:                    String pAssociationRef) throws BOException {
058:                BORelationalAssociationTableImpl lImpl = new BORelationalAssociationTableImpl();
059:                lImpl.setupInstanceForNew(pMetaBossDomainImpl, pDomainStorage,
060:                        pAssociationRef);
061:                lImpl.setupForNew(pTransaction);
062:                return lImpl;
063:            }
064:
065:            /* Protect an access to this constructor */
066:            protected BORelationalAssociationTableImpl() throws BOException {
067:            }
068:
069:            /* Setup instance representing an existing entity */
070:            protected void setupInstanceForExisting(
071:                    BOMetaBossDomainImpl pMetaBossDomainImpl,
072:                    BORelationalDomainStorage pDomainStorage,
073:                    String pAssociationRef) throws BOException {
074:                mMetaBossDomainImpl = pMetaBossDomainImpl;
075:                mDomainStorage = pDomainStorage;
076:                mAssociationRef = pAssociationRef;
077:            }
078:
079:            /* Setup instance representing new entity */
080:            protected void setupInstanceForNew(
081:                    BOMetaBossDomainImpl pMetaBossDomainImpl,
082:                    BORelationalDomainStorage pDomainStorage,
083:                    String pAssociationRef) throws BOException {
084:                mMetaBossDomainImpl = pMetaBossDomainImpl;
085:                mDomainStorage = pDomainStorage;
086:                mAssociationRef = pAssociationRef;
087:                mRelationalAssociationTableDetails = new STRelationalAssociationTable();
088:                mRelationalAssociationTableDetails.AssociationRef = pAssociationRef;
089:            }
090:
091:            /* Retrieves associated entity ref */
092:            public String getAssociationRef() throws BOException {
093:                return mAssociationRef;
094:            }
095:
096:            /* Returns relational domain storage this entity table definition belongs to */
097:            public BORelationalDomainStorage getDomainStorage()
098:                    throws BOException {
099:                return mDomainStorage;
100:            }
101:
102:            /* Getter for the alias of the table */
103:            public String getTableAlias() throws BOException {
104:                loadDetailsIfNecessary();
105:                return mRelationalAssociationTableDetails.TableAlias;
106:            }
107:
108:            /* Getter for the suggested name of the table */
109:            public String getNameSuggestion() throws BOException {
110:                loadDetailsIfNecessary();
111:                return mRelationalAssociationTableDetails.NameSuggestion;
112:            }
113:
114:            /* Getter for the overriden name of the table */
115:            public String getNameOverride() throws BOException {
116:                loadDetailsIfNecessary();
117:                return mRelationalAssociationTableDetails.NameOverride;
118:            }
119:
120:            /* Getter for the suggested name of the column to store role A instance id */
121:            public String getRoleAInstanceIdColumnNameSuggestion()
122:                    throws BOException {
123:                loadDetailsIfNecessary();
124:                return mRelationalAssociationTableDetails.RoleAInstanceIdColumnNameSuggestion;
125:            }
126:
127:            /* Getter for the overriden name of the column to store role A instance id */
128:            public String getRoleAInstanceIdColumnNameOverride()
129:                    throws BOException {
130:                loadDetailsIfNecessary();
131:                return mRelationalAssociationTableDetails.RoleAInstanceIdColumnNameOverride;
132:            }
133:
134:            /* Getter for the suggested name of the constraint to guard role A referential integrity */
135:            public String getRoleAReferentialConstraintNameSuggestion()
136:                    throws BOException {
137:                loadDetailsIfNecessary();
138:                return mRelationalAssociationTableDetails.RoleAReferentialConstraintNameSuggestion;
139:            }
140:
141:            /* Getter for the overriden name of the constraint to guard role A referential integrity */
142:            public String getRoleAReferentialConstraintNameOverride()
143:                    throws BOException {
144:                loadDetailsIfNecessary();
145:                return mRelationalAssociationTableDetails.RoleAReferentialConstraintNameOverride;
146:            }
147:
148:            /* Getter for the suggested name of the column to store role B instance id */
149:            public String getRoleBInstanceIdColumnNameSuggestion()
150:                    throws BOException {
151:                loadDetailsIfNecessary();
152:                return mRelationalAssociationTableDetails.RoleBInstanceIdColumnNameSuggestion;
153:            }
154:
155:            /* Getter for the overriden name of the column to store role B instance id */
156:            public String getRoleBInstanceIdColumnNameOverride()
157:                    throws BOException {
158:                loadDetailsIfNecessary();
159:                return mRelationalAssociationTableDetails.RoleBInstanceIdColumnNameOverride;
160:            }
161:
162:            /* Getter for the suggested name of the constraint to guard role B referential integrity */
163:            public String getRoleBReferentialConstraintNameSuggestion()
164:                    throws BOException {
165:                loadDetailsIfNecessary();
166:                return mRelationalAssociationTableDetails.RoleBReferentialConstraintNameSuggestion;
167:            }
168:
169:            /* Getter for the overriden name of the constraint to guard role B referential integrity */
170:            public String getRoleBReferentialConstraintNameOverride()
171:                    throws BOException {
172:                loadDetailsIfNecessary();
173:                return mRelationalAssociationTableDetails.RoleBReferentialConstraintNameOverride;
174:            }
175:
176:            /* Getter for the suggested name of the primary key constraint */
177:            public String getPrimaryKeyConstraintNameSuggestion()
178:                    throws BOException {
179:                loadDetailsIfNecessary();
180:                return mRelationalAssociationTableDetails.PrimaryKeyConstraintNameSuggestion;
181:            }
182:
183:            /* Getter for the overriden name of the primary key constraint */
184:            public String getPrimaryKeyConstraintNameOverride()
185:                    throws BOException {
186:                loadDetailsIfNecessary();
187:                return mRelationalAssociationTableDetails.PrimaryKeyConstraintNameOverride;
188:            }
189:
190:            /* Setter for the alias of the table */
191:            public void setTableAlias(String pName) throws BOException {
192:                if (!isBeingEdited())
193:                    throw new BOInvalidOperationForReadOnlyObjectException();
194:                mRelationalAssociationTableDetails.TableAlias = pName;
195:            }
196:
197:            /* Setter for the name of the table */
198:            public void setNameSuggestion(String pName) throws BOException {
199:                if (!isBeingEdited())
200:                    throw new BOInvalidOperationForReadOnlyObjectException();
201:                mRelationalAssociationTableDetails.NameSuggestion = pName;
202:            }
203:
204:            /* Setter for the name of the column to store role A instance id */
205:            public void setRoleAInstanceIdColumnNameSuggestion(String pName)
206:                    throws BOException {
207:                if (!isBeingEdited())
208:                    throw new BOInvalidOperationForReadOnlyObjectException();
209:                mRelationalAssociationTableDetails.RoleAInstanceIdColumnNameSuggestion = pName;
210:            }
211:
212:            /* Setter for the name of the constraint to guard role A referential integrity */
213:            public void setRoleAReferentialConstraintNameSuggestion(String pName)
214:                    throws BOException {
215:                if (!isBeingEdited())
216:                    throw new BOInvalidOperationForReadOnlyObjectException();
217:                mRelationalAssociationTableDetails.RoleAReferentialConstraintNameSuggestion = pName;
218:            }
219:
220:            /* Setter for the name of the column to store role B instance id */
221:            public void setRoleBInstanceIdColumnNameSuggestion(String pName)
222:                    throws BOException {
223:                if (!isBeingEdited())
224:                    throw new BOInvalidOperationForReadOnlyObjectException();
225:                mRelationalAssociationTableDetails.RoleBInstanceIdColumnNameSuggestion = pName;
226:            }
227:
228:            /* Setter for the name of the constraint to guard role B referential integrity */
229:            public void setRoleBReferentialConstraintNameSuggestion(String pName)
230:                    throws BOException {
231:                if (!isBeingEdited())
232:                    throw new BOInvalidOperationForReadOnlyObjectException();
233:                mRelationalAssociationTableDetails.RoleBReferentialConstraintNameSuggestion = pName;
234:            }
235:
236:            /** Setter for the suggested name of the primary key constraint */
237:            public void setPrimaryKeyConstraintNameSuggestion(String pName)
238:                    throws BOException {
239:                if (!isBeingEdited())
240:                    throw new BOInvalidOperationForReadOnlyObjectException();
241:                mRelationalAssociationTableDetails.PrimaryKeyConstraintNameSuggestion = pName;
242:            }
243:
244:            /* Overridable method. Called when existing object enters being edited stage */
245:            protected void onBeginEdit() throws BOException {
246:                loadDetailsIfNecessary();
247:            }
248:
249:            /* Encapsulates commit action by this object */
250:            protected void onCommitDeletion() throws BOException {
251:                try {
252:                    Context ctx = new InitialContext();
253:                    PSRelationalDomainStorage lPs = (PSRelationalDomainStorage) ctx
254:                            .lookup(PSRelationalDomainStorage.COMPONENT_URL);
255:                    STDomainStorageKey lKey = new STDomainStorageKey();
256:                    lKey.StorageTechnologyRef = mDomainStorage
257:                            .getStorageTechnology().getRef();
258:                    lKey.DomainRef = mDomainStorage.getDomainRef();
259:                    lPs.deleteAssociationTable(lKey, mAssociationRef);
260:                } catch (NamingException e) {
261:                    throw new BONamingAndDirectoryServiceInvocationException(
262:                            "", e);
263:                } catch (PSException e) {
264:                    throw new BOPersistenceServiceInvocationException("", e);
265:                }
266:            }
267:
268:            /* Encapsulates commit action by this object */
269:            protected void onCommitUpdate() throws BOException {
270:                try {
271:                    Context ctx = new InitialContext();
272:                    PSRelationalDomainStorage lPs = (PSRelationalDomainStorage) ctx
273:                            .lookup(PSRelationalDomainStorage.COMPONENT_URL);
274:                    STDomainStorageKey lKey = new STDomainStorageKey();
275:                    lKey.StorageTechnologyRef = mDomainStorage
276:                            .getStorageTechnology().getRef();
277:                    lKey.DomainRef = mDomainStorage.getDomainRef();
278:                    lPs.updateAssociationTable(lKey,
279:                            mRelationalAssociationTableDetails);
280:                } catch (NamingException e) {
281:                    throw new BONamingAndDirectoryServiceInvocationException(
282:                            "", e);
283:                } catch (PSException e) {
284:                    throw new BOPersistenceServiceInvocationException("", e);
285:                }
286:            }
287:
288:            /* Encapsulates commit action by this object */
289:            protected void onCommitCreation() throws BOException {
290:                try {
291:                    Context ctx = new InitialContext();
292:                    PSRelationalDomainStorage lPs = (PSRelationalDomainStorage) ctx
293:                            .lookup(PSRelationalDomainStorage.COMPONENT_URL);
294:                    STDomainStorageKey lKey = new STDomainStorageKey();
295:                    lKey.StorageTechnologyRef = mDomainStorage
296:                            .getStorageTechnology().getRef();
297:                    lKey.DomainRef = mDomainStorage.getDomainRef();
298:                    lPs.insertAssociationTable(lKey,
299:                            mRelationalAssociationTableDetails);
300:                } catch (NamingException e) {
301:                    throw new BONamingAndDirectoryServiceInvocationException(
302:                            "", e);
303:                } catch (PSException e) {
304:                    throw new BOPersistenceServiceInvocationException("", e);
305:                }
306:            }
307:
308:            private void loadDetailsIfNecessary() throws BOException {
309:                if (mRelationalAssociationTableDetails == null) {
310:                    try {
311:                        // Get the instance of the enterprise ps home via jndi
312:                        Context ctx = new InitialContext();
313:                        PSRelationalDomainStorage lPs = (PSRelationalDomainStorage) ctx
314:                                .lookup(PSRelationalDomainStorage.COMPONENT_URL);
315:                        STDomainStorageKey lKey = new STDomainStorageKey();
316:                        lKey.StorageTechnologyRef = mDomainStorage
317:                                .getStorageTechnology().getRef();
318:                        lKey.DomainRef = mDomainStorage.getDomainRef();
319:                        mRelationalAssociationTableDetails = lPs
320:                                .getAssociationTable(lKey, mAssociationRef);
321:                        if (mRelationalAssociationTableDetails == null)
322:                            throw new BOException(
323:                                    "Association Table Definition not found. StorageTechnologyRef: "
324:                                            + getRef());
325:                    } catch (NamingException e) {
326:                        throw new BONamingAndDirectoryServiceInvocationException(
327:                                "", e);
328:                    } catch (PSException e) {
329:                        throw new BOPersistenceServiceInvocationException(
330:                                "Exception caught during loading of Relational Storage Technology details.  StorageTechnologyRef: "
331:                                        + getRef(), e);
332:                    }
333:                }
334:            }
335:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.