fr.paris.lutece.plugins.pluginwizard.service
Class SourceCodeGenerator

java.lang.Object
  extended by fr.paris.lutece.plugins.pluginwizard.service.SourceCodeGenerator

public class SourceCodeGenerator
extends java.lang.Object

This class is used for source code generation( sql scripts, resource files, etc)


Constructor Summary
SourceCodeGenerator()
           
 
Method Summary
static java.util.ArrayList<java.lang.String> findResourceKeys(java.util.List<BusinessClass> listBusinessClasses, java.lang.String strPluginName)
          Fetches all the resource keys
static java.lang.String getCreateHtmlCode(java.util.Collection<BusinessClass> listAllBusinessClasses, BusinessClass businessClass, int nTemplateType, BusinessObject bo, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Gets the code of a create template for a specific business object
static java.lang.String getJspBeanCode(PluginModel pluginModel)
          Return JspBean code
static java.lang.String getJspFile(java.lang.String businessClass, java.lang.String pluginName, int nJspType)
          Gets the Jsp File of a business class
static java.lang.String getLocalePropertiesKeys(int nPluginId, java.lang.String strLanguage, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Returns the resource files related to the generated plugin
static java.lang.String getPluginXmlCode(int nPluginId, fr.paris.lutece.portal.service.plugin.Plugin plugin)
           
static java.lang.String getPomXmlCode(int nPluginId, fr.paris.lutece.portal.service.plugin.Plugin plugin)
           
static java.lang.String getPortletCode(int nPluginId, fr.paris.lutece.portal.service.plugin.Plugin plugin)
           
static java.lang.String getPropertiesFileCode(int nPluginId, fr.paris.lutece.portal.service.plugin.Plugin plugin)
           
static java.lang.String getSourceCode(BusinessObject bo, int nGenerationType)
          Returns the source code of a business object
static java.lang.String getSpringContextCode(int nPluginId, fr.paris.lutece.portal.service.plugin.Plugin plugin)
           
static java.lang.String getSqlScript(PluginModel pluginModel)
          Returns the sql script related to all the Pojo's
static java.lang.String getXPageCode(int nPluginId, fr.paris.lutece.portal.service.plugin.Plugin plugin, int nIdPluginApplication)
           
static void parseAttributesList(java.lang.String strAttributesList, BusinessObject bo)
          Parse the attributes of the list
static void storeKeys(int nPluginId, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          The method will store all relevant i18n keys in the database
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SourceCodeGenerator

public SourceCodeGenerator()
Method Detail

getSourceCode

public static java.lang.String getSourceCode(BusinessObject bo,
                                             int nGenerationType)
Returns the source code of a business object

Parameters:
businessClass - The business class
nGenerationType - The type of generation(DAO,Home,etc)
request - The Http Request
Returns:
The java source code of the business object

getJspFile

public static java.lang.String getJspFile(java.lang.String businessClass,
                                          java.lang.String pluginName,
                                          int nJspType)
Gets the Jsp File of a business class

Parameters:
businessClass - The business class
pluginName - The generated plugin name
nJspType - The type of jsp
Returns:
The source code of the jsp

getSqlScript

public static java.lang.String getSqlScript(PluginModel pluginModel)
Returns the sql script related to all the Pojo's

Parameters:
listBusinessObjects - The list of business objects
Returns:
The sql dump representing the business objects

getPropertiesFileCode

public static java.lang.String getPropertiesFileCode(int nPluginId,
                                                     fr.paris.lutece.portal.service.plugin.Plugin plugin)

getPomXmlCode

public static java.lang.String getPomXmlCode(int nPluginId,
                                             fr.paris.lutece.portal.service.plugin.Plugin plugin)

getPortletCode

public static java.lang.String getPortletCode(int nPluginId,
                                              fr.paris.lutece.portal.service.plugin.Plugin plugin)

getXPageCode

public static java.lang.String getXPageCode(int nPluginId,
                                            fr.paris.lutece.portal.service.plugin.Plugin plugin,
                                            int nIdPluginApplication)
Parameters:
nPluginId - The id of the plugin
plugin - The plugin
Returns:
The code of the XPage generated

getSpringContextCode

public static java.lang.String getSpringContextCode(int nPluginId,
                                                    fr.paris.lutece.portal.service.plugin.Plugin plugin)

getPluginXmlCode

public static java.lang.String getPluginXmlCode(int nPluginId,
                                                fr.paris.lutece.portal.service.plugin.Plugin plugin)

getJspBeanCode

public static java.lang.String getJspBeanCode(PluginModel pluginModel)
Return JspBean code

Parameters:
nPluginId - The identifier of the generated plugin
plugin - The Plugin
Returns:
the template The source code of the Jsp Bean

getLocalePropertiesKeys

public static java.lang.String getLocalePropertiesKeys(int nPluginId,
                                                       java.lang.String strLanguage,
                                                       fr.paris.lutece.portal.service.plugin.Plugin plugin)
Returns the resource files related to the generated plugin

Parameters:
strPluginName - The generated plugin name
strLanguage - The language of the resource file
listBusinessObjects - The list of the business objects
Returns:
The String representing the resource file generated

storeKeys

public static void storeKeys(int nPluginId,
                             fr.paris.lutece.portal.service.plugin.Plugin plugin)
The method will store all relevant i18n keys in the database

Parameters:
nPluginId - The id of the generated plugin
plugin - The Plugin

findResourceKeys

public static java.util.ArrayList<java.lang.String> findResourceKeys(java.util.List<BusinessClass> listBusinessClasses,
                                                                     java.lang.String strPluginName)
Fetches all the resource keys

Parameters:
listBusinessClasses - The list of business classes
strPluginName - The plugin name
Returns:
A list of the resource keys

getCreateHtmlCode

public static java.lang.String getCreateHtmlCode(java.util.Collection<BusinessClass> listAllBusinessClasses,
                                                 BusinessClass businessClass,
                                                 int nTemplateType,
                                                 BusinessObject bo,
                                                 fr.paris.lutece.portal.service.plugin.Plugin plugin)
Gets the code of a create template for a specific business object

Parameters:
strPluginName - The plugin name
bo - The business object
plugin - The plugin
Returns:
The Html code of the create template

parseAttributesList

public static void parseAttributesList(java.lang.String strAttributesList,
                                       BusinessObject bo)
Parse the attributes of the list

Parameters:
strAttributesList - the list of attributes
bo - the BusinessObject


Copyright © 2009 Mairie de Paris. All Rights Reserved.