Package org.ametys.plugins.workspaces
Class AbstractWorkspaceModule
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.plugins.workspaces.AbstractWorkspaceModule
-
- All Implemented Interfaces:
WorkspaceModule,LogEnabled,PluginAware,Contextualizable,Serviceable
- Direct Known Subclasses:
CalendarWorkspaceModule,DocumentWorkspaceModule,EditionFOWorkspaceModule,MembersWorkspaceModule,TasksWorkspaceModule,ThreadWorkspaceModule
public abstract class AbstractWorkspaceModule extends AbstractLogEnabled implements WorkspaceModule, Serviceable, Contextualizable, PluginAware
Abstract class forWorkspaceModuleimplementation
-
-
Field Summary
Fields Modifier and Type Field Description private static String__URL_CACHE_REQUEST_ATTRIBUTE_NAMEprotected Context_contextThe avalon contextprotected CurrentUserProvider_currentUserProviderThe current user provider.protected I18nUtils_i18nUtilsThe i18n utils.protected ObservationManager_observationManagerObserver manager.protected PageDAO_pageDAOThe page DAOprotected String_pluginNameThe plugin nameprotected ProjectManager_projectManagerProject managerprotected ProjectRightHelper_projectRightHelperProject right helperprotected AmetysObjectResolver_resolverAmetys resolverprotected RightManager_rightManagerThe rights managerprotected ServiceExtensionPoint_serviceEPThe services handlerprotected SkinsManager_skinsManagerThe skins manager.protected UserHelper_userHelperThe users managerprotected UserManager_userManagerUser manager
-
Constructor Summary
Constructors Constructor Description AbstractWorkspaceModule()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description (package private) String_computedModuleUrl(Project project, String language)protected ModifiablePage_createModulePage(Sitemap sitemap, String name, I18nizableText pageTitle, String skinTemplate)Create a new page if not already existsprotected void_deletePages(Project project, String pageName)Delete all pages of the project sites matching the page nameprotected <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.(package private) Map<Triple<String,String,String>,String>_getModuleUrlsCache()protected void_internalActivateModule(Project project)Internal process when module is activatedprotected void_internalDeactivateModule(Project project)Internal process when module is deactivatedvoidactivateModule(Project project)Activate the module for the project, creating the module pagesvoidcontextualize(Context context)voiddeactivateModule(Project project)Delete all data related to the module in the project, and the module pagesprotected abstract StringgetModulePageName()Returns the module page's nameAmetysObjectIterable<Page>getModulePages(Project project, String language)Retrieves the pages of the moduleprotected StringgetModulePageTemplate()Returns the template to use for module's pageprotected abstract I18nizableTextgetModulePageTitle()Returns the module page's title as i18nprotected abstract StringgetModuleTagName()Returns the tag of apply to module pageStringgetModuleUrl(Project project, String language)Get the URL of the first module's pageprotected abstract voidinitializeModulePage(ModifiablePage modulePage)Initialize the module pagevoidinitializeSitemap(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, setLogger
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.ametys.plugins.workspaces.project.modules.WorkspaceModule
getAllowedEventTypes, getId, getModuleName, getModuleRoot, getModuleTitle
-
-
-
-
Field Detail
-
__URL_CACHE_REQUEST_ATTRIBUTE_NAME
private static final String __URL_CACHE_REQUEST_ATTRIBUTE_NAME
-
_projectManager
protected ProjectManager _projectManager
Project manager
-
_projectRightHelper
protected ProjectRightHelper _projectRightHelper
Project right helper
-
_userManager
protected UserManager _userManager
User manager
-
_resolver
protected AmetysObjectResolver _resolver
Ametys resolver
-
_rightManager
protected RightManager _rightManager
The rights manager
-
_observationManager
protected ObservationManager _observationManager
Observer manager.
-
_currentUserProvider
protected CurrentUserProvider _currentUserProvider
The current user provider.
-
_userHelper
protected UserHelper _userHelper
The users manager
-
_i18nUtils
protected I18nUtils _i18nUtils
The i18n utils.
-
_skinsManager
protected SkinsManager _skinsManager
The skins manager.
-
_pluginName
protected String _pluginName
The plugin name
-
_serviceEP
protected ServiceExtensionPoint _serviceEP
The services handler
-
-
Constructor Detail
-
AbstractWorkspaceModule
public AbstractWorkspaceModule()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
servicein interfaceServiceable- Throws:
ServiceException
-
contextualize
public void contextualize(Context context) throws ContextException
- Specified by:
contextualizein interfaceContextualizable- Throws:
ContextException
-
setPluginInfo
public void setPluginInfo(String pluginName, String featureName, String id)
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
-
deactivateModule
public void deactivateModule(Project project)
Description copied from interface:WorkspaceModuleDelete all data related to the module in the project, and the module pages- Specified by:
deactivateModulein interfaceWorkspaceModule- Parameters:
project- The project
-
activateModule
public void activateModule(Project project)
Description copied from interface:WorkspaceModuleActivate the module for the project, creating the module pages- Specified by:
activateModulein interfaceWorkspaceModule- Parameters:
project- The project
-
initializeSitemap
public void initializeSitemap(Sitemap sitemap)
Description copied from interface:WorkspaceModuleInitialize the sitemap for the module- Specified by:
initializeSitemapin interfaceWorkspaceModule- Parameters:
sitemap- The sitemap
-
getModulePages
public AmetysObjectIterable<Page> getModulePages(Project project, String language)
Description copied from interface:WorkspaceModuleRetrieves the pages of the module- Specified by:
getModulePagesin interfaceWorkspaceModule- Parameters:
project- The projectlanguage- the sitemap language ornullfor all sitemap languages.- Returns:
- the pages iterator
-
getModuleUrl
public String getModuleUrl(Project project, String language)
Description copied from interface:WorkspaceModuleGet the URL of the first module's page- Specified by:
getModuleUrlin interfaceWorkspaceModule- Parameters:
project- The projectlanguage- the sitemap language. Cannot be null.- Returns:
- the module url
-
_computedModuleUrl
String _computedModuleUrl(Project project, String language)
-
_createModulePage
protected ModifiablePage _createModulePage(Sitemap sitemap, String name, I18nizableText pageTitle, String skinTemplate)
Create a new page if not already exists- Parameters:
sitemap- 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
-
_deletePages
protected void _deletePages(Project project, String pageName)
Delete all pages of the project sites matching the page name- Parameters:
project- The projectpageName- The page name
-
_getDefaultXslt
protected String _getDefaultXslt(String serviceId)
Get the default value of the XSLT parameter of the given service.- Parameters:
serviceId- the service ID.- Returns:
- the default XSLT parameter value.
-
getModuleTagName
protected abstract String getModuleTagName()
Returns the tag of apply to module page- Returns:
- The tag for module page
-
getModulePageName
protected abstract String getModulePageName()
Returns the module page's name- Returns:
- The module page's name
-
getModulePageTitle
protected abstract I18nizableText getModulePageTitle()
Returns the module page's title as i18n- Returns:
- The module page's title
-
getModulePageTemplate
protected String getModulePageTemplate()
Returns the template to use for module's page- Returns:
- The template
-
initializeModulePage
protected abstract void initializeModulePage(ModifiablePage modulePage)
Initialize the module page- Parameters:
modulePage- The module page
-
_internalDeactivateModule
protected void _internalDeactivateModule(Project project)
Internal process when module is deactivated- Parameters:
project- The project
-
_internalActivateModule
protected void _internalActivateModule(Project project)
Internal process when module is activated- Parameters:
project- The project
-
_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
-
-