Package org.adempiere.util
Class ModelGeneratorOptions
java.lang.Object
org.adempiere.util.ModelGeneratorOptions
Command line options of the model generator (
ModelGeneratorApplication).
Two forms are accepted:
- positional, unchanged:
folder packageName tableEntityType tableName [columnEntityType] - named:
--folder= --package= --tables= --table-entity-type= --column-entity-type= --output=interface,class,accessor --suffix= --columns= --template= --check;--helpprints the usage
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidapplyTemplate(String tFolder, String tPackageName, String tTableName, String tTableEntityType, String tColumnEntityType) Fill the values not given on the command line from a Generate Model Template.entityTypes(String list) booleanisCheck()static booleanisCheckPassed(int generated, int outOfDate) A check that generated no file has not checked anything, so it must not pass.booleanbooleanbooleanstatic booleanbooleanisNamed()booleanmissing()static ModelGeneratorOptionsParse command line arguments.safetyProblems(Predicate<String> isSystemEntityType) Safety rules.static Stringusage()warnings()Warnings that never refuse a call.
-
Field Details
-
OUTPUT_INTERFACE
- See Also:
-
OUTPUT_CLASS
- See Also:
-
OUTPUT_ACCESSOR
- See Also:
-
-
Method Details
-
isHelp
- Parameters:
args- command line arguments- Returns:
- true when
--helpis one of them
-
parse
Parse command line arguments.- Parameters:
args- arguments, positional or named (a first argument starting with--selects the named form)- Returns:
- options
- Throws:
IllegalArgumentException- for an unknown argument, a missing value, a wrong number of positional arguments or a named argument mixed into positional ones
-
applyTemplate
public void applyTemplate(String tFolder, String tPackageName, String tTableName, String tTableEntityType, String tColumnEntityType) Fill the values not given on the command line from a Generate Model Template. Explicit arguments win over the template. -
missing
- Returns:
- names of the required values that are still missing (after a template was applied)
-
safetyProblems
Safety rules. Each problem is a combination that writes into another owner's classes.- S1: a system table entity type with no column entity type writes every column of the dictionary, custom ones included, into the generated classes of core tables
- S2: a column entity type filter together with class output writes an
X_class that has only some columns of the table but is annotated for the whole table - S4: a core package with a column entity type other than
Dwrites plug-in columns into core files - S7: accessor output for the columns of the dictionary entity type
D, or with no column entity type and no--columns(every column); the accessor only gets and sets values and skips the logic of the model classes (MOrder.setC_BPartner_IDalso sets the bill-to partner). Columns named with--columnsare checked by the generator, which reads their entity types
- Parameters:
isSystemEntityType- tells whether an entity type is system maintained, for exampleD- Returns:
- problems, empty when the call is safe
-
isRefused
- Parameters:
problem- a problem returned bysafetyProblems(Predicate)- Returns:
- true when the call must be refused: every problem in the named form, and S4 also in the positional form, because it writes plug-in columns into core sources; the other problems only warn in the positional form, so existing scripts keep working
-
warnings
Warnings that never refuse a call.- S6: an interface for a column subset of a table of another entity type, without a suffix, has the same
simple name as the owner's interface (
I_C_Order); code in the same package may bind to the wrong one
- Returns:
- warnings, empty when there are none
- S6: an interface for a column subset of a table of another entity type, without a suffix, has the same
simple name as the owner's interface (
-
entityTypes
- Parameters:
list- comma separated entity types, optionally quoted- Returns:
- entity types without quotes and blanks
-
usage
- Returns:
- usage text for both forms
-
getFolder
-
getPackageName
-
getTableName
-
getTableEntityType
-
getColumnEntityType
-
isGenerateInterface
public boolean isGenerateInterface() -
isGenerateClass
public boolean isGenerateClass() -
isGenerateAccessor
public boolean isGenerateAccessor() -
getSuffix
-
getColumns
- Returns:
- comma separated column names, or null for all columns of the column entity types
-
getTemplate
-
isCheck
public boolean isCheck() -
isCheckPassed
public static boolean isCheckPassed(int generated, int outOfDate) A check that generated no file has not checked anything, so it must not pass.- Parameters:
generated- number of files the call generatedoutOfDate- number of generated files that are missing or differ in the target folder- Returns:
- true when files were generated and all of them are up to date
-
isNamed
public boolean isNamed()- Returns:
- true for the named form; safety problems are then refused, in the positional form only reported
-