1 /** 2 * 2008, Digitalis Informatica. All rights reserved. Distribuicao e Gestao de Informatica, Lda. Estrada de Paco de Arcos 3 * num.9 - Piso -1 2780-666 Paco de Arcos Telefone: (351) 21 4408990 Fax: (351) 21 4408999 http://www.digitalis.pt 4 */ 5 6 package pt.digitalis.dif.dem.objects.parameters.rules; 7 8 import java.util.List; 9 10 import pt.digitalis.dif.dem.interfaces.IStageInstance; 11 import pt.digitalis.dif.dem.objects.parameters.types.AbstractParameter; 12 import pt.digitalis.dif.exception.objects.ParameterException; 13 14 /** 15 * A parameter rule object 16 * 17 * @author Pedro Viegas <a href="mailto:pviegas@digitalis.pt">pviegas@digitalis.pt</a><br/> 18 * @param <T> 19 * generic type of the parameter 20 * @created Mar 31, 2009 21 */ 22 public interface IParameterRule<T> { 23 24 /** 25 * Inspector for the 'action' attribute. 26 * 27 * @return the action value 28 */ 29 public ParameterRuleAction getAction(); 30 31 /** 32 * Inspector for the 'descriptionEndValue' attribute. 33 * 34 * @return the descriptionEndValue value 35 */ 36 public String getDescriptionEndValue(); 37 38 /** 39 * Inspector for the 'descriptionStartValue' attribute. 40 * 41 * @return the descriptionStartValue value 42 */ 43 public String getDescriptionStartValue(); 44 45 /** 46 * Inspector for the 'descriptionValue' attribute. 47 * 48 * @return the descriptionValue value 49 */ 50 public String getDescriptionValue(); 51 52 /** 53 * Inspector for the 'endValue' attribute. 54 * 55 * @return the endValue value 56 */ 57 public String getEndValue(); 58 59 /** 60 * Inspector for the 'parameters' attribute. 61 * 62 * @return the parameters value 63 */ 64 public List<String> getParameters(); 65 66 /** 67 * Inspector for the 'startValue' attribute. 68 * 69 * @return the startValue value 70 */ 71 public String getStartValue(); 72 73 /** 74 * Gets the validation result for the present parameter 75 * 76 * @param stage 77 * the current stage 78 * @param value 79 * the value to validate 80 * @param initializationInProgress 81 * T if called within the dif parameter initialization 82 * @param parameter 83 * the parameter for validation 84 * @return the validation rule validation result 85 * @throws ParameterException 86 * if the parameter does not exist 87 */ 88 public ParameterRuleResult getValidationResult(IStageInstance stage, T value, boolean initializationInProgress, 89 AbstractParameter<T> parameter) throws ParameterException; 90 91 /** 92 * Inspector for the 'value' attribute. 93 * 94 * @return the value value 95 */ 96 public String getValue(); 97 98 /** 99 * Initializer 100 * 101 * @param parameterID 102 * the rule parameter ID 103 * @param parameters 104 * the list of parameters relevant for the given rule (besides the current parameter) 105 * @param action 106 * the action to perform according to the rule activation (valid or invalid) 107 * @param value 108 * the value for comparison 109 * @param first 110 * the first value for interval comparison 111 * @param last 112 * the last value for interval comparison 113 * @return the initialized object 114 */ 115 public AbstractParameterRule<T> init(String parameterID, String parameters, ParameterRuleAction action, 116 String value, String first, String last); 117 118 /** 119 * Modifier for the 'descriptionEndValue' attribute. 120 * 121 * @param descriptionEndValue 122 * the new descriptionEndValue value to set 123 */ 124 public void setDescriptionEndValue(String descriptionEndValue); 125 126 /** 127 * Modifier for the 'descriptionStartValue' attribute. 128 * 129 * @param descriptionStartValue 130 * the new descriptionStartValue value to set 131 */ 132 public void setDescriptionStartValue(String descriptionStartValue); 133 134 /** 135 * Modifier for the 'descriptionValue' attribute. 136 * 137 * @param descriptionValue 138 * the new descriptionValue value to set 139 */ 140 public void setDescriptionValue(String descriptionValue); 141 142 /** 143 * Modifier for the 'endValue' attribute. 144 * 145 * @param endValue 146 * the new endValue value to set 147 * @return the updated parameter rule instance 148 */ 149 public AbstractParameterRule<T> setEndValue(String endValue); 150 151 /** 152 * Modifier for the 'startValue' attribute. 153 * 154 * @param startValue 155 * the new startValue value to set 156 * @return the updated parameter rule instance 157 */ 158 public AbstractParameterRule<T> setStartValue(String startValue); 159 160 /** 161 * Modifier for the 'value' attribute. 162 * 163 * @param value 164 * the new value value to set 165 * @return the updated parameter rule instance 166 */ 167 public AbstractParameterRule<T> setValue(String value); 168 }