Source Code Cross Referenced for Value.java in  » Content-Management-System » harmonise » org » openharmonise » rm » resources » metadata » values » 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 » Content Management System » harmonise » org.openharmonise.rm.resources.metadata.values 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * The contents of this file are subject to the 
003:         * Mozilla Public License Version 1.1 (the "License"); 
004:         * you may not use this file except in compliance with the License. 
005:         * You may obtain a copy of the License at http://www.mozilla.org/MPL/
006:         *
007:         * Software distributed under the License is distributed on an "AS IS"
008:         * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. 
009:         * See the License for the specific language governing rights and 
010:         * limitations under the License.
011:         *
012:         * The Initial Developer of the Original Code is Simulacra Media Ltd.
013:         * Portions created by Simulacra Media Ltd are Copyright (C) Simulacra Media Ltd, 2004.
014:         *
015:         * All Rights Reserved.
016:         *
017:         * Contributor(s):
018:         */
019:        package org.openharmonise.rm.resources.metadata.values;
020:
021:        import java.util.logging.*;
022:
023:        import org.openharmonise.commons.dsi.*;
024:        import org.openharmonise.commons.dsi.dml.*;
025:        import org.openharmonise.rm.*;
026:        import org.openharmonise.rm.dsi.*;
027:        import org.openharmonise.rm.publishing.*;
028:        import org.openharmonise.rm.resources.*;
029:        import org.openharmonise.rm.resources.lifecycle.*;
030:        import org.w3c.dom.*;
031:
032:        /**
033:         * This class represents an element in a metadata vocabulary which will be 
034:         * part of a <code>Property</code> <code>Range</code>'s set of allowable values.
035:         * 
036:         * @author Michael Bell
037:         * @version $Revision: 1.4 $
038:         *
039:         */
040:        public class Value extends AbstractChildObject implements 
041:                DataStoreObject, Publishable, Editable {
042:
043:            //XML constants
044:            /**
045:             * The value XML element name
046:             */
047:            public static final String TAG_VALUE = "Value";
048:
049:            /**
050:             * The description XML element name
051:             */
052:            public static final String TAG_DESCRIPTION = "Description";
053:
054:            /**
055:             * The code XML element name
056:             */
057:            public static final String TAG_CODE = "Code";
058:
059:            /**
060:             * The order XML attribute name
061:             */
062:            public static final String ATTRIB_ORDER = "order";
063:
064:            //DB constants
065:            /**
066:             * The <code>Value</code> database table name
067:             */
068:            private static final String TBL_VALUE = "value";
069:
070:            /**
071:             * The order database column name
072:             */
073:            private static final String CLMN_ORDER = "order";
074:
075:            /**
076:             * Logger for this class
077:             */
078:            private static final Logger m_logger = Logger.getLogger(Value.class
079:                    .getName());
080:
081:            //static initialiser
082:            static {
083:                DatabaseInfo.getInstance().registerTableName(
084:                        Value.class.getName(), TBL_VALUE);
085:            }
086:
087:            /** 
088:             * Constructs a new <code>Value</code>.
089:             *
090:             */
091:            public Value() {
092:                super ();
093:            }
094:
095:            /**
096:             * Constructs a new <cod>Value</code> with an interface to the data store.
097:             * 
098:             * @param dbintrf the data store interface
099:             */
100:            public Value(AbstractDataStoreInterface dbintrf) {
101:                super (dbintrf);
102:
103:            }
104:
105:            /** 
106:             * Constructs an existing <code>Value</code> identified by its id.
107:             *
108:             * @param dbintrf the data store interface
109:             * @param nId the id of the <code>Value</code>
110:             */
111:            public Value(AbstractDataStoreInterface dbintrf, int nId) {
112:                super (dbintrf, nId);
113:
114:            }
115:
116:            /** 
117:             * Constructs a new <code>Value</code> which may be historical.
118:             *
119:             * @param dbintrf the data store interface
120:             * @param bIsHist <code>true</code> if the new <code>Value</code> is to be 
121:             * a historical version
122:             */
123:            public Value(AbstractDataStoreInterface dbintrf, boolean bIsHist) {
124:                super (dbintrf);
125:                setHistorical(bIsHist);
126:            }
127:
128:            /** 
129:             * Constructs an existing <code>Value</code> which may be historical.
130:             *
131:             * @param dbintrf the data store interface
132:             * @param nId the id of this object
133:             * @param nKey the unique key of the resource 
134:             * @param bIsHist <code>true</code> if the version of the <code>Value</code> 
135:             * is historical
136:             */
137:            public Value(AbstractDataStoreInterface dbintrf, int nId, int nKey,
138:                    boolean bIsHist) {
139:                super (dbintrf, nId, nKey, bIsHist);
140:
141:            }
142:
143:            /**
144:             * Returns the code of this <code>Value</code>. 
145:             * Maps to <code>getName</code> in <code>AbstractObject</code>.
146:             * 
147:             * @return the code of this <code>Value</code>. 
148:             * @throws DataAccessException if there is an error populating this object
149:             */
150:            public String getCode() throws DataAccessException {
151:                return getName();
152:            }
153:
154:            /**
155:             * Sets the code of this <code>Value</code>. Maps to <code>setName</code> 
156:             * in <code>AbstractObject</code>.
157:             * 
158:             * @param sCode the new code of this <code>Value</code>
159:             */
160:            public void setCode(String sCode) {
161:                try {
162:                    this .setName(sCode);
163:                } catch (InvalidNameException e) {
164:                    m_logger.log(Level.WARNING, e.getLocalizedMessage(), e);
165:                }
166:            }
167:
168:            /**
169:             * Returns the description of this <code>Value</code>. 
170:             * Maps to <code>getSummary</code> in <code>AbstractObject</code>.
171:             * 
172:             * @return the description of this <code>Value</code>
173:             * @throws DataAccessException if there is an error populating this object
174:             */
175:            public String getDescription() throws DataAccessException {
176:                return (getSummary());
177:            }
178:
179:            /**
180:             * Sets the description of this <code>Value</code>. 
181:             * Maps to <code>setSummary</code> in <code>AbstractObject</code>
182:             * 
183:             * @param sDesc the description
184:             */
185:            public void setDescription(String sDesc) {
186:                setSummary(sDesc);
187:            }
188:
189:            /* (non-Javadoc)
190:             * @see java.lang.Object#toString()
191:             */
192:            public String toString() {
193:                StringBuffer strBuff = new StringBuffer();
194:
195:                strBuff.append("Value Name:[" + m_sName + "] ").append(
196:                        "Value Description:[" + m_sSummary + "] ").append(
197:                        "Value ID:[" + m_nId + "] ");
198:
199:                return strBuff.toString();
200:            }
201:
202:            /* (non-Javadoc)
203:             * @see org.openharmonise.rm.dsi.DataStoreObject#getInstanceJoinConditions(java.lang.String, boolean)
204:             */
205:            public JoinConditions getInstanceJoinConditions(String sObjectTag,
206:                    boolean bIsOuter) throws DataStoreException {
207:                return null;
208:            }
209:
210:            /* (non-Javadoc)
211:             * @see org.openharmonise.rm.dsi.DataStoreObject#getInstanceColumnRef(java.lang.String, boolean)
212:             */
213:            public ColumnRef getInstanceColumnRef(String sColumn,
214:                    boolean bIsHist) throws DataStoreException {
215:                ColumnRef colref = null;
216:
217:                colref = super .getInstanceColumnRef(sColumn, bIsHist);
218:
219:                return colref;
220:            }
221:
222:            /* (non-Javadoc)
223:             * @see org.openharmonise.rm.publishing.Publishable#publish(org.w3c.dom.Element, org.openharmonise.rm.publishing.HarmoniseOutput, org.openharmonise.rm.publishing.State)
224:             */
225:            public Element publish(Element topEl, HarmoniseOutput xmlDoc,
226:                    State state) throws PublishException {
227:
228:                Element docEl = null;
229:                Text txt = null;
230:                String sTagName = topEl.getTagName();
231:
232:                if (sTagName.equals(TAG_DESCRIPTION)) {
233:                    try {
234:                        docEl = xmlDoc.createElement(sTagName);
235:                        txt = xmlDoc.createTextNode(getDescription());
236:                        docEl.appendChild(txt);
237:                    } catch (DataAccessException e) {
238:                        throw new PublishException(
239:                                "Error occured getting description", e);
240:                    }
241:                } else if (sTagName.equals(TAG_CODE)) {
242:                    try {
243:                        docEl = xmlDoc.createElement(sTagName);
244:                        txt = xmlDoc.createTextNode(getCode());
245:                        docEl.appendChild(txt);
246:                    } catch (DataAccessException e) {
247:                        throw new PublishException(
248:                                "Error occured getting code", e);
249:                    }
250:                } else {
251:                    // if we don't know about the tag, pass it up
252:                    docEl = super .publish(topEl, xmlDoc, state);
253:                }
254:
255:                return docEl;
256:            }
257:
258:            /* (non-Javadoc)
259:             * @see org.openharmonise.rm.publishing.Publishable#populate(org.w3c.dom.Element, org.openharmonise.rm.publishing.State)
260:             */
261:            public void populate(Element xmlElement, State state)
262:                    throws PopulateException {
263:                String sTagName = xmlElement.getTagName();
264:                Text txt;
265:
266:                if (sTagName.equalsIgnoreCase(TAG_CODE)) {
267:                    txt = (Text) xmlElement.getFirstChild();
268:                    setCode(txt.getNodeValue());
269:                } else if (sTagName.equalsIgnoreCase(TAG_DESCRIPTION)) {
270:                    txt = (Text) xmlElement.getFirstChild();
271:                    setDescription(txt.getNodeValue());
272:                } else {
273:                    super .populate(xmlElement, state);
274:                }
275:            }
276:
277:            /* (non-Javadoc)
278:             * @see org.openharmonise.rm.resources.AbstractChildObject#getParentObjectClassName()
279:             */
280:            public String getParentObjectClassName() {
281:                return ValueGroup.class.getName();
282:            }
283:
284:            /* (non-Javadoc)
285:             * @see org.openharmonise.rm.dsi.DataStoreObject#getDBTableName()
286:             */
287:            public String getDBTableName() {
288:
289:                return TBL_VALUE;
290:            }
291:
292:            /* (non-Javadoc)
293:             * @see org.openharmonise.rm.publishing.Publishable#getTagName()
294:             */
295:            public String getTagName() {
296:                return TAG_VALUE;
297:            }
298:
299:            /*-----------------------------------------------------------------
300:              Protected methods
301:              -----------------------------------------------------------------*/
302:
303:            /* (non-Javadoc)
304:             * @see org.openharmonise.rm.resources.AbstractEditableObject#addDataToSave(org.openharmonise.commons.dsi.dml.InsertStatement)
305:             */
306:            protected void addDataToSave(InsertStatement insert)
307:                    throws DataStoreException {
308:                super .addDataToSave(insert);
309:            }
310:
311:            /* (non-Javadoc)
312:             * @see org.openharmonise.rm.resources.AbstractEditableObject#saveNonCoreData()
313:             */
314:            protected void saveNonCoreData() throws EditException {
315:                // no non core data
316:
317:            }
318:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.