001/* 002 * Copyright 2010 Anyware Services 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.ametys.cms.workflow; 017 018import com.opensymphony.workflow.FunctionProvider; 019import com.opensymphony.workflow.WorkflowException; 020 021/** 022 * {@link WorkflowException} which can be thrown in a {@link FunctionProvider} 023 * if the input is invalid.<p> 024 * <b>This is an validation error which will be handled in a special manner.</b> 025 */ 026public class InvalidInputWorkflowException extends WorkflowException 027{ 028 private final AllErrors _allErrors; 029 030 /** 031 * Constructs a new invalid input workflow exception with the specified 032 * detail message. 033 * @param allErrors The initial errors 034 * @param message The detail message. 035 */ 036 public InvalidInputWorkflowException(String message, AllErrors allErrors) 037 { 038 super(message); 039 _allErrors = allErrors; 040 } 041 042 /** 043 * Constructs a new invalid input workflow exception with the specified 044 * detail message and cause. 045 * @param message The detail message. 046 * @param allErrors The initial errors 047 * @param cause The cause. 048 */ 049 public InvalidInputWorkflowException(String message, AllErrors allErrors, Throwable cause) 050 { 051 super(message, cause); 052 _allErrors = allErrors; 053 } 054 055 /** 056 * Constructs a new invalid input workflow exception with the specified 057 * cause. 058 * @param allErrors The initial errors 059 * @param cause The cause. 060 */ 061 public InvalidInputWorkflowException(AllErrors allErrors, Throwable cause) 062 { 063 super(cause); 064 _allErrors = allErrors; 065 } 066 067 /** 068 * Get the errors that initiate the exception 069 * @return The errors 070 */ 071 public AllErrors getErrors() 072 { 073 return _allErrors; 074 } 075}