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 org.ametys.runtime.parameter.ValidationResults; 019 020import com.opensymphony.workflow.FunctionProvider; 021import com.opensymphony.workflow.WorkflowException; 022 023/** 024 * {@link WorkflowException} which can be thrown in a {@link FunctionProvider} 025 * if the input is invalid.<p> 026 * <b>This is an validation error which will be handled in a special manner.</b> 027 */ 028public class InvalidInputWorkflowException extends WorkflowException 029{ 030 private final ValidationResults _validationResults; 031 032 /** 033 * Constructs a new invalid input workflow exception with the specified 034 * detail message. 035 * @param validationResults The validation results 036 * @param message The detail message. 037 */ 038 public InvalidInputWorkflowException(String message, ValidationResults validationResults) 039 { 040 super(message); 041 _validationResults = validationResults; 042 } 043 044 /** 045 * Constructs a new invalid input workflow exception with the specified 046 * detail message and cause. 047 * @param message The detail message. 048 * @param validationResults The validation results 049 * @param cause The cause. 050 */ 051 public InvalidInputWorkflowException(String message, ValidationResults validationResults, Throwable cause) 052 { 053 super(message, cause); 054 _validationResults = validationResults; 055 } 056 057 /** 058 * Constructs a new invalid input workflow exception with the specified 059 * cause. 060 * @param validationResults The validation results 061 * @param cause The cause. 062 */ 063 public InvalidInputWorkflowException(ValidationResults validationResults, Throwable cause) 064 { 065 super(cause); 066 _validationResults = validationResults; 067 } 068 069 /** 070 * Get the validation results that initiate the exception 071 * @return The validation results 072 */ 073 public ValidationResults getValidationResults() 074 { 075 return _validationResults; 076 } 077}