Source Code Cross Referenced for PSMessageImpl.java in  » UML » MetaBoss » com » metaboss » sdlctools » domains » enterprisemodel » storage » xmlfileimpl » 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.storage.xmlfileimpl 
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.storage.xmlfileimpl;
016:
017:        import java.util.Iterator;
018:
019:        import javax.xml.bind.JAXBException;
020:
021:        import com.metaboss.enterprise.ps.PSDataSourceOperationInvocationException;
022:        import com.metaboss.enterprise.ps.PSException;
023:        import com.metaboss.sdlctools.domains.enterprisemodel.storage.PSMessage;
024:        import com.metaboss.sdlctools.domains.enterprisemodel.storage.STMessage;
025:        import com.metaboss.sdlctools.domains.enterprisemodel.storage.STMessageField;
026:        import com.metaboss.sdlctools.domains.enterprisemodel.storage.xmlfileimpl.dom.MessageDefType;
027:        import com.metaboss.sdlctools.domains.enterprisemodel.storage.xmlfileimpl.dom.MessageFieldDefListType;
028:        import com.metaboss.sdlctools.domains.enterprisemodel.storage.xmlfileimpl.dom.MessageFieldDefType;
029:
030:        public class PSMessageImpl implements  PSMessage {
031:            /** Returns  details entity corresponding to given reference or null struct if definition not found */
032:            public STMessage getMessage(String pMessageRef) throws PSException {
033:                MessageDefType lMessageDef = Storage.getMessage(pMessageRef);
034:                if (lMessageDef == null)
035:                    return null;
036:                STMessage lStruct = new STMessage();
037:                lStruct.MessageRef = lMessageDef.getMessageRef();
038:                lStruct.Description = lMessageDef.getDescription();
039:                lStruct.Type = com.metaboss.sdlctools.types.enterprisemodel.MessageTypeTextHelper
040:                        .fromTextObject(lMessageDef.getMessageType());
041:                lStruct.DefaultText = lMessageDef.getDefaultText();
042:                return lStruct;
043:            }
044:
045:            /* Inserts one or more new message records into the database */
046:            public void insert(STMessage[] pNewRecords) throws PSException {
047:                try {
048:                    for (int i = 0; i < pNewRecords.length; i++) {
049:                        STMessage lMessageToInsert = pNewRecords[i];
050:
051:                        MessageDefType lMessageDef = Util.getObjectFactory()
052:                                .createMessageDef();
053:                        lMessageDef.setMessageRef(lMessageToInsert.MessageRef);
054:                        lMessageDef
055:                                .setDescription(lMessageToInsert.Description);
056:                        lMessageDef
057:                                .setDefaultText(lMessageToInsert.DefaultText);
058:                        lMessageDef
059:                                .setMessageType(com.metaboss.sdlctools.types.enterprisemodel.MessageTypeTextHelper
060:                                        .toTextObject(lMessageToInsert.Type));
061:                        MessageFieldDefListType lMessageFieldDefList = Util
062:                                .getObjectFactory().createMessageFieldDefList();
063:                        lMessageDef
064:                                .setMessageFieldDefList(lMessageFieldDefList);
065:                        Storage.insertMessage(lMessageDef);
066:                    }
067:                } catch (JAXBException e) {
068:                    throw new PSDataSourceOperationInvocationException(e);
069:                }
070:            }
071:
072:            /* Returns list of input fields for the operation with the specified name from specified service */
073:            public STMessageField[] getFields(String pMessageRef)
074:                    throws PSException {
075:                MessageDefType lMessageDef = Storage.getMessage(pMessageRef);
076:                if (lMessageDef == null)
077:                    throw new PSException("Message not found. MessageRef : "
078:                            + pMessageRef);
079:                MessageFieldDefListType lMessageFieldDefList = lMessageDef
080:                        .getMessageFieldDefList();
081:                STMessageField[] lReturn = new STMessageField[lMessageFieldDefList
082:                        .getMessageFieldDef().size()];
083:                Iterator lIter = lMessageFieldDefList.getMessageFieldDef()
084:                        .iterator();
085:                for (int j = 0; lIter.hasNext(); j++)
086:                    lReturn[j] = getMessageField((MessageFieldDefType) lIter
087:                            .next());
088:                return lReturn;
089:            }
090:
091:            /** inserts field into the structure */
092:            public void insertField(String pMessageRef, STMessageField pNewField)
093:                    throws PSException {
094:                MessageDefType lMessageDef = Storage.getMessage(pMessageRef);
095:                if (lMessageDef == null)
096:                    throw new PSException("Message not found. MessageRef : "
097:                            + pMessageRef);
098:                // Make sure that field with the specified name does not exists yet
099:                MessageFieldDefListType lMessageFieldDefList = lMessageDef
100:                        .getMessageFieldDefList();
101:                Iterator lIter = lMessageFieldDefList.getMessageFieldDef()
102:                        .iterator();
103:                while (lIter.hasNext()) {
104:                    MessageFieldDefType lMessageFieldDef = (MessageFieldDefType) lIter
105:                            .next();
106:                    if (lMessageFieldDef.getName().equals(pNewField.Name))
107:                        throw new PSException(
108:                                "Attempt to insert duplicate field. MessageRef : "
109:                                        + pMessageRef + ". FieldName : "
110:                                        + pNewField.Name);
111:                }
112:                MessageFieldDefType lNewFieldDef = getMessageFieldDef(pNewField);
113:                lMessageFieldDefList.getMessageFieldDef().add(lNewFieldDef);
114:                Storage.updateMessage(lMessageDef);
115:            }
116:
117:            // Helper. Converts xml struct to the PS struct
118:            private static STMessageField getMessageField(
119:                    MessageFieldDefType pMessageFieldDef) {
120:                if (pMessageFieldDef == null)
121:                    return null;
122:                STMessageField lStruct = new STMessageField();
123:                lStruct.Name = pMessageFieldDef.getName();
124:                lStruct.Description = pMessageFieldDef.getDescription();
125:                lStruct.DataTypeRef = pMessageFieldDef.getDataTypeRef();
126:                return lStruct;
127:            }
128:
129:            // Helper. Converts PS struct to xml struct
130:            private static MessageFieldDefType getMessageFieldDef(
131:                    STMessageField pMessageField) throws PSException {
132:                try {
133:                    MessageFieldDefType lMessageFieldDef = Util
134:                            .getObjectFactory().createMessageFieldDef();
135:                    lMessageFieldDef.setName(pMessageField.Name);
136:                    lMessageFieldDef.setDescription(pMessageField.Description);
137:                    lMessageFieldDef.setDataTypeRef(pMessageField.DataTypeRef);
138:                    return lMessageFieldDef;
139:                } catch (JAXBException e) {
140:                    throw new PSDataSourceOperationInvocationException(e);
141:                }
142:            }
143:        }
w__w__w_.___j___a__v_a___2___s___._c___o_m_ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.