1 /** 2 * - Digitalis Internal Framework v2.0 - (C) 2007, Digitalis Informatica. Distribuicao e Gestao de Informatica, Lda. 3 * Estrada de Paco de Arcos num.9 - Piso -1 2780-666 Paco de Arcos Telefone: (351) 21 4408990 Fax: (351) 21 4408999 4 * http://www.digitalis.pt 5 */ 6 package pt.digitalis.dif.dem.interfaces; 7 8 import pt.digitalis.dif.controller.interfaces.IDIFContext; 9 import pt.digitalis.dif.dem.objects.EventType; 10 import pt.digitalis.dif.dem.objects.ViewObject; 11 import pt.digitalis.dif.dem.objects.parameters.errors.ParameterErrors; 12 import pt.digitalis.dif.exception.controller.BusinessFlowException; 13 import pt.digitalis.dif.exception.controller.ControllerException; 14 15 /** 16 * This interface represents a Stage entity on the DEM. 17 * <p> 18 * A Stage is related to a Service. 19 * 20 * @author Pedro Viegas <a href="mailto:pviegas@digitalis.pt">pviegas@digitalis.pt</a> 21 * @author Rodrigo Gonçalves <a href="mailto:rgoncalves@digitalis.pt">rgoncalves@digitalis.pt</a> 22 * @created 2007/07/12 23 */ 24 public interface IStageInstance extends IStage, IMessage { 25 26 /** 27 * The business logic executing method. 28 * <p> 29 * This method should define the Stage business logic. 30 * 31 * @param context 32 * the execution context 33 * @return a view 34 * @throws BusinessFlowException 35 * when an exception is thrown by the stage's init/execute steps 36 */ 37 public ViewObject _CG_execute(IDIFContext context) throws BusinessFlowException; 38 39 /** 40 * The finalization method. 41 * <p> 42 * This method should perform any tasks related to the Stage initialization. 43 * <p> 44 * Not to be confused with Java's own <code>protected void finalize() throws Throwable</code>. 45 * 46 * @param context 47 * the execution context 48 * @return T if finalization was successful, F otherwise 49 * @throws BusinessFlowException 50 * when an exception is thrown by the stage's init/execute steps 51 */ 52 public boolean _CG_finalize(IDIFContext context) throws BusinessFlowException; 53 54 /** 55 * The initialization method. 56 * <p> 57 * This method should perform any tasks related to the Stage initialization. 58 * 59 * @param context 60 * the execution context 61 * @return T if initialization went ok, F otherwise 62 * @throws BusinessFlowException 63 * when an exception is thrown by the stage's init/execute steps 64 */ 65 public boolean _CG_init(IDIFContext context) throws BusinessFlowException; 66 67 /** 68 * The method that will be enhanced with the call to the correct event method. 69 * 70 * @param context 71 * the execution context 72 * @param type 73 * the type of the fired event 74 * @param eventName 75 * the name of the event 76 * @return the object to return 77 */ 78 public Object callEventMethod(IDIFContext context, EventType type, String eventName); 79 80 /** 81 * The method that will be enhanced with the call to the method annotated with <code>@Execute</code>. 82 * 83 * @param context 84 * the execution context 85 * @return the view to return 86 */ 87 public ViewObject callExecuteMethod(IDIFContext context); 88 89 /** 90 * The method that will be enhanced with the call to the method annotated with <code>@Execute</code>. 91 * 92 * @param context 93 * the execution context 94 * @param type 95 * the type of the fired event 96 * @param eventName 97 * the name of the event 98 * @return the view to return 99 */ 100 public ViewObject callExecuteOnEventMethod(IDIFContext context, EventType type, String eventName); 101 102 /** 103 * Declares for the current stage instance that a given feature is enabled 104 * 105 * @param featureID 106 * the feature Id to declare active 107 */ 108 public void declareFeatureActive(String featureID); 109 110 /** 111 * Gets the authentication error after an initialization has occurred 112 * 113 * @return the controller error exception object 114 */ 115 public ControllerException getAuthenticationError(); 116 117 /** 118 * Returns the execution context. 119 * 120 * @return the execution context 121 */ 122 public IDIFContext getContext(); 123 124 /** 125 * Gets the parameter errors after a initialization has occurred 126 * 127 * @return the parameter errors object 128 */ 129 public ParameterErrors getParameterErrors(); 130 131 /** 132 * Validates if a given feature is active/present 133 * 134 * @param featureID 135 * the Id of the feature do validate is is present/active 136 * @return true if it is active/present 137 */ 138 public boolean isFeatureEnabled(String featureID); 139 140 /** 141 * @return T if the stage has already been initialized by calling the "_CG_init" method 142 */ 143 public boolean isInitialized(); 144 145 /** 146 * Sets the authentication error 147 * 148 * @param exception 149 * the authentication exception 150 */ 151 public void setAuthenticationError(ControllerException exception); 152 153 /** 154 * Sets the execution context on the Stage. 155 * 156 * @param context 157 * the execution context 158 */ 159 public void setContext(IDIFContext context); 160 161 /** 162 * Sets the parameter errors 163 * 164 * @param errors 165 * the errors object to set 166 */ 167 public void setParameterErrors(ParameterErrors errors); 168 169 /** 170 * Sets the associated proxy to call info upon 171 * 172 * @param proxy 173 * the proxy to set 174 */ 175 public void setProxy(IStage proxy); 176 }