Source Code Cross Referenced for BOEnterpriseImpl.java in  » UML » MetaBoss » com » metaboss » sdlctools » domains » enterprisemodel » 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.enterprisemodel.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.enterprisemodel.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.BOIllegalArgumentException;
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.enterprisemodel.BOEnterprise;
028:        import com.metaboss.sdlctools.domains.enterprisemodel.BOEnterpriseSystemList;
029:        import com.metaboss.sdlctools.domains.enterprisemodel.BOSystem;
030:        import com.metaboss.sdlctools.domains.enterprisemodel.storage.PSEnterprise;
031:        import com.metaboss.sdlctools.domains.enterprisemodel.storage.STEnterprise;
032:        import com.oldboss.framework.bo.BOTransaction;
033:        import com.oldboss.framework.bo.impl.BOObjectImpl;
034:
035:        public class BOEnterpriseImpl extends BOObjectImpl implements 
036:                BOEnterprise {
037:            private BOMetaBossDomainImpl mMetaBossDomainImpl = null;
038:            private String mEnterpriseRef = null;
039:            private STEnterprise mDetailsBackup = null;
040:            private STEnterprise mDetails = null;
041:            private BOEnterpriseSystemList mSystemList = null;
042:
043:            /* Instance creator */
044:            public static BOEnterprise createInstanceForExisting(
045:                    BOMetaBossDomainImpl pMetaBossDomainImpl,
046:                    String pEnterpriseRef) throws BOException {
047:                // See if we have this object in cache
048:                BOEnterpriseImpl lImpl = (BOEnterpriseImpl) pMetaBossDomainImpl
049:                        .retrieveExistingBOInstance(BOEnterprise.class,
050:                                pEnterpriseRef);
051:                if (lImpl != null)
052:                    return lImpl;
053:                lImpl = new BOEnterpriseImpl();
054:                lImpl.mMetaBossDomainImpl = pMetaBossDomainImpl;
055:                lImpl.mEnterpriseRef = pEnterpriseRef;
056:                lImpl.setupForExisting();
057:                pMetaBossDomainImpl.saveNewBOInstance(BOEnterprise.class,
058:                        pEnterpriseRef, lImpl);
059:                return lImpl;
060:            }
061:
062:            /* Instance creator */
063:            public static BOEnterprise createInstanceForNew(
064:                    BOTransaction pTransaction,
065:                    BOMetaBossDomainImpl pMetaBossDomainImpl,
066:                    String pEnterpriseRef) throws BOException {
067:                // See if we have this object in cache already
068:                BOEnterpriseImpl lImpl = (BOEnterpriseImpl) pMetaBossDomainImpl
069:                        .retrieveExistingBOInstance(BOEnterprise.class,
070:                                pEnterpriseRef);
071:                if (lImpl != null)
072:                    throw new BOIllegalArgumentException(
073:                            "Enterprise already exists. EnterpriseRef: "
074:                                    + pEnterpriseRef);
075:                lImpl = new BOEnterpriseImpl();
076:                lImpl.mMetaBossDomainImpl = pMetaBossDomainImpl;
077:                lImpl.mEnterpriseRef = pEnterpriseRef;
078:                lImpl.mDetails = new STEnterprise();
079:                lImpl.mDetails.EnterpriseRef = pEnterpriseRef;
080:                lImpl.setupForNew(pTransaction);
081:                pMetaBossDomainImpl.saveNewBOInstance(BOEnterprise.class,
082:                        pEnterpriseRef, lImpl);
083:                return lImpl;
084:            }
085:
086:            /* Private constructor restricts instance creation from outside */
087:            private BOEnterpriseImpl() throws BOException {
088:            }
089:
090:            /* Retrieves unique reference */
091:            public String getRef() throws BOException {
092:                return mEnterpriseRef;
093:            }
094:
095:            /* Retrieves enterprise name. */
096:            public String getName() throws BOException {
097:                return mEnterpriseRef;
098:            }
099:
100:            /* Retrieves description */
101:            public String getDescription() throws BOException {
102:                loadDetailsIfNecessary();
103:                return mDetails.Description;
104:            }
105:
106:            /** Sets description */
107:            public void setDescription(String pDescription) throws BOException {
108:                if (!isBeingEdited())
109:                    throw new BOInvalidOperationForReadOnlyObjectException();
110:                mDetails.Description = pDescription;
111:            }
112:
113:            /* Retrieves list of systems in this enteprise */
114:            public BOEnterpriseSystemList getSystems() throws BOException {
115:                if (mSystemList == null) {
116:                    loadDetailsIfNecessary();
117:                    mSystemList = BOEnterpriseSystemListImpl
118:                            .createInstanceForExisting(mMetaBossDomainImpl,
119:                                    this );
120:                }
121:                return mSystemList;
122:            }
123:
124:            private void loadDetailsIfNecessary() throws BOException {
125:                if (mDetails == null) {
126:                    try {
127:                        // Get the instance of the enterprise ps home via jndi
128:                        Context lCtx = new InitialContext();
129:                        PSEnterprise lPs = (PSEnterprise) lCtx
130:                                .lookup(PSEnterprise.COMPONENT_URL);
131:
132:                        mDetails = lPs.getEnterprise(mEnterpriseRef);
133:                        if (mDetails == null)
134:                            throw new BOException(
135:                                    "Enterprise not found. EnterpriseRef:"
136:                                            + mEnterpriseRef);
137:                    } catch (NamingException e) {
138:                        throw new BONamingAndDirectoryServiceInvocationException(
139:                                "", e);
140:                    } catch (PSException e) {
141:                        throw new BOPersistenceServiceInvocationException("", e);
142:                    }
143:                }
144:            }
145:
146:            protected void onBeginEdit() throws BOException {
147:                // Fully load the object
148:                loadDetailsIfNecessary();
149:                // Preserve old values
150:                mDetailsBackup = mDetails;
151:            }
152:
153:            // Overriden to de-register from the owner and ensure that it is not referenced in any place
154:            protected void onDelete() throws BOException {
155:                BOEnterpriseListImpl lEnterpriseListImpl = (BOEnterpriseListImpl) mMetaBossDomainImpl
156:                        .getEnterprises();
157:                lEnterpriseListImpl.beginEdit(fetchTransaction());
158:                lEnterpriseListImpl.onDeleteEnterpise(this );
159:            }
160:
161:            // Overriden to de-register from the owner and ensure that it is not referenced in any place
162:            protected void onDelete(BOObjectImpl pObjectImpl)
163:                    throws BOException {
164:                // See if this is system
165:                if (pObjectImpl instanceof  BOSystem) {
166:                    BOEnterpriseSystemListImpl lEnterpriseSystemListImpl = (BOEnterpriseSystemListImpl) getSystems();
167:                    lEnterpriseSystemListImpl.beginEdit(fetchTransaction());
168:                    lEnterpriseSystemListImpl
169:                            .onDeleteSystem((BOSystem) pObjectImpl);
170:                }
171:            }
172:
173:            /* Encapsulates commit action by this object */
174:            protected void onCommitCreation() throws BOException {
175:                try {
176:                    // Get the instance of the enterprise ps home via jndi
177:                    Context lCtx = new InitialContext();
178:                    PSEnterprise lPs = (PSEnterprise) lCtx
179:                            .lookup(PSEnterprise.COMPONENT_URL);
180:                    lPs.insertEnterprise(mDetails);
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 onCommitUpdate() throws BOException {
191:                try {
192:                    // Get the instance of the enterprise ps home via jndi
193:                    Context lCtx = new InitialContext();
194:                    PSEnterprise lPs = (PSEnterprise) lCtx
195:                            .lookup(PSEnterprise.COMPONENT_URL);
196:                    lPs.updateEnterprise(mDetails);
197:                } catch (NamingException e) {
198:                    throw new BONamingAndDirectoryServiceInvocationException(
199:                            "", e);
200:                } catch (PSException e) {
201:                    throw new BOPersistenceServiceInvocationException("", e);
202:                }
203:            }
204:
205:            protected void onCommitDeletion() throws BOException {
206:                try {
207:                    // Get the instance of the enterprise ps home via jndi
208:                    Context lCtx = new InitialContext();
209:                    PSEnterprise lPs = (PSEnterprise) lCtx
210:                            .lookup(PSEnterprise.COMPONENT_URL);
211:                    lPs.deleteEnterprise(mEnterpriseRef);
212:                } catch (NamingException e) {
213:                    throw new BONamingAndDirectoryServiceInvocationException(
214:                            "", e);
215:                } catch (PSException e) {
216:                    throw new BOPersistenceServiceInvocationException("", e);
217:                }
218:            }
219:
220:            /* Encapsulates an action after successfull commit */
221:            public void onCommitSucceeded() throws BOException {
222:                mDetailsBackup = null;
223:                if (isDeleted())
224:                    mMetaBossDomainImpl.removeExistingBOInstance(
225:                            BOEnterprise.class, mEnterpriseRef);
226:            }
227:
228:            // Overriddden to cleanup this object from cache
229:            protected void onRollbackCreation() throws BOException {
230:                mMetaBossDomainImpl.removeExistingBOInstance(
231:                        BOEnterprise.class, mEnterpriseRef);
232:            }
233:
234:            // Overriddden to restore this object's status to pre-begin edit state
235:            protected void onRollbackUpdate() throws BOException {
236:                mDetails = mDetailsBackup;
237:                mDetailsBackup = null;
238:            }
239:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.