All the rules hereby described should be verified with the help of checkstyle and PMD. These tools must be configured, in order to be compatible with the specific naming rules, by using the configuration files delivered by the DSTI.
The identifiers name must follow the following rules :
Do not use constants or variables to store a hard copy of the error message prefixed(use specific properties files). As long as possible, avoid hard copy values, maximize use of properties files ( application or plugin).
Do not use absolute paths (the only absolute paths used are stored in the parameters of the config.properties).
The Java base types must be prefixed as follows:
An object must be prefixed by the name of the class or the representative part of the class indicating clearly the type of the object.
|Class||Example of the class instance|
Nomenclature : Hungarian notation except lower case initials ,no underscores. Avoid abbreviations.
The instance variables (static or not) must be prefixed by an underscore.
Every string or numerical values should be placed in a constant. The declaration of these constants must be done in the first lines of the sourcecode or in a particular class containing the constants.
The prefixes must indicate the nature of the constants. Commonly used prefixes are :
|PATH_||For folder paths|
|PROPERTY_||For a key value of a .properties file|
|TEMPLATE_||For the html template name|
|BOOKMARK_||For a bookmark in the html template that can be substituted|
|MESSAGE_||For all messages or message keys used be Message.jsp|
|JSP_URL_||For JSP urls|
|PARAMETER_||For the name of a parameter in the HTTP request|
Nomenclature of constants : every caracter in upper case, words seperated by underscores.
For a big plugin, the constants will be collected in a class fr.paris.lutece.plugins.myplugins.web.Constants.
All table's and column's names should be in low caps with words separated by an underscore character. All table's name should begin by "<plugin name>_" except for the core tables that begin by "core_".
The SQL requests from DAO classes (business layer) must be declared as String variables and must respect the following format :
String strSQL = "SELECT a.id_theme, a.description_theme \ FROM theme a, theme_newsletter b WHERE \ a.id_theme = b.id_theme and b.id_newsletter = ? ";
Extension : .html
Format : in lower case, words seperated by underscores, no use of hyphens ,english language , no abbreviation
Naming rules for files having a standard purpose : create_<feature>.html for viewing a page for creation, modify_<feature>.html for viewing a modification page, remove_<feature>.html for viewing a page enabling a deletion, manage_<feature>.html for viewing a management page, view_<feature>.html for viewing a datasheet page , confirm_<feature>.html for viewing a message confirmation page, <feature>_list.html for viewing a page containing a list, <feature>_row.html for viewing a line of a list.
Naming rule for bookmarks used during substitution by corresponding values: english language,low case, words seperated by underscores, no abbreviation nor hyphens (eg: @file_name@)
Nomenclature : Hungarian notation, english language, no abbreviations ,no hyphens, no underscores.
Rules for naming the files which are used for standard processing purpose:Create<Feature>.jsp for pages used in view processing of a creation form , Modify<Feature>.jsp for pages used in view processing of a modification form Remove<Feature>.jsp for pages used in view processing of a removal form Manage<Feature>.jsp for pages used in view processing of a management form, View<Feature>.jsp for pages used in view processing of a datasheet view form , Confirm<Feature>.jsp for pages used in view processing of a confirmation form , <Feature>List.jsp for pages used in view processing of a list form.
Same naming rules for non visual Jsps, with the addition of the Do prefix ( eg: DoCreate<Feature>.jsp, DoModify<Feature>.jsp ... )
Naming rules : english language, use of lower case and underscores between words, no hyphens nor abbreviation. The prefixed used must be in relation with the function of the image when it exists :
|b_||Images used as button|
|i_||Images used as icons (eg : i_delete.gif)|
|l_||Images of a line|
The format of the images used for presentation purpose should be in a .gif format.
The Xml tags used by the application must be in lower case , seperated by hyphens for composed word, in english language, without abbreviation.
The name of the tags should must a close representation of the model : for example «portlet-id» for the tag storing the value of portlet identifier in the column id_portlet from portlet table.