UML modelization rules
Contents |
Rule for entity object modelization
Currently all generated file is base on entity objects.
- the entity are class with "entity" stereotype
- class with "extern" stereotype are define in a other UML file, in the generation process, all the UML files are merge and all the "extern" class are removed. If you define two class with the same name without the "extern" stereotype, there will be only one class with the attributes of the two class.
- "included" stereotype is used for derivated class, the idea is to define for only one database table multiple class and define clearly which attribute is for what (the main class or a derivation). It's used for the WorkEffort class
- "enumeration" stereotype is only for presentation purpose, it's used to say the class is derivated from Enumeration Class. Generation process don't used the "enumeration" stereotype, so currently it's only use for diagram to avoid to have to show the common.Enumeration Class.
- the attribute type must be of
- java primitifs type (boolean, byte, short, int, long, char, float et double),
- the serialization primitif type (java.lang.Boolean, java.lang.Character, java.lang.Byte, java.lang.Short, java.lang.Integer, java.lang.Long, java.lang.Float, java.lang.Double, java.lang.String, java.math.BigDecimal, java.math.BigInteger),
- some java object java.util.Locale, java.util.Date,
- an entity can extend an other or not
- an association with 1..1 multiplicity generate a relation with type="one" (so check by database) 0..1 multiplicity generate a relation with type="one-nofk"
the entity specific tag value are:
- shortName
- use to build primaryKey Name for associated entity, for Ofbiz compatibility, to avoid field name too long. Use for the discriminator value for the extend entity, in OFBiz id-ne value.length() must be < 20. Use it only if you have some entityEngine Warning message.
- discriminatorValue
- value to use as discriminator in the superclass. Should be use only to match existing ofbiz entities. In all other cases, default value is correct.
- uniqueNameAttribute
- boolean value, if true the attribute name are used without adding the entityShortName. It's useful for the ofbiz data model entity.
- alreadyExistingOfbizEntities
- boolean value, if true an element <extend-entity> is generated in entitymodel.xml. This element contains the definition of all attributes tagged by "addedToOfbiz". Nothing is generated in entitygroup.xml
- setDefaultAssoc
- use to give the default order for association (example in PartRole entity), <no more use> (todo: will be review )mandatory for association Class to say in which order will be parameters for the object contructor. Syntax is "ClassNameA:1, ClassNameB:2". </no more use>
- orderBy
- use to define the default order for the accessor "List getxxxs()" to this class from an other. The value contain the attributes list which define the order separated by a ",". If a descending order is required add "DESC" after attribute name, (ex: minimumQty DESC, product ). WARNING : Currently if you want to put an association in this list put the generatedName (look in the generated entitymodel file); in the futur it will be the associationName !!! .
- cache
- use to say if (by default) the accessor "List getxxxs()" to this class from an other should be read from cache or not. Value = true or false.
- defaultValue
- used for enumeration or StatusItem derivation association, define the defaultValue for drop-down and value set if null is given to service method (actionForm = add). It's possible to use this tag for all association to entity with drop-down. This tag is used if the same tag is not defined at the associationEnd. The tag value is used without transformation to call the setter. So, it must have the java format depending of the attribute type : for string "value", for boolean true or false, for double 0, .. .
- gui
- string with some words, each word is a sub-tag and if it's present it say the value is true for this sub-tag. This Tag is use for User Interface generation
- listAll
- boolean to say that transaction ListAll must be generated. ListAll is a list without selection, can be realized with the list transaction and put the hideSearch parameters to N in the pagedef.xml file.
- list
- boolean to say that transaction List must be generated.
- edit
- boolean to say that transaction Edit must be generated.
- show
- boolean to say that transaction Show must be generated.
- showList
- boolean to say that transaction ShowList must be generated.
- lookup
- boolean to say that transaction Lookup must be generated.
- drop-down
- boolean to say that in all the form generated for associated entity a form field drop-down must be generated
- dd-descriptionOnly
- boolean to say that in drop-down only description field(cf tag gui:description) is show and in all the displayField to have only "description" and not "[idName] description"
- ofbizEntityOptions
- string with some words, each word is a sub-tag and if it's present it say the value is true for this sub-tag. This tag is used for User Interface generation and for entity model generation. This tag has been created to facilitate OFBiz model integration with Neogia. This feature will be available in generators release 0.8.
- notes
- boolean to say that Notes Data model association in edit form must be generated.
- attributes
- boolean to say that Attributes model association in edit form must be generated.
- help
- string with some words, each word is a sub-tag and if it's present it say the value is true for this sub-tag. This Tag is use for Online Help loookup generation for user interface (i.e : forms generation)
- find
- boolean to say that help lookup must be generated on these entity forms.
- edit
- boolean to say that help lookup must be generated on these entity forms.
- list
- boolean to say that help lookup must be generated on these entity forms.
Tag value for associations ends
- mandatory
- booleen to say that this attribute is mandatory, use to add this constrain in the entityService
- titleAsSuffix
- if value is true, generated attribute will have the title of the association's end as suffix, and no as prefix by default
- shortName
- use to build primaryKey Name for associated entity, for Ofbiz compatibility, to avoid field name too long.build (used only when association multiplicity == 1)
- addedToOfbiz
- boolean to say if the attribute is added by Neogia to ofbiz schemas
- ofbizAttributeName
- to force a generated primaryKey name for associated entity, when shortName is not usable
- relationTitle
- to force relation title in the ofbiz entitymodel.xml
- defaultValue
- define the defaultValue for drop-down and value set if null is given to service method with actionForm ="add". The tag value is used without transformation to call the setter. So, it must have the java format depending of the attribute type : for string "value", for boolean true or false, for double 0, .. .
- noGetterSetter
- if value is true, get and set method are not generated, it's usefull for ofbiz object when ofbiz method exist with an other return type.
- GetterSetter
- Fix the duplication of the Getter and Setter caused by the standard naming process, this process create a get+Title+EntityName for returning the entity object and if the field defined in entity relation has the same name there are two getter with same Name. The value of the tag will replace the normal formed named by Title+with values.
- gui
- (cf above) used for user interface management
- editAssoc
- booleen to say that transaction EditAssoc must be generated.
- listAssoc
- booleen to say that transaction ListAssoc must be generated. (currently not effective).
- orderBy
- use to define the order for the accessor "List getxxxs()" to this attribute. This tag overwrite the same tag (default value) containing in the attribute.getClass(). The value contain the attributes list which define the order. For more details, look at the orderBy class tag. The value "false" should be use to overwrite the default Class order and say no sort.
- cache
- use to say if the accessor "List getxxxs()" to this this attribute should be read from cache or not. This tag overwrite the same tag (default value) containing in the attribute.getClass().
- defaultValue
- used for enumeration or StatusItem derivation association, define the defaultValue for drop-down and <not yet implemented> value set if null is given to service method </not yet implemented>. It's possible to use this tag for all association to entity with drop-down.
Tag value for attributes in entity object :
- addedToOfbiz
- boolean to say if the attribute is added by Neogia to ofbiz schemas
- readonly
- boolean to say that no setter must be generated
- mandatory
- boolean to say that this attribute is mandatory, use to add this constrain in the entityService
- primaryKey
- boolean to say that this attribute is one of the primaryKey. (use to defined the parameter list for the constructor and the find method)
- noGetterSetter
- if value is true, get and set method are not generated, it's usefull for ofbiz object when ofbiz method exist with an other return type.
- ofbizEntityType
- used to give the correct ofbiz entity Type, if it exist the value is used as type in the entitymodel.xml file. For comment and very-long, it's used in the form generation to have textarea (not text). In cas of comment and very-long, you cannot set the gui tag to indexed because the OFBiz entity engine cannot manage indexes on CLOB field type.
- staticValue
- used for static-final attribute, give the value of the Attribute.
- defaultValue
- define the defaultValue for drop-down and value set if null is given to service method with actionForm ="add". The tag value is used without transformation to call the setter. So, it must have the java format depending of the attribute type : for string "value", for boolean true or false, for double 0, .. .
- value
- used to define how attribue value is check or populated.
- nextSeqId
- This attribute is not populated by the end-user, the internal nextSeqId is call with entityName as seqIdName. Attribute type must be String or long. Generate a static method name nextSeq<attributeName> in the object. In the form when add action, the attribute is not user access.
- nextSeqIdHook
- similar to nextSeqId, but a customer <Entity>Hook.getNextSeq<attributeName> is call. The customer process should generate the nextSeq<attributeName> if return null the standard method is used
- userOrSeq
- This attribute could be populated by the end-user, if it's leave empty, the internal nextSeq<attributeName> is call with entityName as seqIdName. Attribute type must be String or long. Generate a static method name nextSeq<attributeName> in the object.
- userOrSeqHook
- similar to userOrSeq, but a customer <Entity>Hook.getNextSeq<attributeName> is call if needed. The customer process should generate the nextSeq<attributeName> if return null the standard method is used
- now
- for date attributes, in the add process if (attribute == null ) attribute = now()
- mask
- not yet implemented
- i18n
- The attribute can be populated by a string in multiple language generate link to the content entity and add a icon to be able to enter the multiple value.
- versioned
- the value history for this attribute must be manage. For each modification user, date, oldValue, new Value will be store. One additional methodes will be created for the attribute : list getHistory[Attribut]()
- format
- to give a format (use for stringwrapping in entry, and for display), currently only active for date, value available are date, time, timestamp.
- gui
- string with some words, each word is a sub-tag and if it's present it say the value is true for this sub-tag. This Tag is use for User Interface generation
- indexed
- boolean to say it must present in the find form (so the user can search on it).
- calculated
- boolean to say the attribute must be in display in the edit Form.
- hidden
- boolean to say to put it in the Form.
- listLookup
- boolean to say to put it in the list of display field in the listLookup, all the listLookup fields are in the list fields. If no attribute have this tag, all the attribute are in the listLookup list.
- list
- boolean to say to put it in list Form.
- idName
- (there is only one attribute with this tag) boolean use to say this attribute contain the object ID, it's uses in the associated entity list to print <<[idName] description>>. If no attribute has this tag and one of the attribute is named idName, it's this one which will be used.
- description
- cf previous tag idName
- listInAssoc
- boolean used to say that it must be in the list Form for the entity which have an association with this class. (not yet implemented)
Tips for generation
- you can use org.ofbiz.neogia.generators.TestModelValidity to test if there are some error in your UML model
- if generation failed without an explicit message, you can creat a debug file (empty), and re-run generation, all the debug generation message will be print
- to run generation with debug ant option, run ???????
- if you want generate with GeneratorEntitymodelXml and force to have a complete generation, you can add alreadyExistingOfbizEntities=false in the project.properties to override the UML tag alreadyExistingOfbizEntities.
Rule for service object modelization
Currently nothing is generated for these objects
- the entity are class with "service" stereotype (it's not a pre-defined stereotype)
- there is no restriction for link between entities, or link with other class or interfaces. Theses object can extend n'importe quelles class and implemente n'importe quelles interface.
Convention or Non supported UML rules
For the object or attribue name the Java rules must be used.
- the uml modele must have a name and a name without space.
- class name must start by an Uppercase must be without spaces.
- the association class must have a name.
- an association class must be only between 2 classes
- an association with cardinalidy * - * must have an association class
- association class is manage only if it's on an association with cardinalidy * - *
- in an association with association class the name attribute is not used, so it's not possible to have a parent - child association - with an association class, it's necessary to use a double composition !! see accounting Rollup or Ticket
- composition with an association class


