pt.digitalis.dif.codegen.templates
Class StageCGTemplate

java.lang.Object
  extended by pt.digitalis.dif.codegen.templates.StageCGTemplate
All Implemented Interfaces:
ICallback, IEntity, IRegistrable, IStage

public class StageCGTemplate
extends Object
implements IStage

This class is a template for the IStage interface method implementations. The CodeGen will copy these methods to a new Proxy class for each stage. Some methods will be copied "as is", other will be tweaked. These Proxy classes are intended to be Singletons kept by the IDEMRegistry

Author:
Pedro Viegas pviegas@digitalis.pt, Rodrigo Gonçalves rgoncalves@digitalis.pt
Created on:
2007/07/12

Field Summary
static Map<String,ViewObject> errorViews
          Relates the exception types with the views for redirection purposes upon an exception raising.
protected static boolean isInitialized
          Controls the lazy initializations of this stage proxy...
 
Constructor Summary
StageCGTemplate()
           
 
Method Summary
protected  void addEvent(EventType type, String id)
          Adds a new event id to the known handlers
protected  ViewObject createView(String engine, String type, String target, boolean isDefault)
          Creates a new view object.
 CallbackType getCallbackType()
          Returns the Entity's callback type.
 IStage getDefaultErrorStage()
          Returns the default error Stage defined for this Stage
 ViewObject getDefaultErrorView()
          Returns the default error view defined for this Stage.
 ViewObject getDefaultView()
          Returns the default view.
 Map<EventType,List<String>> getEventHandlers()
          Returns the list of all the Stages submit handlers.
 String getID()
          Returns the Entity ID.
 Map<String,String> getInjectedErrorStages()
          Returns the list of all the error Stages injected in this Stage.
 Map<String,ViewObject> getInjectedErrorViews()
          Returns the list of all the error views injected in this Stage.
 List<String> getInjectedStages()
          Returns the list of all the Stages injected in this Stage.
 List<ViewObject> getInjectedViews()
          Returns the list of all the views injected in this Stage.
 IStageInstance getInstance()
          Return an instance of the stage for execution
 LicenseEditionType getLicenseEdition()
          Get the License Edition.
 String getMessageForLanguage(String language, String messageID)
          Returns a message associated with a given ID
 Map<String,String> getMessagesForLanguage(String language)
          Returns all messages associated with the Entity.
 String getName()
          Returns the Entity name.
 String getOriginalClassName()
          Returns the original entity class name
 String getOverridesStageID()
           
 IParameters getParameters()
          Returns the parameters for the current stage
 IService getService()
          Returns the Stage service.
 String getStageInstanceClassName()
          Obtains the original stage class name
protected  TemplateResources getTemplateResources()
          For usage of the CG methods
 String getUID()
          Returns the entity's unique ID.
 boolean hasAuthentication()
          Defines if the stage has authentication.
 boolean hasAuthenticationErrorInjection()
          Registers if the stage has injected the authentication errors.
 boolean hasAuthorization()
          Defines if the stage has authorization.
 boolean hasCallbackEnabled()
          Returns information about the Entity's callback state.
 boolean hasInjectedContributions()
           
 boolean hasParameterErrorInjection()
          Registers if the stage has injected the parameter errors.
 boolean hasValidationLogicForForm(String formName)
          Checks if the current form has a validation logic handler for the given form
 boolean isRegistered()
          Returns information about if the Entity is registered.
 boolean isRegistrable()
          Returns information about if the Entity can be registered.
protected  void lazyStageProxyInitialization(IStageInstance stage)
          The lazy initializations for all stages.
 boolean register(String name, String key)
          Registers the Entity with a given key.
 void unregister()
          Unregisters the Entity.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

errorViews

public static Map<String,ViewObject> errorViews
Relates the exception types with the views for redirection purposes upon an exception raising.


isInitialized

protected static boolean isInitialized
Controls the lazy initializations of this stage proxy...

Constructor Detail

StageCGTemplate

public StageCGTemplate()
Method Detail

addEvent

protected void addEvent(EventType type,
                        String id)
Adds a new event id to the known handlers

Parameters:
type - the event type to add
id - the id of the event

createView

protected ViewObject createView(String engine,
                                String type,
                                String target,
                                boolean isDefault)
Creates a new view object. For usage of the CG methods

Parameters:
engine - the engine of the view
type - the type of the view
target - the target resource/template of the view
isDefault - T if the view is the default view
Returns:
the created view object

getCallbackType

public CallbackType getCallbackType()
Description copied from interface: ICallback
Returns the Entity's callback type. The default value is OFF.

Specified by:
getCallbackType in interface ICallback
Returns:
the callback type defined for the Entity.
See Also:
ICallback.getCallbackType()

getDefaultErrorStage

public IStage getDefaultErrorStage()
Description copied from interface: IStage
Returns the default error Stage defined for this Stage

Specified by:
getDefaultErrorStage in interface IStage
Returns:
the default error Stage
See Also:
IStage.getDefaultErrorStage()

getDefaultErrorView

public ViewObject getDefaultErrorView()
Description copied from interface: IStage
Returns the default error view defined for this Stage.

Specified by:
getDefaultErrorView in interface IStage
Returns:
the default error view
See Also:
IStage.getDefaultErrorView()

getDefaultView

public ViewObject getDefaultView()
Description copied from interface: IStage
Returns the default view.

Specified by:
getDefaultView in interface IStage
Returns:
the default view
See Also:
IStage.getDefaultView()

getEventHandlers

public Map<EventType,List<String>> getEventHandlers()
Description copied from interface: IStage
Returns the list of all the Stages submit handlers.

Specified by:
getEventHandlers in interface IStage
Returns:
the list
See Also:
IStage.getEventHandlers()

getID

public String getID()
Description copied from interface: IEntity
Returns the Entity ID.

Specified by:
getID in interface IEntity
Returns:
the Entity ID
See Also:
IEntity.getID()

getInjectedErrorStages

public Map<String,String> getInjectedErrorStages()
Description copied from interface: IStage
Returns the list of all the error Stages injected in this Stage.

Specified by:
getInjectedErrorStages in interface IStage
Returns:
the list of all the injected Stages
See Also:
IStage.getInjectedErrorStages()

getInjectedErrorViews

public Map<String,ViewObject> getInjectedErrorViews()
Description copied from interface: IStage
Returns the list of all the error views injected in this Stage.

Specified by:
getInjectedErrorViews in interface IStage
Returns:
the list of all the injected ViewObject
See Also:
IStage.getInjectedErrorViews()

getInjectedStages

public List<String> getInjectedStages()
Description copied from interface: IStage
Returns the list of all the Stages injected in this Stage.

Specified by:
getInjectedStages in interface IStage
Returns:
the list of all the injected Stages
See Also:
IStage.getInjectedStages()

getInjectedViews

public List<ViewObject> getInjectedViews()
Description copied from interface: IStage
Returns the list of all the views injected in this Stage.

Specified by:
getInjectedViews in interface IStage
Returns:
the list of all the injected ViewObject
See Also:
IStage.getInjectedViews()

getInstance

public IStageInstance getInstance()
Description copied from interface: IStage
Return an instance of the stage for execution

Specified by:
getInstance in interface IStage
Returns:
the stage instance
See Also:
IStage.getInstance()

getLicenseEdition

public LicenseEditionType getLicenseEdition()
Description copied from interface: IRegistrable
Get the License Edition.

Specified by:
getLicenseEdition in interface IRegistrable
Returns:
LicenseEditionType
See Also:
IRegistrable.getLicenseEdition()

getMessageForLanguage

public String getMessageForLanguage(String language,
                                    String messageID)
Description copied from interface: IStage
Returns a message associated with a given ID

Specified by:
getMessageForLanguage in interface IStage
Parameters:
language - the language to get the messages in
messageID - the message ID
Returns:
the message with the given id
See Also:
IStage.getMessageForLanguage(java.lang.String, java.lang.String)

getMessagesForLanguage

public Map<String,String> getMessagesForLanguage(String language)
Description copied from interface: IStage
Returns all messages associated with the Entity.

Specified by:
getMessagesForLanguage in interface IStage
Parameters:
language - the language to get the messages in
Returns:
a map with all the messages related to the Entity
See Also:
IStage.getMessagesForLanguage(java.lang.String)

getName

public String getName()
Description copied from interface: IEntity
Returns the Entity name.

Specified by:
getName in interface IEntity
Returns:
the Entity name
See Also:
IEntity.getName()

getOriginalClassName

public String getOriginalClassName()
Description copied from interface: IEntity
Returns the original entity class name

Specified by:
getOriginalClassName in interface IEntity
Returns:
the class name
See Also:
IEntity.getOriginalClassName()

getOverridesStageID

public String getOverridesStageID()
Specified by:
getOverridesStageID in interface IStage
Returns:
the stage id of the stage that the present one overrides. Null otherwise.
See Also:
IStage.getOverridesStageID()

getParameters

public IParameters getParameters()
Description copied from interface: IStage
Returns the parameters for the current stage

Specified by:
getParameters in interface IStage
Returns:
the parameters
See Also:
IStage.getParameters()

getService

public IService getService()
Description copied from interface: IStage
Returns the Stage service.

Specified by:
getService in interface IStage
Returns:
the Stage service
See Also:
IStage.getService()

getStageInstanceClassName

public String getStageInstanceClassName()
Description copied from interface: IStage
Obtains the original stage class name

Specified by:
getStageInstanceClassName in interface IStage
Returns:
the class name
See Also:
IStage.getStageInstanceClassName()

getTemplateResources

protected TemplateResources getTemplateResources()
For usage of the CG methods

Returns:
an instance of template resources

getUID

public String getUID()
Description copied from interface: IEntity
Returns the entity's unique ID. The unique ID has the form ":".

Specified by:
getUID in interface IEntity
Returns:
the entity's UID
See Also:
IEntity.getUID()

hasAuthentication

public boolean hasAuthentication()
Description copied from interface: IStage
Defines if the stage has authentication.

Specified by:
hasAuthentication in interface IStage
Returns:
T if the stage has , F otherwise
See Also:
IStage.hasAuthentication()

hasAuthenticationErrorInjection

public boolean hasAuthenticationErrorInjection()
Description copied from interface: IStage
Registers if the stage has injected the authentication errors. If so the dispatcher will not fail on authentication errors and instead inject them so the stage may process them.

Specified by:
hasAuthenticationErrorInjection in interface IStage
Returns:
T if the stage has injected the authentication errors onto an attribute
See Also:
IStage.hasAuthenticationErrorInjection()

hasAuthorization

public boolean hasAuthorization()
Description copied from interface: IStage
Defines if the stage has authorization.

Specified by:
hasAuthorization in interface IStage
Returns:
T if the stage has , F otherwise
See Also:
IStage.hasAuthorization()

hasCallbackEnabled

public boolean hasCallbackEnabled()
Description copied from interface: ICallback
Returns information about the Entity's callback state. The default value is F.

Specified by:
hasCallbackEnabled in interface ICallback
Returns:
T if Entity has Callback enabled, F otherwise
See Also:
ICallback.hasCallbackEnabled()

hasInjectedContributions

public boolean hasInjectedContributions()
Specified by:
hasInjectedContributions in interface IStage
Returns:
T if any attribute or method in annotated with Inject
See Also:
IStage.hasInjectedContributions()

hasParameterErrorInjection

public boolean hasParameterErrorInjection()
Description copied from interface: IStage
Registers if the stage has injected the parameter errors. If not the framework must provide extra reporting of the errors. Else it is delegated to the business stage implementation.

Specified by:
hasParameterErrorInjection in interface IStage
Returns:
T if the stage has injected the errors onto an attribute
See Also:
IStage.hasParameterErrorInjection()

hasValidationLogicForForm

public boolean hasValidationLogicForForm(String formName)
Description copied from interface: IStage
Checks if the current form has a validation logic handler for the given form

Specified by:
hasValidationLogicForForm in interface IStage
Parameters:
formName - the form name
Returns:
T if present
See Also:
IStage.hasValidationLogicForForm(java.lang.String)

isRegistered

public boolean isRegistered()
Description copied from interface: IRegistrable
Returns information about if the Entity is registered.

Specified by:
isRegistered in interface IRegistrable
Returns:
T if the Entity is registered, F otherwise
See Also:
IRegistrable.isRegistered()

isRegistrable

public boolean isRegistrable()
Description copied from interface: IRegistrable
Returns information about if the Entity can be registered.

Specified by:
isRegistrable in interface IRegistrable
Returns:
T if the Entity is registrable, F otherwise
See Also:
IRegistrable.isRegistrable()

lazyStageProxyInitialization

protected void lazyStageProxyInitialization(IStageInstance stage)
The lazy initializations for all stages. Things that require all DEM entities to be previously initialized

Parameters:
stage - the stage instance for accessing some stage properties in the initialization process

register

public boolean register(String name,
                        String key)
Description copied from interface: IRegistrable
Registers the Entity with a given key.

Specified by:
register in interface IRegistrable
Parameters:
name - the name to register to
key - the encripted registration key
Returns:
T if the Entity was successfully registered, F otherwise
See Also:
IRegistrable.register(java.lang.String, java.lang.String)

unregister

public void unregister()
Description copied from interface: IRegistrable
Unregisters the Entity.

Specified by:
unregister in interface IRegistrable
See Also:
IRegistrable.unregister()


Copyright © 2014 Digitalis Informática Lda. All Rights Reserved.