Source Code Cross Referenced for ConsoleParameterHolder.java in  » Workflow-Engines » JFolder » org » jfolder » common » web » template » 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 » Workflow Engines » JFolder » org.jfolder.common.web.template 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * JFolder, Copyright 2001-2006 Gary Steinmetz
003:         *
004:         * Distributable under LGPL license.
005:         * See terms of license at gnu.org.
006:         */
007:
008:        package org.jfolder.common.web.template;
009:
010:        //base classes
011:        import java.util.ArrayList;
012:
013:        //project specific classes
014:        import org.jfolder.common.UnexpectedSystemException;
015:        import org.jfolder.common.web.template.ConsoleParameterContext;
016:
017:        //other classes
018:
019:        public class ConsoleParameterHolder implements  ConsoleParameterContext {
020:
021:            //
022:            private ArrayList parameters = null;
023:
024:            //
025:            private ConsoleParameterHolder() {
026:                //
027:                this .parameters = new ArrayList();
028:            }
029:
030:            public final static ConsoleParameterHolder newInstance() {
031:                //
032:                return new ConsoleParameterHolder();
033:            }
034:
035:            //
036:            //
037:            //
038:            public int hashCode() {
039:
040:                int outValue = 0;
041:
042:                outValue += this .parameters.hashCode();
043:
044:                return outValue;
045:            }
046:
047:            public boolean equals(Object inObj) {
048:
049:                boolean outValue = true;
050:
051:                if (inObj instanceof  ConsoleParameterHolder) {
052:                    ConsoleParameterHolder nextCph = ((ConsoleParameterHolder) inObj);
053:                    outValue &= (this .parameters.equals(nextCph.parameters));
054:                } else {
055:                    outValue &= false;
056:                }
057:
058:                return outValue;
059:            }
060:
061:            public final static ArrayList getIndexes() {
062:
063:                ArrayList outValue = new ArrayList();
064:
065:                outValue.add(FIRST_INPUT);
066:                outValue.add(SECOND_INPUT);
067:                outValue.add(THIRD_INPUT);
068:                outValue.add(FOURTH_INPUT);
069:                outValue.add(FIFTH_INPUT);
070:                outValue.add(SIXTH_INPUT);
071:                outValue.add(SEVENTH_INPUT);
072:                outValue.add(EIGHTH_INPUT);
073:                outValue.add(NINTH_INPUT);
074:                outValue.add(TENTH_INPUT);
075:
076:                return outValue;
077:            }
078:
079:            private boolean isIndexPresent(Integer inIndex) {
080:
081:                boolean outValue = false;
082:
083:                ArrayList indexes = getIndexes();
084:                int index = indexes.indexOf(inIndex);
085:                if (index != -1) {
086:                    Object value = indexes.get(index);
087:                    outValue = (inIndex == value);
088:                }
089:
090:                return outValue;
091:            }
092:
093:            public final static Integer getFirstIndex() {
094:                return FIRST_INPUT;
095:            }
096:
097:            public Integer getNextIndex(Integer inIndex) {
098:
099:                Integer outValue = null;
100:
101:                ArrayList indexes = getIndexes();
102:
103:                int index = inIndex.intValue();
104:                if (index < (this .parameters.size() - 1)) {
105:                    outValue = ((Integer) indexes.get(index + 1));
106:                }
107:
108:                return outValue;
109:            }
110:
111:            public int getIndexCount() {
112:                return this .parameters.size();
113:            }
114:
115:            //private void initializeGenericAll(Object inValue) {
116:            //    this.parameters.clear();
117:            //    ArrayList indexes = getIndexes();
118:            //    for (int i = 0; i < indexes.size(); i++) {
119:            //        Integer nextIndex = ((Integer)indexes.get(i));
120:            //        addGenericInput(nextIndex, inValue);
121:            //    }
122:            //}
123:
124:            //
125:            public Object getInput(Integer inIndex) {
126:
127:                Object outValue = null;
128:
129:                if (inIndex.intValue() >= MAX_CREATION_PARAMS) {
130:                    throw new UnexpectedSystemException(
131:                            "There can be no more than '" + MAX_CREATION_PARAMS
132:                                    + "' parameters");
133:                } else if (inIndex.intValue() < 0) {
134:                    throw new UnexpectedSystemException("Index '"
135:                            + (inIndex.intValue() + 1) + "' must be at least 1");
136:                } else if (!isIndexPresent(inIndex)) {
137:                    throw new UnexpectedSystemException(
138:                            "Only indexes found in ConsoleParameterContext can be used");
139:                } else if (inIndex.intValue() < this .parameters.size()) {
140:                    outValue = this .parameters.get(inIndex.intValue());
141:                } else {
142:                    outValue = null;
143:                    //throw new UnexpectedSystemException(
144:                    //    "Trying to get value at index '" + (inIndex.intValue() + 1)
145:                    //        + "' but the last index of the array is '"
146:                    //        + (this.parameters.size()) + "'");
147:                }
148:
149:                return outValue;
150:            }
151:
152:            //
153:            public void addInput(Integer inIndex, String inValue) {
154:                addGenericInput(inIndex, inValue);
155:            }
156:
157:            public void addInput(Integer inIndex,
158:                    CreationParameterContextInput inValue) {
159:                //
160:                addGenericInput(inIndex, inValue);
161:            }
162:
163:            //public void addInput(Integer inIndex, String inValue[]) {
164:            //    addGenericInput(inIndex, inValue);
165:            //}
166:            private void addGenericInput(Integer inIndex, Object inValue) {
167:                if (inIndex.intValue() >= MAX_CREATION_PARAMS) {
168:                    throw new UnexpectedSystemException(
169:                            "There can be no more than '" + MAX_CREATION_PARAMS
170:                                    + "' parameters");
171:                } else if (inIndex.intValue() < 0) {
172:                    throw new UnexpectedSystemException("Index '"
173:                            + (inIndex.intValue() + 1) + "' must be at least 1");
174:                } else if (!isIndexPresent(inIndex)) {
175:                    throw new UnexpectedSystemException(
176:                            "Only indexes found in ConsoleParameterContext can be used");
177:                } else if (inIndex.intValue() == this .parameters.size()) {
178:                    this .parameters.add(inValue);
179:                } else {
180:                    throw new UnexpectedSystemException(
181:                            "Trying to add at index '"
182:                                    + (inIndex.intValue() + 1)
183:                                    + "' but the last index of the array is '"
184:                                    + (this .parameters.size()) + "'");
185:                }
186:            }
187:
188:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.