Class ProjectXsltHelper
java.lang.Object
org.ametys.plugins.workspaces.project.helper.ProjectXsltHelper
- All Implemented Interfaces:
Contextualizable,LogEnabled,Serviceable
Helper component to be used from XSL stylesheets to get info related to projects.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanReturns true if current user can access to the back-officestatic booleanReturns true if current user can leave the projectstatic MapElementcategoryColor(String categoryId) Return the color associated to the categorystatic MapElementcategoryColor(Category category) Return the color associated to the categorystatic StringcomputeDefaultLanguage(String language) Get the language that will be the default value of the available values.voidcontextualize(Context context) voidenableLogging(Logger logger) static StringGet the id of alerts root's pagestatic StringgetLanguageLabel(String code, String language) Get the translated label associated to the codegetMemberStatus(String userAsString) Get the status of the user in the current project "not-allowed" if the user is not allowed in the module in the current project "current-user" if the user is the current user and in the project "allowed" if the user is allowed in the module in the current project and not the current userstatic StringgetModulePage(String moduleId) Get the module page.static StringGet the id of news root's pagestatic booleanhasRightOnModule(String rightId, String moduleId) Returns true if the current user has the specified right on the specified workspace modulestatic booleanDetermines if the current user is a manager of current projectstatic booleanDetermines if the current user is a manager for the projectstatic booleanDetermines if a user is a managerstatic booleanDetermines if the given user is a manager for the projectstatic booleanisResourceFromWorkspace(String resourceId) True if the resource comes from workspacesstatic Stringproject()Returns the current projectstatic MapElementReturn the color associated to the first category associated to the current projectstatic MapElementprojectCategoryColor(String projectName) Return the color associated to the first category associated to the given projectstatic StringReturn the color associated to the first category associated to the current projectstatic StringprojectCategoryLabel(String projectName) Return the color associated to the first category associated to the given projectstatic StringReturns the creation date of the current projectstatic StringprojectCreationDate(String projectName) Returns the creation date of the given projectstatic StringReturns the description of the current projectstatic StringprojectDescription(String projectName) Returns the description of the given projectstatic MapElementReturns the information of current projectstatic MapElementprojectInfo(String projectName) Returns the project informationstatic NodeListReturns the keywords of the current projectstatic NodeListprojectKeywords(String projectName) Returns the project keywordsstatic StringGet the date of last activity for current projectstatic StringprojectLastActivityDate(String projectName) Get the date of last activity for a given projectstatic StringReturns the title of the current projectstatic StringprojectTitle(String projectName) Returns the title of the given projectstatic NoderesourceSite(String projectResourceId) Get the site of a project's resourcevoidservice(ServiceManager manager)
-
Constructor Details
-
ProjectXsltHelper
public ProjectXsltHelper()
-
-
Method Details
-
contextualize
- Specified by:
contextualizein interfaceContextualizable- Throws:
ContextException
-
enableLogging
- Specified by:
enableLoggingin interfaceLogEnabled
-
service
- Specified by:
servicein interfaceServiceable- Throws:
ServiceException
-
project
Returns the current project- Returns:
- the current project
-
projectInfo
Returns the information of current project- Returns:
- the information of current project
-
projectInfo
Returns the project information- Parameters:
projectName- The project name- Returns:
- the project information
-
projectTitle
Returns the title of the current project- Returns:
- the title of the current project
-
projectTitle
Returns the title of the given project- Parameters:
projectName- The project to consider- Returns:
- the title of the given project or empty otherwise
-
projectDescription
Returns the description of the current project- Returns:
- the description of the current project
-
projectDescription
Returns the description of the given project- Parameters:
projectName- The project to consider- Returns:
- the description of the given project or empty otherwise
-
projectKeywords
Returns the keywords of the current project- Returns:
- keywords of the current project
-
projectKeywords
Returns the project keywords- Parameters:
projectName- the project name- Returns:
- the project keywords
-
projectCreationDate
Returns the creation date of the current project- Returns:
- the creation date of the current project at the ISO format or empty otherwise
-
projectCreationDate
Returns the creation date of the given project- Parameters:
projectName- The project to consider- Returns:
- the creation date of the given project at the ISO format or empty otherwise
-
projectCategoryColor
Return the color associated to the first category associated to the current project- Returns:
- the hexa code color or the default color if no color is associated to the first category or if not category is associated. <color> <main>#FFFFFF</main> <text>#000000</text> </color>
-
projectCategoryColor
Return the color associated to the first category associated to the given project- Parameters:
projectName- The project to consider- Returns:
- the hexa code color or the default color if no color is associated to the first category or if not category is associated <color> <main>#FFFFFF</main> <text>#000000</text> </color>
-
categoryColor
Return the color associated to the category- Parameters:
categoryId- category id- Returns:
- the hexa code color or the default color if no color is associated to the category or if null <color> <main>#FFFFFF</main> <text>#000000</text> </color>
-
categoryColor
Return the color associated to the category- Parameters:
category- category- Returns:
- the hexa code color or the default color if no color is associated to the category or if null <color> <main>#FFFFFF</main> <text>#000000</text> </color>
-
projectCategoryLabel
Return the color associated to the first category associated to the current project- Returns:
- the hexa code color or the default color if no color is associated to the first category or if not category is associated
-
projectCategoryLabel
Return the color associated to the first category associated to the given project- Parameters:
projectName- The project to consider- Returns:
- the label or empty if no category
-
projectLastActivityDate
Get the date of last activity for current project- Returns:
- the formatted date of last activity or creation date if there is no activity yet
-
projectLastActivityDate
Get the date of last activity for a given project- Parameters:
projectName- the project's name- Returns:
- the formatted date of last activity or creation date if there is no activity yet
-
isResourceFromWorkspace
True if the resource comes from workspaces- Parameters:
resourceId- the resource id- Returns:
- true if the resource comes from workspaces
-
resourceSite
Get the site of a project's resource- Parameters:
projectResourceId- The resource id- Returns:
- The site <site id="site://xxx" name="siteName"><title>Site's titleX</title><url>http://...</url>/site>
-
getNewsRootPageId
Get the id of news root's page- Returns:
- the id of news root's page or null if not exists
-
getAlertsRootPageId
Get the id of alerts root's page- Returns:
- the id of alerts root's page or null if not exists
-
getModulePage
Get the module page. Be careful, the read access is not check !- Parameters:
moduleId- the module id- Returns:
- the module page
-
getLanguageLabel
Get the translated label associated to the code- Parameters:
code- The language codelanguage- The language in which translate the label- Returns:
- The label associated to the code
-
computeDefaultLanguage
Get the language that will be the default value of the available values. First choice will be the page language, 'en' otherwise, first available language otherwise.- Parameters:
language- The current page language- Returns:
- A language code
-
isManager
Determines if the current user is a manager of current project- Returns:
- true if the current user is manager
-
isManager
Determines if a user is a manager- Parameters:
login- the user's loginpopulationId- the user's population- Returns:
- true if the user is manager
-
isManager
Determines if the current user is a manager for the project- Parameters:
projectName- the project's name- Returns:
- true if the current user is manager
-
isManager
Determines if the given user is a manager for the project- Parameters:
projectName- the project's namelogin- the user's loginpopulationId- the user's population- Returns:
- true if the user is manager
-
hasRightOnModule
Returns true if the current user has the specified right on the specified workspace module- Parameters:
rightId- Right IdmoduleId- Module Id- Returns:
- true if the current user has the specified right on the specified module
-
canAccessBO
Returns true if current user can access to the back-office- Returns:
- true if current user can access to the back-office
-
canLeaveProject
Returns true if current user can leave the project- Returns:
- true if current user can leave the project
-
getMemberStatus
Get the status of the user in the current project "not-allowed" if the user is not allowed in the module in the current project "current-user" if the user is the current user and in the project "allowed" if the user is allowed in the module in the current project and not the current user- Parameters:
userAsString- the user as string- Returns:
- the status of the user in the current project
-