Package org.ametys.plugins.workspaces
Class AbstractWorkspaceModule
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.plugins.workspaces.AbstractWorkspaceModule
- All Implemented Interfaces:
Comparable<WorkspaceModule>,WorkspaceModule,LogEnabled,PluginAware,Contextualizable,Serviceable
- Direct Known Subclasses:
AboutWorkspaceModule,AlertWorkspaceModule,CalendarWorkspaceModule,DocumentWorkspaceModule,ForumWorkspaceModule,MembersWorkspaceModule,MiniSiteWorkspaceModule,NewsWorkspaceModule,TasksWorkspaceModule,WallContentModule
public abstract class AbstractWorkspaceModule
extends AbstractLogEnabled
implements WorkspaceModule, Serviceable, Contextualizable, PluginAware
Abstract class for
WorkspaceModule implementation-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final LongSize value constants in case of size computation errorprotected static final LongSize value constants for inactive modulesprotected ActivityStreamClientInteractionThe activity stream managerprotected ContextThe avalon contextprotected CurrentUserProviderThe current user provider.protected I18nUtilsThe i18n utils.protected WorkspaceModuleExtensionPointThe modules extension pointprotected ObservationManagerObserver manager.protected PageDAOThe page DAOprotected StringThe plugin nameprotected ProjectManagerProject managerprotected ProjectRightHelperProject right helperprotected AmetysObjectResolverAmetys resolverprotected RightManagerThe rights managerprotected ServiceExtensionPointThe services handlerprotected SkinsManagerThe skins manager.protected UserHelperThe users managerprotected UserManagerUser managerprotected WorkspacesHelperWorkspaces helperFields inherited from interface org.ametys.plugins.workspaces.project.modules.WorkspaceModule
GROUP_HEADER_ACTIVATED_ID, GROUP_HEADER_ELEMENTS_ID, GROUP_HEADER_LAST_ACTIVITY_ID, GROUP_HEADER_SIZE_ID, ORDER_ABOUT, ORDER_ALERTS, ORDER_CALENDAR, ORDER_DOCUMENTS, ORDER_FORUMS, ORDER_MEMBERS, ORDER_MINISITE, ORDER_NEWS, ORDER_TASKS, ORDER_WALLCONTENT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected ModifiablePage_createModulePage(Project project, Sitemap sitemap, String name, I18nizableText pageTitle, String skinTemplate) Create a new page if not already existsprotected void_deleteActivities(Project project) Delete all activities related to this moduleprotected void_deletePages(Project project) Delete the module pages and their related contentsprotected <A extends AmetysObject>
A_getAmetysObject(ModifiableTraversableAmetysObject parent, String name, String type, boolean create) Utility method to get or create an ametys objectprotected String_getDefaultXslt(String serviceId) Get the default value of the XSLT parameter of the given service.protected List<StatisticColumn> Get the headers of statistics_getInternalStatistics(Project project, boolean isActive) Get the internal statistics of the moduleprotected ZonedDateTime_getModuleLastActivity(Project project) Get the size of module in bytes_getModulePages(Project project) Get the module pagesprotected long_getModuleSize(Project project) Get the size of module in bytesprotected void_internalActivateModule(Project project, Map<String, Object> additionalValues) Internal process when module is activatedprotected void_internalDeactivateModule(Project project) Internal process when module is deactivatedprotected void_internalDeleteData(Project project) Internal process to delete dataprotected void_setPagesVisibility(Project project, boolean visible) Change the visibility of module pages if neededprotected booleanCheck if activated status should be shown or notprotected booleanCheck if the last activity should be shown or notprotected booleanCheck if module size should be shown or notvoidactivateModule(Project project, Map<String, Object> additionalValues) Activate the module for the project, creating the module pagesvoidcontextualize(Context context) voiddeactivateModule(Project project) Deactivate a modulevoiddeleteData(Project project) Delete a module and all related data (pages, events, resources, ...)Get the set of all event type for the moduleprotected abstract StringReturns the module page's nameprotected StringReturns the template to use for module's page.protected abstract I18nizableTextReturns the module page's title as i18ngetModuleRoot(Project project, boolean create) Get the module root node for the given projectReturns the key to get module size in statisticsgetModuleUrl(Project project) Get the URL of the first module's pageGet the headers of statisticsgetStatistics(Project project) Get the statistics of the moduleprotected abstract voidinitializeModulePage(ModifiablePage modulePage) Initialize the module pagevoidinitializeSitemap(Project project, Sitemap sitemap) Initialize the sitemap for the modulevoidservice(ServiceManager manager) voidsetPluginInfo(String pluginName, String featureName, String id) Sets the plugin info relative to the current component.
Note : The feature name may be null if the targeted component in declared at plugin level.Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLoggerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.ametys.plugins.workspaces.project.modules.WorkspaceModule
compareTo, getAllowedEventTypes, getId, getModuleDescription, getModuleName, getModuleTitle, getOrder, isUnactivatedByDefault
-
Field Details
-
__SIZE_ERROR
Size value constants in case of size computation error -
__SIZE_INACTIVE
Size value constants for inactive modules -
_projectManager
Project manager -
_projectRightHelper
Project right helper -
_userManager
User manager -
_resolver
Ametys resolver -
_rightManager
The rights manager -
_observationManager
Observer manager. -
_currentUserProvider
The current user provider. -
_userHelper
The users manager -
_i18nUtils
The i18n utils. -
_skinsManager
The skins manager. -
_pageDAO
The page DAO -
_context
The avalon context -
_pluginName
The plugin name -
_serviceEP
The services handler -
_modulesEP
The modules extension point -
_activityStream
The activity stream manager -
_wokspacesHelper
Workspaces helper
-
-
Constructor Details
-
AbstractWorkspaceModule
public AbstractWorkspaceModule()
-
-
Method Details
-
service
- Specified by:
servicein interfaceServiceable- Throws:
ServiceException
-
contextualize
- Specified by:
contextualizein interfaceContextualizable- Throws:
ContextException
-
setPluginInfo
Description copied from interface:PluginAwareSets the plugin info relative to the current component.
Note : The feature name may be null if the targeted component in declared at plugin level.- Specified by:
setPluginInfoin interfacePluginAware- Parameters:
pluginName- Unique identifier for the plugin hosting the extensionfeatureName- Unique feature identifier (unique for a given pluginName)id- Unique identifier of this component
-
deleteData
Description copied from interface:WorkspaceModuleDelete a module and all related data (pages, events, resources, ...)- Specified by:
deleteDatain interfaceWorkspaceModule- Parameters:
project- The project
-
deactivateModule
Description copied from interface:WorkspaceModuleDeactivate a module- Specified by:
deactivateModulein interfaceWorkspaceModule- Parameters:
project- The project
-
activateModule
Description copied from interface:WorkspaceModuleActivate the module for the project, creating the module pages- Specified by:
activateModulein interfaceWorkspaceModule- Parameters:
project- The projectadditionalValues- A list of optional additional values. Accepted values are : description, mailingList, inscriptionStatus, defaultProfile, tags, categoryTags, keywords and language
-
initializeSitemap
Description copied from interface:WorkspaceModuleInitialize the sitemap for the module- Specified by:
initializeSitemapin interfaceWorkspaceModule- Parameters:
project- The project of the modulesitemap- The sitemap
-
getModuleUrl
Description copied from interface:WorkspaceModuleGet the URL of the first module's page- Specified by:
getModuleUrlin interfaceWorkspaceModule- Parameters:
project- The project- Returns:
- the module url
-
_createModulePage
protected ModifiablePage _createModulePage(Project project, Sitemap sitemap, String name, I18nizableText pageTitle, String skinTemplate) Create a new page if not already exists- Parameters:
project- The module projectsitemap- The sitemap where the page will be createdname- The page's namepageTitle- The page's title as i18nizable textskinTemplate- The template from the skin to apply on the page- Returns:
- the created page or
nullif page already exists
-
_setPagesVisibility
Change the visibility of module pages if needed- Parameters:
project- The projectvisible- visibletrueto set pages as visible,falseotherwise
-
_deletePages
Delete the module pages and their related contents- Parameters:
project- The project
-
_getModulePages
Get the module pages- Parameters:
project- the project- Returns:
- the module pages
-
_deleteActivities
Delete all activities related to this module- Parameters:
project- The project
-
_getDefaultXslt
Get the default value of the XSLT parameter of the given service.- Parameters:
serviceId- the service ID.- Returns:
- the default XSLT parameter value.
-
getModulePageName
Returns the module page's name- Returns:
- The module page's name
-
getModulePageTitle
Returns the module page's title as i18n- Returns:
- The module page's title
-
getModulePageTemplate
Returns the template to use for module's page. Can be null if the page should be a node page- Returns:
- The template
-
initializeModulePage
Initialize the module page- Parameters:
modulePage- The module page
-
_internalDeactivateModule
Internal process when module is deactivated- Parameters:
project- The project
-
_internalDeleteData
Internal process to delete data- Parameters:
project- The project
-
_internalActivateModule
Internal process when module is activated- Parameters:
project- The projectadditionalValues- A list of optional additional values. Accepted values are : description, mailingList, inscriptionStatus, defaultProfile, tags, categoryTags, keywords and language
-
_getAmetysObject
protected <A extends AmetysObject> A _getAmetysObject(ModifiableTraversableAmetysObject parent, String name, String type, boolean create) throws AmetysRepositoryException Utility method to get or create an ametys object- Type Parameters:
A- A sub class of AmetysObject- Parameters:
parent- The parent objectname- The ametys object nametype- The ametys object typecreate- True to create the object if it does not exist- Returns:
- ametys object
- Throws:
AmetysRepositoryException- if an repository error occurs
-
getStatistics
Description copied from interface:WorkspaceModuleGet the statistics of the module- Specified by:
getStatisticsin interfaceWorkspaceModule- Parameters:
project- The project- Returns:
- a map of statistics
-
_getInternalStatistics
Get the internal statistics of the module- Parameters:
project- The projectisActive- true if module is active- Returns:
- a map of internal statistics
-
getStatisticModel
Description copied from interface:WorkspaceModuleGet the headers of statistics- Specified by:
getStatisticModelin interfaceWorkspaceModule- Returns:
- a list of statistics headers
-
_getInternalStatisticModel
Get the headers of statistics- Returns:
- a list of statistics headers
-
getModuleSizeKey
Description copied from interface:WorkspaceModuleReturns the key to get module size in statistics- Specified by:
getModuleSizeKeyin interfaceWorkspaceModule- Returns:
- The key to get module size in statistics
-
_getModuleSize
Get the size of module in bytes- Parameters:
project- The project- Returns:
- the size of module in bytes
-
_showActivatedStatus
Check if activated status should be shown or not- Returns:
- true if activated status should be shown
-
_showModuleSize
Check if module size should be shown or not- Returns:
- true if module size should be shown
-
getAllEventTypes
Description copied from interface:WorkspaceModuleGet the set of all event type for the module- Specified by:
getAllEventTypesin interfaceWorkspaceModule- Returns:
- The set of all event types
-
_showLastActivity
Check if the last activity should be shown or not- Returns:
- true if last activity should be shown
-
_getModuleLastActivity
Get the size of module in bytes- Parameters:
project- The project- Returns:
- the size of module in bytes
-
getModuleRoot
Description copied from interface:WorkspaceModuleGet the module root node for the given project- Specified by:
getModuleRootin interfaceWorkspaceModule- Parameters:
project- The project containing the modulecreate- True to create the node if it does not exists- Returns:
- The root node, or null if it does not exists and was not created
-