Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.makumba.devel
Class CodeGenerator

    java.lang.Object
      org.makumba.devel.CodeGenerator

    public class CodeGenerator

extends Object

This class generates code from a `DataDefinition`. Possible code types are:

- JSP code: newForm, editForm, deleteLink, pages to list and view objects.
- Java business logic code with needed handler methods.

Version:
  $Id: CodeGenerator.java 3596 2009-01-08 02:07:19Z rosso_nero $
Author:
  Rudolf Mayer, Manuel Gay

Field Summary
`(package private) static String[]` | `ALL_PROCESSABLE_TYPES` Code generation types that can be processed.
`static String` | `HQL_TLD_DEFINITION`
`static Hashtable<String,String>` | `nameToTypeMapping` Mapping from a action name to the action code
`static String` | `OQL_TLD_DEFINITION`
`static String` | `TYPE_ADDFORM`
`static String` | `TYPE_BUSINESS_LOGICS`
`static String` | `TYPE_DELETE`
`static String` | `TYPE_EDITFORM`
`static String` | `TYPE_LIST`
`static String` | `TYPE_NEWFORM`
`static String` | `TYPE_OBJECT`

Constructor Summary
`CodeGenerator()`

Method Summary
`static void` | `addOnAddHandler(StringBuffer sb, int indent, String ddMethodName)`
`static void` | `addOnDeleteHandler(StringBuffer sb, int indent, String ddMethodName)`
`static void` | `addOnEditHandler(StringBuffer sb, int indent, String ddMethodName)`
`static void` | `addOnNewHandler(StringBuffer sb, int indent, String ddMethodName)`
`static Vector<FieldDefinition>` | `extractSetComplex(DataDefinition dd)` Extracts all complex sets from a given DataDefinition.
`void` | `generateCode(StringBuffer sb, String type, DataDefinition dd, String action, CodeGeneratorTemplate template, String queryLanguage)` Starts the code generation for the given code type and DataDefinition.
`void` | `generateJavaBusinessLogicCode(DataDefinition dd, String packageName, boolean hasSuperLogic, String[] types, StringBuffer sb)` Starts the business logic code generation for the given DataDefinition.
`static String` | `getFileNameFromObject(DataDefinition dd, String type)` Constructs a fitting file name for the given DataDefinition and code generation type
`static String` | `getLabelNameFromDataDefinition(DataDefinition dd)` Returns the label name for a given DataDefintion.
`static String` | `getLogicNameFromDataDefinition(DataDefinition dd)` Generates a fitting Business Logics name from a given DataDefinition.
`static void` | `main(String[] args)` Main method for command line code generation.
`static void` | `writeHandler(StringBuffer sb, String type, String params, int indent, String ddMethodName)` Writes a handler method of the given type.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### nameToTypeMapping

    public static Hashtable<String,String> nameToTypeMapping

  Mapping from a action name to the action code

### TYPE_ADDFORM

    public static final String TYPE_ADDFORM

See Also:
  Constant Field Values

### TYPE_BUSINESS_LOGICS

    public static final String TYPE_BUSINESS_LOGICS

See Also:
  Constant Field Values

### TYPE_DELETE

    public static final String TYPE_DELETE

See Also:
  Constant Field Values

### TYPE_EDITFORM

    public static final String TYPE_EDITFORM

See Also:
  Constant Field Values

### TYPE_LIST

    public static final String TYPE_LIST

See Also:
  Constant Field Values

### TYPE_NEWFORM

    public static final String TYPE_NEWFORM

See Also:
  Constant Field Values

### TYPE_OBJECT

    public static final String TYPE_OBJECT

See Also:
  Constant Field Values

### ALL_PROCESSABLE_TYPES

    static final String[] ALL_PROCESSABLE_TYPES

  Code generation types that can be processed. This array can be used for batch-creating code in iterations.

### OQL_TLD_DEFINITION

    public static final String OQL_TLD_DEFINITION

See Also:
  Constant Field Values

### HQL_TLD_DEFINITION

    public static final String HQL_TLD_DEFINITION

See Also:
  Constant Field Values

Constructor Detail

### CodeGenerator

    public CodeGenerator()

Method Detail

### getFileNameFromObject

    public static String getFileNameFromObject(DataDefinition dd,
                                               String type)

  Constructs a fitting file name for the given DataDefinition and code generation type

### getLogicNameFromDataDefinition

    public static String getLogicNameFromDataDefinition(DataDefinition dd)

  Generates a fitting Business Logics name from a given DataDefinition. As an example, for a DataDefinition callled `general.Person`, PersonLogic will be the return value.

### getLabelNameFromDataDefinition

    public static String getLabelNameFromDataDefinition(DataDefinition dd)

  Returns the label name for a given DataDefintion. E.g. "general.Person" will produce a label person.

### main

    public static void main(String[] args)
                     throws IOException

  Main method for command line code generation.

  Throws:
    `IOException`

### generateCode

    public void generateCode(StringBuffer sb,
                             String type,
                             DataDefinition dd,
                             String action,
                             CodeGeneratorTemplate template,
                             String queryLanguage)

  Starts the code generation for the given code type and DataDefinition.

  Parameters:
    `queryLanguage` - TODO

### generateJavaBusinessLogicCode

    public void generateJavaBusinessLogicCode(DataDefinition dd,
                                              String packageName,
                                              boolean hasSuperLogic,
                                              String[] types,
                                              StringBuffer sb)

  Starts the business logic code generation for the given DataDefinition.

### addOnAddHandler

    public static void addOnAddHandler(StringBuffer sb,
                                       int indent,
                                       String ddMethodName)

### addOnDeleteHandler

    public static void addOnDeleteHandler(StringBuffer sb,
                                          int indent,
                                          String ddMethodName)

### addOnEditHandler

    public static void addOnEditHandler(StringBuffer sb,
                                        int indent,
                                        String ddMethodName)

### addOnNewHandler

    public static void addOnNewHandler(StringBuffer sb,
                                       int indent,
                                       String ddMethodName)

### writeHandler

    public static void writeHandler(StringBuffer sb,
                                    String type,
                                    String params,
                                    int indent,
                                    String ddMethodName)

  Writes a handler method of the given type.

### extractSetComplex

    public static Vector<FieldDefinition> extractSetComplex(DataDefinition dd)

  Extracts all complex sets from a given DataDefinition.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Docs generated on 2009-02-25 14:20