redora.generator
Class Normalizer

java.lang.Object
  extended by redora.generator.Normalizer

public class Normalizer
extends Object

There are default settings for a model that, because they are default, are not available in the model file. The Normalizer fixes this. So, if an attribute is omitted in model file, here they will be inserted with the necessary default value. Also, here a few helper stuff is added to make the templates easier. For example the object name. Here is the list:
- object.name;

Author:
Nanjing RedOrange (http://www.red-orange.cn)

Constructor Summary
Normalizer(String packageName)
           
 
Method Summary
 void addScope()
          Add listScope, tableScope, formScope and lazyScope nodes to the model.
listScope
In this node all the attributes that have set list='true' are added.
 void normalize(Document doc, String modelName, Set<String> sortedModels, int sequence)
          Enhances the model XML document with name, package and sequence tags and then invokes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Normalizer

public Normalizer(@NotNull
                  String packageName)
Parameters:
packageName - Add the object/package to the model
Method Detail

normalize

public void normalize(@NotNull
                      Document doc,
                      @NotNull
                      String modelName,
                      @NotNull
                      Set<String> sortedModels,
                      int sequence)
               throws ModelGenerationException
Enhances the model XML document with name, package and sequence tags and then invokes. More normalization stuff that will fill in all defaulted (and left out) attributes. After running the generator look in your ~/redora directory. There are the normalized model files located. Compare them with the original model files to see what is happening here.

Parameters:
doc - The loaded Document with the model
modelName - The file name is used as model name and insert object/name to the model
sortedModels - List of models that have the sorted = true tag
sequence - Simple incremental sequence. Used to uniquely identify (minimalist) the table alias in queries
Throws:
ModelGenerationException - Wrapper on all throw exceptions

addScope

public void addScope()
              throws ModelGenerationException
Add listScope, tableScope, formScope and lazyScope nodes to the model.
listScope
In this node all the attributes that have set list='true' are added. If there is no attribute with list='true' it will add the notnull='true' attributes. Larger attributes: the xml and html attributes are ignored. They can't be displayed in a dropdown list.
tableScope
All attributes are added to the tableScope unless they are:
- id, creationDate or updateDate;
- set, html, xml (and not lazy='false');
- or they have lazy='false'.
lazyScope
This scope will have the attributes (excluding set and object) who are excluded from the tableScope.
formScope
This is lazyScope + tableScope.

Throws:
ModelGenerationException - Wrapper on XPath exception


Copyright © 2012 Nanjing RedOrange Co. ltd. All Rights Reserved.