Source Code Cross Referenced for BORelationalEntityTableAttributeImpl.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.BOInvalidOperationForObjectException;
023:        import com.metaboss.enterprise.bo.BOInvalidOperationForReadOnlyObjectException;
024:        import com.metaboss.enterprise.bo.BONamingAndDirectoryServiceInvocationException;
025:        import com.metaboss.enterprise.bo.BOPersistenceServiceInvocationException;
026:        import com.metaboss.enterprise.ps.PSException;
027:        import com.metaboss.sdlctools.domains.storagemodel.BORelationalDomainStorage;
028:        import com.metaboss.sdlctools.domains.storagemodel.BORelationalEntityTable;
029:        import com.metaboss.sdlctools.domains.storagemodel.BORelationalEntityTableAttribute;
030:        import com.metaboss.sdlctools.domains.storagemodel.storage.PSRelationalDomainStorage;
031:        import com.metaboss.sdlctools.domains.storagemodel.storage.STDomainStorageKey;
032:        import com.metaboss.sdlctools.domains.storagemodel.storage.STRelationalEntityTableAttribute;
033:        import com.oldboss.framework.bo.BOTransaction;
034:        import com.oldboss.framework.bo.impl.BOObjectImpl;
035:
036:        public class BORelationalEntityTableAttributeImpl extends BOObjectImpl
037:                implements  BORelationalEntityTableAttribute {
038:            private BOMetaBossDomainImpl mMetaBossDomainImpl = null;
039:            private BORelationalDomainStorage mDomainStorage = null;
040:            private BORelationalEntityTable mEntityTable = null;
041:            private String mEntityRef = null;
042:            private String mAttributeRef = null;
043:            private STRelationalEntityTableAttribute mRelationalEntityTableAttributeDetails = null;
044:
045:            /* Instance creator */
046:            public static BORelationalEntityTableAttribute createInstanceForExisting(
047:                    BOMetaBossDomainImpl pMetaBossDomainImpl,
048:                    BORelationalDomainStorage pDomainStorage,
049:                    BORelationalEntityTable pEntityTable, String pAttributeRef)
050:                    throws BOException {
051:                BORelationalEntityTableAttributeImpl lImpl = new BORelationalEntityTableAttributeImpl();
052:                lImpl.setupInstanceForExisting(pMetaBossDomainImpl,
053:                        pDomainStorage, pEntityTable, pAttributeRef);
054:                lImpl.setupForExisting();
055:                return lImpl;
056:            }
057:
058:            /* Instance creator */
059:            public static BORelationalEntityTableAttribute createInstanceForNew(
060:                    BOTransaction pTransaction,
061:                    BOMetaBossDomainImpl pMetaBossDomainImpl,
062:                    BORelationalDomainStorage pDomainStorage,
063:                    BORelationalEntityTable pEntityTable, String pAttributeRef)
064:                    throws BOException {
065:                BORelationalEntityTableAttributeImpl lImpl = new BORelationalEntityTableAttributeImpl();
066:                lImpl.setupInstanceForNew(pMetaBossDomainImpl, pDomainStorage,
067:                        pEntityTable, pAttributeRef);
068:                lImpl.setupForNew(pTransaction);
069:                return lImpl;
070:            }
071:
072:            /* Protect an access to this constructor */
073:            protected BORelationalEntityTableAttributeImpl() throws BOException {
074:            }
075:
076:            /* Setup instance representing an existing entity */
077:            protected void setupInstanceForExisting(
078:                    BOMetaBossDomainImpl pMetaBossDomainImpl,
079:                    BORelationalDomainStorage pDomainStorage,
080:                    BORelationalEntityTable pEntityTable, String pAttributeRef)
081:                    throws BOException {
082:                mMetaBossDomainImpl = pMetaBossDomainImpl;
083:                mDomainStorage = pDomainStorage;
084:                mEntityTable = pEntityTable;
085:                mEntityRef = pAttributeRef.substring(0, pAttributeRef
086:                        .lastIndexOf("."));
087:                mAttributeRef = pAttributeRef;
088:            }
089:
090:            /* Setup instance representing new entity */
091:            protected void setupInstanceForNew(
092:                    BOMetaBossDomainImpl pMetaBossDomainImpl,
093:                    BORelationalDomainStorage pDomainStorage,
094:                    BORelationalEntityTable pEntityTable, String pAttributeRef)
095:                    throws BOException {
096:                mMetaBossDomainImpl = pMetaBossDomainImpl;
097:                mDomainStorage = pDomainStorage;
098:                mEntityTable = pEntityTable;
099:                mEntityRef = pAttributeRef.substring(0, pAttributeRef
100:                        .lastIndexOf("."));
101:                mAttributeRef = pAttributeRef;
102:                mRelationalEntityTableAttributeDetails = new STRelationalEntityTableAttribute();
103:                mRelationalEntityTableAttributeDetails.AttributeRef = pAttributeRef;
104:            }
105:
106:            /* Retrieves associated attribute  ref */
107:            public String getAttributeRef() throws BOException {
108:                return mAttributeRef;
109:            }
110:
111:            /* Getter for the suggested name of the column */
112:            public String getColumnNameSuggestion() throws BOException {
113:                loadDetailsIfNecessary();
114:                return mRelationalEntityTableAttributeDetails.ColumnNameSuggestion;
115:            }
116:
117:            /* Getter for the overriden name of the column */
118:            public String getColumnNameOverride() throws BOException {
119:                loadDetailsIfNecessary();
120:                return mRelationalEntityTableAttributeDetails.ColumnNameOverride;
121:            }
122:
123:            /* Getter for the ref constraint definition presence flag */
124:            public boolean hasRefConstraintNameDefinition() throws BOException {
125:                loadDetailsIfNecessary();
126:                return mRelationalEntityTableAttributeDetails.HasRefConstraintNameDefinition;
127:            }
128:
129:            /* Getter for the suggested name of the referential constraint */
130:            public String getRefConstraintNameSuggestion() throws BOException {
131:                loadDetailsIfNecessary();
132:                return mRelationalEntityTableAttributeDetails.RefConstraintNameSuggestion;
133:            }
134:
135:            /* Getter for the overriden name of the referential constraint */
136:            public String getRefConstraintNameOverride() throws BOException {
137:                loadDetailsIfNecessary();
138:                return mRelationalEntityTableAttributeDetails.RefConstraintNameOverride;
139:            }
140:
141:            /* Setter for the suggested name of the column */
142:            public void setColumnNameSuggestion(String pName)
143:                    throws BOException {
144:                if (!isBeingEdited())
145:                    throw new BOInvalidOperationForReadOnlyObjectException();
146:                mRelationalEntityTableAttributeDetails.ColumnNameSuggestion = pName;
147:            }
148:
149:            /* Setter for the ref constraint definition presence flag */
150:            public void setHasRefConstraintNameDefinition(boolean pHasConstraint)
151:                    throws BOException {
152:                if (!isBeingEdited())
153:                    throw new BOInvalidOperationForReadOnlyObjectException();
154:                if (mRelationalEntityTableAttributeDetails.HasRefConstraintNameDefinition != pHasConstraint) {
155:                    mRelationalEntityTableAttributeDetails.HasRefConstraintNameDefinition = pHasConstraint;
156:                    if (!mRelationalEntityTableAttributeDetails.HasRefConstraintNameDefinition) {
157:                        mRelationalEntityTableAttributeDetails.RefConstraintNameSuggestion = null;
158:                        mRelationalEntityTableAttributeDetails.RefConstraintNameOverride = null;
159:                    } else {
160:                        mRelationalEntityTableAttributeDetails.RefConstraintNameSuggestion = "";
161:                        mRelationalEntityTableAttributeDetails.RefConstraintNameOverride = "";
162:                    }
163:                }
164:            }
165:
166:            /* Setter for the suggested name of the referential constraint
167:             * Note that atribute does not always has referential constraint - this depends on the model */
168:            public void setRefConstraintNameSuggestion(String pName)
169:                    throws BOException {
170:                if (!isBeingEdited())
171:                    throw new BOInvalidOperationForReadOnlyObjectException();
172:                if (!mRelationalEntityTableAttributeDetails.HasRefConstraintNameDefinition)
173:                    throw new BOInvalidOperationForObjectException(
174:                            "Reference constraint definition is absent in column definition (possibly because of the corresponding attribute type defined in the model), name suggestion can not be set. StorageTechnologyRef: "
175:                                    + mDomainStorage.getStorageTechnology()
176:                                            .getRef()
177:                                    + " DomainRef: "
178:                                    + mDomainStorage.getDomainRef()
179:                                    + " EntityRef: " + mEntityRef);
180:                mRelationalEntityTableAttributeDetails.RefConstraintNameSuggestion = pName;
181:            }
182:
183:            /* Overridable method. Called when existing object enters being edited stage */
184:            protected void onBeginEdit() throws BOException {
185:                loadDetailsIfNecessary();
186:            }
187:
188:            /* Encapsulates commit action by this object */
189:            protected void onCommitUpdate() throws BOException {
190:                try {
191:                    Context ctx = new InitialContext();
192:                    PSRelationalDomainStorage lPs = (PSRelationalDomainStorage) ctx
193:                            .lookup(PSRelationalDomainStorage.COMPONENT_URL);
194:                    STDomainStorageKey lKey = new STDomainStorageKey();
195:                    lKey.StorageTechnologyRef = mEntityTable.getDomainStorage()
196:                            .getStorageTechnology().getRef();
197:                    lKey.DomainRef = mEntityTable.getDomainStorage()
198:                            .getDomainRef();
199:                    lPs.updateEntityTableAttribute(lKey, mEntityRef,
200:                            mRelationalEntityTableAttributeDetails);
201:                } catch (NamingException e) {
202:                    throw new BONamingAndDirectoryServiceInvocationException(
203:                            "", e);
204:                } catch (PSException e) {
205:                    throw new BOPersistenceServiceInvocationException("", e);
206:                }
207:            }
208:
209:            /* Encapsulates commit action by this object */
210:            protected void onCommitDeletion() throws BOException {
211:                try {
212:                    Context ctx = new InitialContext();
213:                    PSRelationalDomainStorage lPs = (PSRelationalDomainStorage) ctx
214:                            .lookup(PSRelationalDomainStorage.COMPONENT_URL);
215:                    STDomainStorageKey lKey = new STDomainStorageKey();
216:                    lKey.StorageTechnologyRef = mEntityTable.getDomainStorage()
217:                            .getStorageTechnology().getRef();
218:                    lKey.DomainRef = mEntityTable.getDomainStorage()
219:                            .getDomainRef();
220:                    lPs.deleteEntityTableAttribute(lKey, mEntityRef,
221:                            mAttributeRef);
222:                } catch (NamingException e) {
223:                    throw new BONamingAndDirectoryServiceInvocationException(
224:                            "", e);
225:                } catch (PSException e) {
226:                    throw new BOPersistenceServiceInvocationException("", e);
227:                }
228:            }
229:
230:            /* Encapsulates commit action by this object */
231:            protected void onCommitCreation() throws BOException {
232:                try {
233:                    Context ctx = new InitialContext();
234:                    PSRelationalDomainStorage lPs = (PSRelationalDomainStorage) ctx
235:                            .lookup(PSRelationalDomainStorage.COMPONENT_URL);
236:                    STDomainStorageKey lKey = new STDomainStorageKey();
237:                    lKey.StorageTechnologyRef = mEntityTable.getDomainStorage()
238:                            .getStorageTechnology().getRef();
239:                    lKey.DomainRef = mEntityTable.getDomainStorage()
240:                            .getDomainRef();
241:                    lPs.insertEntityTableAttribute(lKey, mEntityRef,
242:                            mRelationalEntityTableAttributeDetails);
243:                } catch (NamingException e) {
244:                    throw new BONamingAndDirectoryServiceInvocationException(
245:                            "", e);
246:                } catch (PSException e) {
247:                    throw new BOPersistenceServiceInvocationException("", e);
248:                }
249:            }
250:
251:            private void loadDetailsIfNecessary() throws BOException {
252:                if (mRelationalEntityTableAttributeDetails == null) {
253:                    try {
254:                        // Get the instance of the enterprise ps home via jndi
255:                        Context ctx = new InitialContext();
256:                        PSRelationalDomainStorage lPs = (PSRelationalDomainStorage) ctx
257:                                .lookup(PSRelationalDomainStorage.COMPONENT_URL);
258:                        STDomainStorageKey lKey = new STDomainStorageKey();
259:                        lKey.StorageTechnologyRef = mEntityTable
260:                                .getDomainStorage().getStorageTechnology()
261:                                .getRef();
262:                        lKey.DomainRef = mEntityTable.getDomainStorage()
263:                                .getDomainRef();
264:                        mRelationalEntityTableAttributeDetails = lPs
265:                                .getEntityTableAttribute(lKey, mEntityRef,
266:                                        mAttributeRef);
267:                        if (mRelationalEntityTableAttributeDetails == null)
268:                            throw new BOException(
269:                                    "Entity Table Attribute column definition not found. StorageTechnologyRef: "
270:                                            + mEntityTable.getDomainStorage()
271:                                                    .getStorageTechnology()
272:                                                    .getRef()
273:                                            + " AttributeRef: " + mAttributeRef);
274:                    } catch (NamingException e) {
275:                        throw new BONamingAndDirectoryServiceInvocationException(
276:                                "", e);
277:                    } catch (PSException e) {
278:                        throw new BOPersistenceServiceInvocationException(
279:                                "Exception caught during loading of Entity Table Attribute column details.  StorageTechnologyRef: "
280:                                        + mEntityTable.getDomainStorage()
281:                                                .getStorageTechnology()
282:                                                .getRef()
283:                                        + " AttributeRef: "
284:                                        + mAttributeRef, e);
285:                    }
286:                }
287:            }
288:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.