Package com.jalios.jcms
Class TypeProcessor
- java.lang.Object
-
- com.jalios.jcms.TypeProcessor
-
- All Implemented Interfaces:
JcmsConstants
,TypeConstants
,JaliosConstants
public class TypeProcessor extends java.lang.Object implements TypeConstants, JcmsConstants
This class generates all the resources (Java classes and JSPs) used by the Custom Publication Types and Custom Extension Types.This class replaces TypeGenerator class. It uses now a template mechanism to produces all the source code (Java and JSP)
- Since:
- jcms-3.0
- Author:
- Olivier Dedieu
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.List<java.lang.String>
compilerCmdLineTemplate
protected java.util.Set<java.lang.String>
compileSet
static TypeFieldEntry[]
EMPTY_TYPEFIELDENTRY_ARRAY
protected java.util.List<java.lang.String>
extendedTypeList
protected java.util.Map<java.lang.String,java.lang.String>
extensionsTabsMap
protected java.util.List<java.lang.Class<?>>
hbmList
-
Fields inherited from interface com.jalios.util.JaliosConstants
CRLF, MILLIS_IN_ONE_DAY, MILLIS_IN_ONE_HOUR, MILLIS_IN_ONE_MINUTE, MILLIS_IN_ONE_MONTH, MILLIS_IN_ONE_SECOND, MILLIS_IN_ONE_WEEK, MILLIS_IN_ONE_YEAR
-
Fields inherited from interface com.jalios.jcms.JcmsConstants
ADATE_SEARCH, ADMIN_NOTES_PROP, ADVANCED_TAB, AJAX_MODE_ATTR, ARCHIVES_DIR, ASCII_WIDTH, CATEGORY_TAB, CDATE_SEARCH, CLASS_PROPERTY, COMMON_ALARM, CONTENT_TAB, COOKIE_MAX_AGE, COUNTRY_SPRITE, CS_TYPOLOGY_ROOT_CAT_VID, CTRL_TOPIC_INTERNAL, CTRL_TOPIC_REF, CTRL_TOPIC_VALUE, CTRL_TOPIC_WRITE, CUSTOM_PROP, DATA_DIRECTORY, DEFAULT_PHOTO_PROP, DOCCHOOSER_HEIGHT, DOCCHOOSER_WIDTH, DOCS_DIR, EDATE_SEARCH, EMAIL_REGEXP, ERROR_MSG, FORBIDDEN_FILE_ACCESS, FORBIDDEN_REDIRECT, FORCE_REDIRECT, GLYPH_ICON_PREFIX, ICON_ARCHIVE, ICON_ICON_PREFIX, ICON_LOCK, ICON_LOCK_STRONG, ICON_PREFIX_PROP, ICON_WARN, ICON_WH_BOOK_CLOSED, ICON_WH_BOOK_OPEN, INFORMATION_MSG, IS_IN_FRONT_OFFICE, JALIOS_JUNIT_PROP, JCMS_CADDY, JCMS_MSG_LIST, JCMS_TOASTR_COLLECTION, JSYNC_DOWNLOAD_DIR, JSYNC_SYNC_ALARM, LANG_SPRITE, LOG_FILE, LOG_TOPIC_SECURITY, LOGGER_PROP, LOGGER_XMLPROP, MBR_PHOTO_DIR, MDATE_SEARCH, MONITOR_XML, OP_CREATE, OP_CREATE_STR, OP_DEEP_COPY, OP_DEEP_COPY_STR, OP_DEEP_DELETE, OP_DEEP_DELETE_STR, OP_DELETE, OP_DELETE_STR, OP_MERGE, OP_MERGE_STR, OP_UPDATE, OP_UPDATE_STR, ORGANIZATION_ROOT_GROUP_PROP, PDATE_SEARCH, PHOTO_DIR, PHOTO_ICON, PHOTO_ICON_HEIGHT, PHOTO_ICON_PROP_PREFIX, PHOTO_ICON_WIDTH, PHOTO_LARGE, PHOTO_LARGE_HEIGHT, PHOTO_LARGE_PROP_PREFIX, PHOTO_LARGE_WIDTH, PHOTO_MINI, PHOTO_MINI_HEIGHT, PHOTO_MINI_PROP_PREFIX, PHOTO_MINI_WIDTH, PHOTO_NORMAL, PHOTO_NORMAL_HEIGHT, PHOTO_NORMAL_PROP_PREFIX, PHOTO_NORMAL_WIDTH, PHOTO_SMALL, PHOTO_SMALL_HEIGHT, PHOTO_SMALL_PROP_PREFIX, PHOTO_SMALL_WIDTH, PHOTO_TINY, PHOTO_TINY_HEIGHT, PHOTO_TINY_PROP_PREFIX, PHOTO_TINY_WIDTH, PREVIOUS_TAB, PRINT_VIEW, PRIVATE_FILE_ACCESS, PUBLIC_FILE_ACCESS, RAW_CONTENT_ICON_PREFIX, READ_RIGHT_TAB, SDATE_SEARCH, SEARCHENGINE_ALARM, SECURITY_LOG_FILE, SESSION_AUTHORIZED_FILENAMES_SET, SPRITE_ICON_PREFIX, STATS_REPORT_DIR, STATUS_PROP, STORE_DIR, STORE_XML, SUCCESS_MSG, SVG_ICON_PREFIX, SVGINLINE_ICON_PREFIX, TEMPLATE_TAB, THUMBNAIL_LARGE_HEIGHT, THUMBNAIL_LARGE_WIDTH, THUMBNAIL_SMALL_HEIGHT, THUMBNAIL_SMALL_WIDTH, TTCARD_MEDIA_HEIGHT, TTCARD_MEDIA_WIDTH, TYPES_ICON_ALT_PROP, TYPES_ICON_SUFFIX_PROP, TYPES_ICON_TITLE_PROP, TYPES_PREFIX_PROP, TYPES_THUMB_SUFFIX_PROP, UDATE_SEARCH, UPDATE_RIGHT_TAB, UPLOAD_DIR, UPLOAD_PERMISSION_COUNT_PROP_PREFIX, UPLOAD_PERMISSION_SIZE_PROP_PREFIX, URL_REGEXP, VID_LOGGED_MEMBER, WARNING_MSG, WEBAPP_PROP, WFEXPRESS_ALARM, WFREMINDER_ALARM, WORKFLOW_TAB, WORKFLOW_XML
-
Fields inherited from interface com.jalios.jcms.TypeConstants
CHANGE_LEVEL_CLASS, CHANGE_LEVEL_JSP, CHANGE_LEVEL_NONE, DISPLAY_TPLT_TAG, EXTENSIONS_XML, FIELD_ELT, FIELD_NEW_MARK, FIELD_UPDATED_MARK, FIELDS_ELT, FILE_INDEX_LISTENER, LINK_INDEX_LISTENER, OLD_TYPES_DIR, PACKAGE_NAME, PACKAGE_NAME_SUFFIX, QUERY_TPLT_TAG, TAB_ELT, TABS_ELT, TEMPLATE_TAG, TEMPLATES_SUFFIX, TEMPLATES_TAG, TITLE_ELT, TYPE_ELT, TYPE_FORCE_UPDATE_MARK, TYPE_NEW_MARK, TYPE_UPDATED_MARK, TYPES_DIR, TYPES_XML
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
applyTypeChange()
TypeFieldEntry[]
getAllTypeFieldEntries(java.lang.Class<?> clazz)
Return an array ofTypeFieldEntry
bound to givenClass
.TypeFieldEntry[]
getAllTypeFieldEntries(java.lang.String clazzName)
Return an array ofTypeFieldEntry
bound to givenClass
represented by its class name.org.jdom.Document
getCurrentTypeDocument()
java.util.Map<java.lang.String,java.lang.Class<?>>
getCustomExtensionMap()
Retrieves the map of custom extensionjava.util.List<java.lang.Class<?>>
getCustomTypeList()
java.util.List<java.lang.String>
getExtendedTypeList()
Returns all the classes which have a Data extension.
Usually: "Category", "FileDocument", "Group", "Member", "Workspace"java.util.Map<java.lang.String,java.lang.String>
getExtensionsTabsMap()
java.util.List<java.lang.Class<?>>
getHbmList()
Returns the list of class an HBM has been generated.static TypeProcessor
getInstance()
Returns the TypeProcessor singleton instance.org.jdom.Document
getNewTypeDocument(boolean create)
int
getTypeChangeLevel()
java.lang.String
getTypeDescription(java.lang.Class<?> clazz, java.lang.String lang)
Returns the description of a given type (class) localized for the given language.org.jdom.Document
getTypeDocument()
TypeEntry
getTypeEntry(java.lang.Class<?> clazz)
Return the TypeEntry class associated to the given Class.TypeEntry
getTypeEntry(java.lang.String clazzName)
Return the TypeEntry class associated to the given Class name.TypeFieldEntry[]
getTypeFieldEntries(java.lang.Class<?> clazz)
Return an array ofTypeFieldEntry
bound to givenClass
.TypeFieldEntry[]
getTypeFieldEntries(java.lang.String clazzName)
Return an array ofTypeFieldEntry
bound to givenClass
represented by its class name.java.lang.String
getTypeLabel(java.lang.Class<?> clazz)
Deprecated.since jcms-5.7.0java.lang.String
getTypeLabel(java.lang.Class<?> clazz, java.lang.String lang)
Returns the label of a given type (class) localized for the given language.boolean
isCompilationDone()
boolean
isInGeneratedDir(java.io.File file)
Looks if the file is under a generation files (classes/generated and types).static void
markTypeAsUpdated(org.jdom.Element typeElt, boolean markSubTypes, boolean forceUpdate)
Mark the given type as updated and also its sub-types (and their "super" field)void
processTypes()
Generate all type's resources from the types/ directory (for old JCMS data, convert types.xml file, to the new types organization and extensions.xml file to the new extensions organization)void
revertTypeDocument()
Revert the currently edited TypeDocument.void
saveNewTypeDocument(boolean restartChannel)
Saves the currently edited TypeDocument.
-
-
-
Field Detail
-
EMPTY_TYPEFIELDENTRY_ARRAY
public static final TypeFieldEntry[] EMPTY_TYPEFIELDENTRY_ARRAY
-
extendedTypeList
protected java.util.List<java.lang.String> extendedTypeList
-
extensionsTabsMap
protected java.util.Map<java.lang.String,java.lang.String> extensionsTabsMap
-
compilerCmdLineTemplate
protected java.util.List<java.lang.String> compilerCmdLineTemplate
-
compileSet
protected java.util.Set<java.lang.String> compileSet
-
hbmList
protected java.util.List<java.lang.Class<?>> hbmList
-
-
Method Detail
-
getInstance
public static TypeProcessor getInstance()
Returns the TypeProcessor singleton instance.
Initialize it if it was not already done. Channel must be available!- Returns:
- the TypeProcessor singleton instance
-
getCurrentTypeDocument
public org.jdom.Document getCurrentTypeDocument()
- Returns:
- the jdom Document instance of the current type
- Since:
- jcms-3.0
-
getTypeDocument
public org.jdom.Document getTypeDocument()
- Returns:
- the jdom Document containing all Types Element
- Since:
- jcms-3.0
-
getNewTypeDocument
public org.jdom.Document getNewTypeDocument(boolean create)
- Parameters:
create
- whether a new one should be created if it has not been created yet- Returns:
- the Document (copy of
getTypeDocument()
being edited) - Since:
- jcms-3.0
-
revertTypeDocument
public void revertTypeDocument()
Revert the currently edited TypeDocument.- Since:
- jcms-3.0
-
getCustomTypeList
public java.util.List<java.lang.Class<?>> getCustomTypeList()
- Returns:
- a list of Class
- Since:
- jcms-3.0
-
getCustomExtensionMap
public java.util.Map<java.lang.String,java.lang.Class<?>> getCustomExtensionMap()
Retrieves the map of custom extension- Returns:
- the map of string to class
- Since:
- jcms-3.0
-
getExtendedTypeList
public java.util.List<java.lang.String> getExtendedTypeList()
Returns all the classes which have a Data extension.
Usually: "Category", "FileDocument", "Group", "Member", "Workspace"- Returns:
- a List of String.
-
getExtensionsTabsMap
public java.util.Map<java.lang.String,java.lang.String> getExtensionsTabsMap()
-
getHbmList
public java.util.List<java.lang.Class<?>> getHbmList()
Returns the list of class an HBM has been generated.- Returns:
- the list of class an HBM has been generated.
- Since:
- jcms-6.0.0
-
processTypes
public void processTypes() throws java.lang.Exception
Generate all type's resources from the types/ directory (for old JCMS data, convert types.xml file, to the new types organization and extensions.xml file to the new extensions organization)- Throws:
java.lang.Exception
- if an error occurs- Since:
- jcms-3.0
-
isInGeneratedDir
public boolean isInGeneratedDir(java.io.File file)
Looks if the file is under a generation files (classes/generated and types).- Parameters:
file
- A possibly generated file- Returns:
- true if the file is in under generated directory
- Since:
- JCMS-6.0.2
-
saveNewTypeDocument
public void saveNewTypeDocument(boolean restartChannel) throws java.io.IOException
Saves the currently edited TypeDocument. Once saved, the newTypeDocument object is reset to null.- Parameters:
restartChannel
- if true, once the new types was successfully saved, the channel is restarted- Throws:
java.io.IOException
- if an error occurs during saving
-
applyTypeChange
public void applyTypeChange() throws java.lang.Exception
- Throws:
java.lang.Exception
- if an error occurs- Since:
- jcms-3.0
-
getTypeChangeLevel
public int getTypeChangeLevel()
- Returns:
- the kind of type changed occured (none/jsp/class)
- Since:
- jcms-3.0
-
getTypeEntry
public TypeEntry getTypeEntry(java.lang.Class<?> clazz)
Return the TypeEntry class associated to the given Class. Return null if no TypeEntry is bound toclazz
.- Parameters:
clazz
- theClass
of which to find theTypeEntry
- Returns:
- the
TypeEntry
associated to the given class or null if not available.
-
getTypeEntry
public TypeEntry getTypeEntry(java.lang.String clazzName)
Return the TypeEntry class associated to the given Class name. Return null if no TypeEntry is bound toclazzName
.- Parameters:
clazzName
- theString
representing the name the Class of which to find theTypeEntry
- Returns:
- the
TypeEntry
associated to the given class or null if not available.
-
getTypeFieldEntries
public TypeFieldEntry[] getTypeFieldEntries(java.lang.Class<?> clazz)
Return an array ofTypeFieldEntry
bound to givenClass
.
This array does not contain inherited TypeFieldEntry from super classes of givenClass
.- Parameters:
clazz
- theClass
of which to find theTypeFieldEntry
.- Returns:
- an array of
TypeFieldEntry
containing all Field used byClass
or an empty array (never return null) - Since:
- jcms-5.5
-
getTypeFieldEntries
public TypeFieldEntry[] getTypeFieldEntries(java.lang.String clazzName)
Return an array ofTypeFieldEntry
bound to givenClass
represented by its class name.
This array does not contain inherited TypeFieldEntry from super classes of givenClass
.- Parameters:
clazzName
- theString
representing the name the Class of which to find theTypeFieldEntry
- Returns:
- an array of
TypeFieldEntry
containing all Field used byClass
or an empty array (never return null) - Since:
- jcms-5.5
-
getAllTypeFieldEntries
public TypeFieldEntry[] getAllTypeFieldEntries(java.lang.Class<?> clazz)
Return an array ofTypeFieldEntry
bound to givenClass
.
This array does contain inherited TypeFieldEntry from super classes of givenClass
.- Parameters:
clazz
- theClass
of which to find theTypeFieldEntry
.- Returns:
- an array of
TypeFieldEntry
containing all Field used byClass
or an empty array (never return null) - Since:
- jcms-5.5
-
getAllTypeFieldEntries
public TypeFieldEntry[] getAllTypeFieldEntries(java.lang.String clazzName)
Return an array ofTypeFieldEntry
bound to givenClass
represented by its class name.
This array does contain inherited TypeFieldEntry from super classes of givenClass
.- Parameters:
clazzName
- theString
representing the name the Class of which to find theTypeFieldEntry
- Returns:
- an array of
TypeFieldEntry
containing all Field used byClass
or an empty array (never return null) - Since:
- jcms-5.5
-
getTypeLabel
@Deprecated public java.lang.String getTypeLabel(java.lang.Class<?> clazz)
Deprecated.since jcms-5.7.0Returns the label of a given type (if TypeEntry is not null use it, otherwise return the short class name)- Parameters:
clazz
- the class to get the label- Returns:
- the type label
- Since:
- jcms-5.0.0
- See Also:
getTypeLabel(Class, String)
-
getTypeLabel
public java.lang.String getTypeLabel(java.lang.Class<?> clazz, java.lang.String lang)
Returns the label of a given type (class) localized for the given language.- Parameters:
clazz
- the classlang
- the language- Returns:
- the type label
- Since:
- jcms-5.7.0
-
getTypeDescription
public java.lang.String getTypeDescription(java.lang.Class<?> clazz, java.lang.String lang)
Returns the description of a given type (class) localized for the given language.- Parameters:
clazz
- the classlang
- the language- Returns:
- the Type description
- Since:
- jcms-5.0.0
-
markTypeAsUpdated
public static void markTypeAsUpdated(org.jdom.Element typeElt, boolean markSubTypes, boolean forceUpdate)
Mark the given type as updated and also its sub-types (and their "super" field)- Parameters:
typeElt
- the type to mark as updatedmarkSubTypes
- if true, marks all its sub-types as updatedforceUpdate
- if true, the type (and sub-types if 'markSubTypes' is true) will be force to be updated (i.e. regenerated)- Since:
- jcms-4.0
-
isCompilationDone
public boolean isCompilationDone()
-
-