org.openbp.cockpit.generator
Class GeneratorContext

java.lang.Object
  extended by org.openbp.cockpit.generator.GeneratorContext

public class GeneratorContext
extends java.lang.Object

This container object holds various informations that are modified by the generator wizard and used by the generator.

Author:
Heiko Erhardt

Constructor Summary
GeneratorContext()
          Default constructor.
 
Method Summary
 void clearStatus(int statusFlag)
          Clears the specified status.
 GeneratorSettings getGeneratorSettings()
          Gets the generator-specific settings.
 Item getItem()
          Gets the (modified) tem the generation process should be performed upon.
 Item getOriginalItem()
          Gets the original item the generation process should be performed upon.
 java.lang.String getOutputRootDir()
          Gets the root of the output directory.
 java.lang.String getOverwriteMode()
          Gets the template overwrite mode.
 java.util.Map getProperties()
          Gets the table of generator properties that will be used in the template-based generation process.
 java.lang.Object getProperty(java.lang.String key)
          Gets a generator property.
 Generator getSelectedGenerator()
          Gets the selected generator.
 TemplateEngineResult getTemplateEngineResult()
          Gets the template engine result.
 boolean hasStatus(int statusFlag)
          Checks if the specified status is set.
 boolean isClassnameSet()
          Gets the flag if the item has been edited in the visual view.
 boolean isEmptyItem()
          Gets the flag if the item name and structure should be initialized, overwriting existing definitions.
 boolean isInvalidGenerator()
          Gets the flag if the requirements for the generator have not been met.
 boolean isItemSaved()
          Gets the flag if the item has been saved during the generation process.
 boolean isNeedGeneration()
          Gets the flag if a property/wizard page that may require (re)-generation has been modified.
 boolean isNewItem()
          Gets the flag if the item is a new item.
 void removeProperty(java.lang.String key)
          Removes a generator property.
 void reset()
          Resets the context status.
 void setClassnameSet(boolean classnameSet)
          Sets the flag if the item has been edited in the visual view.
 void setEmptyItem(boolean isEmpty)
          Sets the flag if the item name and structure should be initialized, overwriting existing definitions.
 void setGeneratorSettings(GeneratorSettings generatorSettings)
          Sets the generator-specific settings.
 void setInvalidGenerator(boolean invalidGenerator)
          Sets the flag if the requirements for the generator have not been met.
 void setItem(Item item)
          Sets the (modified) tem the generation process should be performed upon.
 void setItemSaved(boolean itemSaved)
          Sets the flag if the item has been saved during the generation process.
 void setNeedGeneration(boolean needGeneration)
          Sets the flag if a property/wizard page that may require (re)-generation has been modified.
 void setNewItem(boolean newItem)
          Sets the flag if the item is a new item.
 void setOriginalItem(Item originalItem)
          Sets the original item the generation process should be performed upon.
 void setOutputRootDir(java.lang.String outputRootDir)
          Sets the root of the output directory.
 void setOverwriteMode(java.lang.String overwriteMode)
          Sets the template overwrite mode.
 void setProperty(java.lang.String key, java.lang.Object value)
          Adds a generator property.
 void setSelectedGenerator(Generator selectedGenerator)
          Sets the selected generator.
 void setStatus(int statusFlag)
          Sets the specified status.
 void setTemplateEngineResult(TemplateEngineResult templateEngineResult)
          Sets the template engine result.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GeneratorContext

public GeneratorContext()
Default constructor.

Method Detail

reset

public void reset()
Resets the context status.


getItem

public Item getItem()
Gets the (modified) tem the generation process should be performed upon. This item may be modified by the wizard.


setItem

public void setItem(Item item)
Sets the (modified) tem the generation process should be performed upon. This item may be modified by the wizard.


getOriginalItem

public Item getOriginalItem()
Gets the original item the generation process should be performed upon. This is the item that has been passed to the wizard It is used to:
- restore the original item state when using the 'Back' button of the wizard
- serve as a reference for name uniqueness check of the ModelObjectValidator


setOriginalItem

public void setOriginalItem(Item originalItem)
Sets the original item the generation process should be performed upon. This is the item that has been passed to the wizard. It is used to:
- restore the original item state when using the 'Back' button of the wizard
- serve as a reference for name uniqueness check of the ModelObjectValidator


hasStatus

public boolean hasStatus(int statusFlag)
Checks if the specified status is set.

Parameters:
statusFlag - Status flag to check (see the constants of this class)

setStatus

public void setStatus(int statusFlag)
Sets the specified status.

Parameters:
statusFlag - Status flag to set (see the constants of this class)

clearStatus

public void clearStatus(int statusFlag)
Clears the specified status.

Parameters:
statusFlag - Status flag to clear (see the constants of this class)

getOutputRootDir

public java.lang.String getOutputRootDir()
Gets the root of the output directory. Usually, the generator will create files on a sub directory of the output root directory.


setOutputRootDir

public void setOutputRootDir(java.lang.String outputRootDir)
Sets the root of the output directory. Usually, the generator will create files on a sub directory of the output root directory.


getOverwriteMode

public java.lang.String getOverwriteMode()
Gets the template overwrite mode.

Returns:
"ask"/"merge"/"overwrite"

setOverwriteMode

public void setOverwriteMode(java.lang.String overwriteMode)
Sets the template overwrite mode.

Parameters:
overwriteMode - "ask"/"merge"/"overwrite"

getSelectedGenerator

public Generator getSelectedGenerator()
Gets the selected generator.


setSelectedGenerator

public void setSelectedGenerator(Generator selectedGenerator)
Sets the selected generator.


getGeneratorSettings

public GeneratorSettings getGeneratorSettings()
Gets the generator-specific settings.


setGeneratorSettings

public void setGeneratorSettings(GeneratorSettings generatorSettings)
Sets the generator-specific settings.


getTemplateEngineResult

public TemplateEngineResult getTemplateEngineResult()
Gets the template engine result.


setTemplateEngineResult

public void setTemplateEngineResult(TemplateEngineResult templateEngineResult)
Sets the template engine result.


setProperty

public void setProperty(java.lang.String key,
                        java.lang.Object value)
Adds a generator property.

Parameters:
key - Property name
value - Property value

removeProperty

public void removeProperty(java.lang.String key)
Removes a generator property.

Parameters:
key - Property name

getProperty

public java.lang.Object getProperty(java.lang.String key)
Gets a generator property.

Parameters:
key - Property name
Returns:
Property value or null if no such property exists

getProperties

public java.util.Map getProperties()
Gets the table of generator properties that will be used in the template-based generation process.


isNewItem

public boolean isNewItem()
Gets the flag if the item is a new item.


setNewItem

public void setNewItem(boolean newItem)
Sets the flag if the item is a new item.


isEmptyItem

public boolean isEmptyItem()
Gets the flag if the item name and structure should be initialized, overwriting existing definitions.


setEmptyItem

public void setEmptyItem(boolean isEmpty)
Sets the flag if the item name and structure should be initialized, overwriting existing definitions.


isItemSaved

public boolean isItemSaved()
Gets the flag if the item has been saved during the generation process.


setItemSaved

public void setItemSaved(boolean itemSaved)
Sets the flag if the item has been saved during the generation process.


isNeedGeneration

public boolean isNeedGeneration()
Gets the flag if a property/wizard page that may require (re)-generation has been modified. Propose this to the user.


setNeedGeneration

public void setNeedGeneration(boolean needGeneration)
Sets the flag if a property/wizard page that may require (re)-generation has been modified. Propose this to the user.


isInvalidGenerator

public boolean isInvalidGenerator()
Gets the flag if the requirements for the generator have not been met. Unable to perform the generation.


setInvalidGenerator

public void setInvalidGenerator(boolean invalidGenerator)
Sets the flag if the requirements for the generator have not been met. Unable to perform the generation.


isClassnameSet

public boolean isClassnameSet()
Gets the flag if the item has been edited in the visual view.


setClassnameSet

public void setClassnameSet(boolean classnameSet)
Sets the flag if the item has been edited in the visual view.



Copyright © 2011. All Rights Reserved.