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

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

public final class SourceCodeGenerator
extends java.lang.Object

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


Method Summary
static java.util.ArrayList<java.lang.String> findResourceKeys(java.util.List<BusinessClass> listBusinessClasses, java.lang.String strPluginName, int nPluginId, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Fetches all the resource keys
static java.lang.String getCreateHtmlCode(java.util.Collection<BusinessClass> listAllBusinessClasses, BusinessClass businessClass, int nTemplateType, 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, java.util.Collection<BusinessClass> listBusinessClasses)
          Return JspBean code
static java.lang.String getJspFile(BusinessClass businessClass, java.lang.String strPluginName, 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)
          Fetches the locale keys needed by front and back office
static java.lang.String getPluginXmlCode(int nPluginId, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Returns the text content of the plugin xml file
static java.lang.String getPomXmlCode(int nPluginId, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Produces content of the maven pom.xml file
static java.lang.String getPortletCode(int nPluginId, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Produces the java code of the portlet file
static java.lang.String getPortletFile(PluginPortlet portlet, java.lang.String strPluginName, int nPortletFileType)
          Produces text content of java file used to build a portlet
static java.lang.String getPortletHtmlTemplate(PluginPortlet portlet, java.lang.String strPluginName, int nPortletTemplateType)
          Produces text content of the html template for a portlet
static java.lang.String getPortletJspBean(PluginPortlet portlet, java.lang.String strPluginName)
          Gets the Portlet Jsp Bean
static java.lang.String getPortletJspFile(PluginPortlet portlet, java.lang.String strPluginName, int nPortletJspType)
          Gets the portlet Jsp File
static java.lang.String getPortletXsl(PluginPortlet portlet, java.lang.String strPluginName)
          Fetches the xsl corresponding to a portlet
static java.lang.String getPropertiesFileCode(int nPluginId, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          The properties file content
static java.lang.String getSourceCode(BusinessClass businessClass, 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)
          Produces the spring context xml file
static java.lang.String getSqlScript(int nSqlType, PluginModel pluginModel, java.util.Collection<BusinessClass> listBusinessClasses, java.util.Collection<PluginFeature> listFeatures, java.util.Collection<PluginApplication> listApplcations, java.util.Collection<PluginPortlet> listPortlets)
          Returns the necessary sql dump of creation of plugin and core
static java.lang.String getXPageCode(int nPluginId, fr.paris.lutece.portal.service.plugin.Plugin plugin, int nIdPluginApplication)
          Generates the XPage source code
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
 

Method Detail

getSourceCode

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

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

getJspFile

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

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

getPortletJspFile

public static java.lang.String getPortletJspFile(PluginPortlet portlet,
                                                 java.lang.String strPluginName,
                                                 int nPortletJspType)
Gets the portlet Jsp File

Parameters:
portlet - The portlet
strPluginName - the plugin name
nPortletJspType - The type of portlet
Returns:
The source code of the portlet jsp

getPortletJspBean

public static java.lang.String getPortletJspBean(PluginPortlet portlet,
                                                 java.lang.String strPluginName)
Gets the Portlet Jsp Bean

Parameters:
portlet - The portlet
strPluginName - The generated plugin name
Returns:
The source code of the jsp

getSqlScript

public static java.lang.String getSqlScript(int nSqlType,
                                            PluginModel pluginModel,
                                            java.util.Collection<BusinessClass> listBusinessClasses,
                                            java.util.Collection<PluginFeature> listFeatures,
                                            java.util.Collection<PluginApplication> listApplcations,
                                            java.util.Collection<PluginPortlet> listPortlets)
Returns the necessary sql dump of creation of plugin and core

Parameters:
nSqlType - The type of the sql
pluginModel - The plugin Model
listBusinessClasses - The list of business classes
listFeatures - The list of admin features
listApplcations - The list of XPages
listPortlets - The list of portlets
Returns:
The corresponding sql output

getPropertiesFileCode

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

Parameters:
nPluginId - The id of the plugin
plugin - The plugin
Returns:
The content of configuration properties file

getPomXmlCode

public static java.lang.String getPomXmlCode(int nPluginId,
                                             fr.paris.lutece.portal.service.plugin.Plugin plugin)
Produces content of the maven pom.xml file

Parameters:
nPluginId - The id of the plugin
plugin - The plugin
Returns:
The content of the pom.xml

getPortletCode

public static java.lang.String getPortletCode(int nPluginId,
                                              fr.paris.lutece.portal.service.plugin.Plugin plugin)
Produces the java code of the portlet file

Parameters:
nPluginId - The id of the plugin
plugin - The plugin
Returns:
The portlet java code

getXPageCode

public static java.lang.String getXPageCode(int nPluginId,
                                            fr.paris.lutece.portal.service.plugin.Plugin plugin,
                                            int nIdPluginApplication)
Generates the XPage source code

Parameters:
nPluginId - The id of the plugin
plugin - The plugin
nIdPluginApplication - id of the plugin application
Returns:
The code of the XPage generated

getSpringContextCode

public static java.lang.String getSpringContextCode(int nPluginId,
                                                    fr.paris.lutece.portal.service.plugin.Plugin plugin)
Produces the spring context xml file

Parameters:
nPluginId - The id of the plugin
plugin - the plugin
Returns:
the content if the spring context file

getPluginXmlCode

public static java.lang.String getPluginXmlCode(int nPluginId,
                                                fr.paris.lutece.portal.service.plugin.Plugin plugin)
Returns the text content of the plugin xml file

Parameters:
nPluginId - The id of the plugin
plugin - The plugin
Returns:
The plugin xml file content of the plugin

getJspBeanCode

public static java.lang.String getJspBeanCode(PluginModel pluginModel,
                                              java.util.Collection<BusinessClass> listBusinessClasses)
Return JspBean code

Parameters:
pluginModel - The plugin model
listBusinessClasses - The list of business classes
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)
Fetches the locale keys needed by front and back office

Parameters:
nPluginId - The id of the plugin
strLanguage - The language needed
plugin - The plugin
Returns:
The Locale keys

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,
                                                                     int nPluginId,
                                                                     fr.paris.lutece.portal.service.plugin.Plugin plugin)
Fetches all the resource keys

Parameters:
listBusinessClasses - The list of business classes
strPluginName - The plugin name
plugin - The plugin
nPluginId - The id of the plugin to be generated
Returns:
A list of the resource keys

getCreateHtmlCode

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

Parameters:
listAllBusinessClasses - A list of business classes attached to plugin
businessClass - The instance of the business class
nTemplateType - The type of template
plugin - The plugin
Returns:
The html code of the create template

getPortletFile

public static java.lang.String getPortletFile(PluginPortlet portlet,
                                              java.lang.String strPluginName,
                                              int nPortletFileType)
Produces text content of java file used to build a portlet

Parameters:
portlet - The instance of a portlet
strPluginName - The plugin name
nPortletFileType - The type of portlet file
Returns:
The content of the portlet file

getPortletHtmlTemplate

public static java.lang.String getPortletHtmlTemplate(PluginPortlet portlet,
                                                      java.lang.String strPluginName,
                                                      int nPortletTemplateType)
Produces text content of the html template for a portlet

Parameters:
portlet - The instance of a portlet
strPluginName - The plugin name
nPortletTemplateType - The type of portlet
Returns:
The content of the html template

getPortletXsl

public static java.lang.String getPortletXsl(PluginPortlet portlet,
                                             java.lang.String strPluginName)
Fetches the xsl corresponding to a portlet

Parameters:
portlet - The instance of a portlet
strPluginName - The plugin name
Returns:
The content of the xsl file


Copyright © 2012 Mairie de Paris. All Rights Reserved.