001: /*
002: * $Id: ServiceValidationException.java,v 1.3 2004/03/12 23:45:01 ajzeneski Exp $
003: *
004: * Copyright (c) 2001, 2002 The Open For Business Project - www.ofbiz.org
005: *
006: * Permission is hereby granted, free of charge, to any person obtaining a
007: * copy of this software and associated documentation files (the "Software"),
008: * to deal in the Software without restriction, including without limitation
009: * the rights to use, copy, modify, merge, publish, distribute, sublicense,
010: * and/or sell copies of the Software, and to permit persons to whom the
011: * Software is furnished to do so, subject to the following conditions:
012: *
013: * The above copyright notice and this permission notice shall be included
014: * in all copies or substantial portions of the Software.
015: *
016: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
017: * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
018: * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
019: * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
020: * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
021: * OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
022: * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
023: *
024: */
025: package org.ofbiz.service;
026:
027: import java.util.List;
028: import java.util.ArrayList;
029:
030: /**
031: * ServiceValidationException
032: *
033: * @author <a href="mailto:jaz@ofbiz.org">Andy Zeneski</a>
034: * @version $Revision: 1.3 $
035: * @since 2.0
036: */
037: public class ServiceValidationException extends GenericServiceException {
038:
039: protected List missingFields = new ArrayList();
040: protected List extraFields = new ArrayList();
041: protected String errorMode = null;
042: protected ModelService service = null;
043:
044: protected ServiceValidationException() {
045: super ();
046: }
047:
048: public ServiceValidationException(ModelService service,
049: List missingFields, List extraFields, String errorMode) {
050: super ();
051: this .service = service;
052: this .errorMode = errorMode;
053: if (missingFields != null) {
054: this .missingFields = missingFields;
055: }
056: if (extraFields != null) {
057: this .extraFields = extraFields;
058: }
059: }
060:
061: protected ServiceValidationException(String str) {
062: super (str);
063: }
064:
065: public ServiceValidationException(String str, ModelService service,
066: List missingFields, List extraFields, String errorMode) {
067: super (str);
068: this .service = service;
069: this .errorMode = errorMode;
070: if (missingFields != null) {
071: this .missingFields = missingFields;
072: }
073: if (extraFields != null) {
074: this .extraFields = extraFields;
075: }
076: }
077:
078: protected ServiceValidationException(String str, Throwable nested) {
079: super (str, nested);
080: }
081:
082: public ServiceValidationException(String str, Throwable nested,
083: ModelService service, List missingFields, List extraFields,
084: String errorMode) {
085: super (str, nested);
086: this .service = service;
087: this .errorMode = errorMode;
088: if (missingFields != null) {
089: this .missingFields = missingFields;
090: }
091: if (extraFields != null) {
092: this .extraFields = extraFields;
093: }
094: }
095:
096: public List getExtraFields() {
097: return extraFields;
098: }
099:
100: public List getMissingFields() {
101: return missingFields;
102: }
103:
104: public ModelService getModelService() {
105: return service;
106: }
107:
108: public String getMode() {
109: return errorMode;
110: }
111:
112: public String getServiceName() {
113: if (service != null) {
114: return service.name;
115: } else {
116: return null;
117: }
118: }
119: }
|