Class ProjectXsltHelper
- java.lang.Object
-
- org.ametys.plugins.workspaces.project.helper.ProjectXsltHelper
-
- All Implemented Interfaces:
Contextualizable
,LogEnabled
,Serviceable
public class ProjectXsltHelper extends Object implements Serviceable, Contextualizable, LogEnabled
Helper component to be used from XSL stylesheets to get info related to projects.
-
-
Field Summary
Fields Modifier and Type Field Description private static CategoryColorsComponent
_categoryColorsComponent
private static CategoryProviderExtensionPoint
_categoryProviderEP
private static Context
_context
private static I18nUtils
_i18nUtils
private static Logger
_logger
private static ProjectInvitationHelper
_projectInvitationHelper
private static ProjectManager
_projectManager
private static SiteManager
_siteManager
-
Constructor Summary
Constructors Constructor Description ProjectXsltHelper()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static Category
_getFirstCategory(Project project)
static boolean
canInviteUsersToProject(String projectName, String lang)
Check if the current user is allowed to invite users, and if the invitations are correctly configuredvoid
contextualize(Context context)
void
enableLogging(Logger logger)
static boolean
isResourceFromWorkspace(String resourceId)
True if the resource comes from workspacesstatic String
project()
Returns the current projectstatic MapElement
projectCategoryColor()
Return the color associated to the first category associated to the current projectstatic MapElement
projectCategoryColor(String projectName)
Return the color associated to the first category associated to the given projectstatic String
projectCategoryLabel()
Return the color associated to the first category associated to the current projectstatic String
projectCategoryLabel(String projectName)
Return the color associated to the first category associated to the given projectstatic String
projectCreationDate()
Returns the creation date of the current projectstatic String
projectCreationDate(String projectName)
Returns the creation date of the given projectstatic String
projectDescription()
Returns the description of the current projectstatic String
projectDescription(String projectName)
Returns the description of the given projectstatic String
projectTitle()
Returns the title of the current projectstatic String
projectTitle(String projectName)
Returns the title of the given projectstatic Node
resourceSite(String projectResourceId)
Get the site of a project's resourcevoid
service(ServiceManager manager)
-
-
-
Field Detail
-
_siteManager
private static SiteManager _siteManager
-
_projectManager
private static ProjectManager _projectManager
-
_categoryProviderEP
private static CategoryProviderExtensionPoint _categoryProviderEP
-
_categoryColorsComponent
private static CategoryColorsComponent _categoryColorsComponent
-
_i18nUtils
private static I18nUtils _i18nUtils
-
_projectInvitationHelper
private static ProjectInvitationHelper _projectInvitationHelper
-
-
Constructor Detail
-
ProjectXsltHelper
public ProjectXsltHelper()
-
-
Method Detail
-
contextualize
public void contextualize(Context context) throws ContextException
- Specified by:
contextualize
in interfaceContextualizable
- Throws:
ContextException
-
enableLogging
public void enableLogging(Logger logger)
- Specified by:
enableLogging
in interfaceLogEnabled
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
projectTitle
public static String projectTitle()
Returns the title of the current project- Returns:
- the title of the current project
-
projectTitle
public static String projectTitle(String projectName)
Returns the title of the given project- Parameters:
projectName
- The project to consider- Returns:
- the title of the given project or empty otherwise
-
projectDescription
public static String projectDescription()
Returns the description of the current project- Returns:
- the description of the current project
-
projectDescription
public static String projectDescription(String projectName)
Returns the description of the given project- Parameters:
projectName
- The project to consider- Returns:
- the description of the given project or empty otherwise
-
projectCreationDate
public static String 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
public static String projectCreationDate(String projectName)
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
public static MapElement 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
public static MapElement projectCategoryColor(String projectName)
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>
-
_getFirstCategory
private static Category _getFirstCategory(Project project)
-
projectCategoryLabel
public static String 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
public static String projectCategoryLabel(String projectName)
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
-
isResourceFromWorkspace
public static boolean isResourceFromWorkspace(String resourceId)
True if the resource comes from workspaces- Parameters:
resourceId
- the resource id- Returns:
- true if the resource comes from workspaces
-
resourceSite
public static Node resourceSite(String projectResourceId)
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>
-
canInviteUsersToProject
public static boolean canInviteUsersToProject(String projectName, String lang)
Check if the current user is allowed to invite users, and if the invitations are correctly configured- Parameters:
projectName
- The project namelang
- The project language- Returns:
- True if users can be invited
-
-