Source Code Cross Referenced for ValueGroup.java in  » Content-Management-System » harmonise » org » openharmonise » vfs » metadata » range » 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.vfs.metadata.range 
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.vfs.metadata.range;
020:
021:        import java.util.ArrayList;
022:        import java.util.Iterator;
023:        import java.util.List;
024:
025:        import org.openharmonise.vfs.metadata.*;
026:        import org.w3c.dom.Element;
027:        import org.w3c.dom.Node;
028:        import org.w3c.dom.NodeList;
029:        import org.w3c.dom.Text;
030:
031:        /**
032:         * Represents a value group in a vocabulary.
033:         * 
034:         * @author Matthew Large
035:         * @version $Revision: 1.1 $
036:         *
037:         */
038:        public class ValueGroup {
039:
040:            /**
041:             * Full path to the virtual file for this value group.
042:             */
043:            private String m_sHREF;
044:
045:            /**
046:             * Name.
047:             */
048:            private String m_sName;
049:
050:            /**
051:             * Display name.
052:             */
053:            private String m_sDisplayName;
054:
055:            /**
056:             * List of the full paths to the virtual files for values that are under this value group
057:             */
058:            private ArrayList m_aChildren = new ArrayList();
059:
060:            /**
061:             * List of the full paths to the virtual files for value groups that are under this value group.
062:             */
063:            private ArrayList m_aSubGroups = new ArrayList();
064:
065:            /**
066:             * 
067:             */
068:            public ValueGroup() {
069:                super ();
070:            }
071:
072:            /**
073:             * Constructs a new value group.
074:             * 
075:             * @param sName Name
076:             * @param sHREF Full path
077:             */
078:            public ValueGroup(String sName, String sHREF) {
079:                super ();
080:                this .m_sName = sName;
081:                this .m_sHREF = sHREF;
082:            }
083:
084:            /**
085:             * Returns the display name for this value group.
086:             * 
087:             * @return Display name
088:             */
089:            public String getDisplayName() {
090:                return this .m_sDisplayName;
091:            }
092:
093:            /**
094:             * Sets the display name for this value group.
095:             * 
096:             * @param sDisplayName Display name
097:             */
098:            public void setDisplayName(String sDisplayName) {
099:                this .m_sDisplayName = sDisplayName;
100:            }
101:
102:            /**
103:             * Sets the name for this value group.
104:             * 
105:             * @param sName Name
106:             */
107:            public void setName(String sName) {
108:                this .m_sName = sName;
109:            }
110:
111:            /**
112:             * Returns the name for this value group.
113:             * 
114:             * @return Name
115:             */
116:            public String getName() {
117:                return this .m_sName;
118:            }
119:
120:            /**
121:             * Returns the full path to the virtual file for this value group.
122:             * 
123:             * @return Full path
124:             */
125:            public String getHREF() {
126:                return this .m_sHREF;
127:            }
128:
129:            /**
130:             * Adds a full path to the virtual file for a value.
131:             * 
132:             * @param sHREF Full path to add
133:             */
134:            public void addChild(String sHREF) {
135:                this .m_aChildren.add(sHREF);
136:            }
137:
138:            /**
139:             * Adds a full path to the virtual file for a value group.
140:             * 
141:             * @param sHREF Full path to add
142:             */
143:            public void addSubGroup(String sHREF) {
144:                this .m_aSubGroups.add(sHREF);
145:            }
146:
147:            /**
148:             * List of {@link Value} objects which are under this value group.
149:             * 
150:             * @return List of values
151:             */
152:            public List getChildren() {
153:                ArrayList vals = new ArrayList();
154:                Iterator itor = m_aChildren.iterator();
155:                while (itor.hasNext()) {
156:                    String sHREF = (String) itor.next();
157:                    vals.add(ValueCache.getInstance().getValue(sHREF));
158:                }
159:
160:                return vals;
161:            }
162:
163:            /**
164:             * Returns a list of {@link ValueGroup} objects which are under this
165:             * value group.
166:             * 
167:             * @return List of value groups
168:             */
169:            public List getSubGroups() {
170:                ArrayList vals = new ArrayList();
171:                Iterator itor = m_aSubGroups.iterator();
172:                while (itor.hasNext()) {
173:                    String sHREF = (String) itor.next();
174:                    vals.add(ValueCache.getInstance().getValueGroup(sHREF));
175:                }
176:
177:                return vals;
178:            }
179:
180:            public void instantiate(Element elValue) {
181:                this .m_sName = elValue
182:                        .getAttributeNS(
183:                                "http://www.simulacramedia.com/harmoniseclient/propdefs",
184:                                "name");
185:                NodeList nl = elValue.getChildNodes();
186:                for (int i = 0; i < nl.getLength(); i++) {
187:                    Node node = nl.item(i);
188:                    if (node.getNodeType() == Node.ELEMENT_NODE) {
189:                        Element element = (Element) node;
190:                        if (element.getLocalName().equalsIgnoreCase(
191:                                "displayname")) {
192:                            Node node2 = element.getFirstChild();
193:                            if (node2.getNodeType() == Node.TEXT_NODE) {
194:                                this .m_sDisplayName = ((Text) node2)
195:                                        .getNodeValue();
196:                            }
197:                        } else if (element.getLocalName().equalsIgnoreCase(
198:                                "href")) {
199:                            Node node2 = element.getFirstChild();
200:                            if (node2.getNodeType() == Node.TEXT_NODE) {
201:                                this .m_sHREF = ((Text) node2).getNodeValue();
202:                            }
203:                        } else if (element.getLocalName().equalsIgnoreCase(
204:                                "children")) {
205:                            NodeList nl2 = element.getChildNodes();
206:                            for (int j = 0; j < nl2.getLength(); j++) {
207:                                Node childNode = (Node) nl2.item(j);
208:                                if (childNode.getNodeType() == Node.ELEMENT_NODE) {
209:                                    Element childElement = (Element) childNode;
210:                                    Node node2 = childElement.getFirstChild();
211:                                    if (node2.getNodeType() == Node.TEXT_NODE) {
212:                                        String sTemp = ((Text) node2)
213:                                                .getNodeValue();
214:                                        this .m_aChildren.add(sTemp.trim());
215:                                    }
216:                                }
217:                            }
218:                        } else if (element.getLocalName().equalsIgnoreCase(
219:                                "subgroups")) {
220:                            NodeList nl2 = element.getChildNodes();
221:                            for (int j = 0; j < nl2.getLength(); j++) {
222:                                Node childNode = (Node) nl2.item(j);
223:                                if (childNode.getNodeType() == Node.ELEMENT_NODE) {
224:                                    Element childElement = (Element) childNode;
225:                                    Node node2 = childElement.getFirstChild();
226:                                    if (node2.getNodeType() == Node.TEXT_NODE) {
227:                                        String sTemp = ((Text) node2)
228:                                                .getNodeValue();
229:                                        this .m_aSubGroups.add(sTemp.trim());
230:                                    }
231:                                }
232:                            }
233:                        }
234:                    }
235:                }
236:            }
237:
238:            public String toString() {
239:                StringBuffer sBuff = new StringBuffer();
240:
241:                sBuff.append("ValueGroup: [").append(this .m_sName)
242:                        .append("]\n").append("DisplayName: ").append(
243:                                this .m_sDisplayName).append("\n").append(
244:                                "Path: ").append(this .m_sHREF).append("\n");
245:
246:                Iterator itor = this .m_aSubGroups.iterator();
247:                while (itor.hasNext()) {
248:                    String sHREF = (String) itor.next();
249:                    sBuff.append(sHREF);
250:                }
251:
252:                itor = this .m_aChildren.iterator();
253:                while (itor.hasNext()) {
254:                    String sHREF = (String) itor.next();
255:                    sBuff.append(sHREF);
256:                }
257:
258:                return sBuff.toString();
259:            }
260:
261:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.