Source Code Cross Referenced for InvalidInputException.java in  » Workflow-Engines » OSWorkflow » com » opensymphony » workflow » 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 » OSWorkflow » com.opensymphony.workflow 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright (c) 2002-2003 by OpenSymphony
003:         * All rights reserved.
004:         */
005:        package com.opensymphony.workflow;
006:
007:        import java.util.*;
008:
009:        /**
010:         * Exception to indicate the user input is invalid. Handles both general errors and errors specific to an input.
011:         *
012:         * @author <a href="mailto:plightbo@hotmail.com">Patrick Lightbody</a>
013:         * @version $Revision: 1.2 $
014:         */
015:        public class InvalidInputException extends WorkflowException {
016:            //~ Instance fields ////////////////////////////////////////////////////////
017:
018:            private List genericErrors = new ArrayList();
019:            private Map errors = new HashMap();
020:
021:            //~ Constructors ///////////////////////////////////////////////////////////
022:
023:            public InvalidInputException() {
024:                super ();
025:            }
026:
027:            /**
028:             * Creates a new exception using the supplied Object
029:             * as a generic base. If the object is an instance of
030:             * this exception, all properties are copied to this
031:             * exception. If the object is an instance of Map or
032:             * String[], an errorName->errorMessage mapping will
033:             * be attempted to be extracted. If the object is
034:             * something else, it's toString() method will be
035:             * called and added as a single generic error.
036:             *
037:             * @param o the object
038:             */
039:            public InvalidInputException(Object o) {
040:                if (o instanceof  InvalidInputException) {
041:                    InvalidInputException iie = (InvalidInputException) o;
042:                    errors = iie.errors;
043:                    genericErrors = iie.genericErrors;
044:                } else if (o instanceof  Map) {
045:                    errors = (Map) o;
046:                } else if (o instanceof  String[]) {
047:                    String[] stringMap = (String[]) o;
048:                    int length = stringMap.length;
049:                    String name = null;
050:
051:                    for (int i = 0; i < length; i++) {
052:                        if ((i % 2) == 0) {
053:                            name = stringMap[i];
054:                        } else {
055:                            addError(name, stringMap[i]);
056:                        }
057:                    }
058:                } else {
059:                    addError(o.toString());
060:                }
061:            }
062:
063:            /**
064:             * Creates a new exception with an associated generic error.
065:             *
066:             * @param error a generic error message
067:             */
068:            public InvalidInputException(String error) {
069:                super (error);
070:                addError(error);
071:            }
072:
073:            /**
074:             * Creates a new exception with an error specific to an input.
075:             *
076:             * @param name the input name that contains the error
077:             * @param error an error about the given name
078:             */
079:            public InvalidInputException(String name, String error) {
080:                super ();
081:                addError(name, error);
082:            }
083:
084:            //~ Methods ////////////////////////////////////////////////////////////////
085:
086:            /**
087:             * Returns a map (String->String) of the input-specific errors.
088:             *
089:             * @return a map (String->String) of the input-specific errors
090:             */
091:            public Map getErrors() {
092:                return errors;
093:            }
094:
095:            /**
096:             * Returns a list (String) of generic errors.
097:             *
098:             * @return A list (String) of generic errors
099:             */
100:            public List getGenericErrors() {
101:                return genericErrors;
102:            }
103:
104:            /**
105:             * Adds a generic error.
106:             *
107:             * @param error the generic error message
108:             */
109:            public void addError(String error) {
110:                genericErrors.add(error);
111:            }
112:
113:            /**
114:             * Adds an input-specific error.
115:             *
116:             * @param name the name of the input
117:             * @param error the error message
118:             */
119:            public void addError(String name, String error) {
120:                errors.put(name, error);
121:            }
122:
123:            public String toString() {
124:                return "[InvalidInputException: [Error map: [" + errors
125:                        + "]] [Error list: [" + genericErrors + "]]";
126:            }
127:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.