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_categoryColorsComponentprivate static CategoryProviderExtensionPoint_categoryProviderEPprivate static Context_contextprivate static I18nUtils_i18nUtilsprivate static Logger_loggerprivate static ProjectInvitationHelper_projectInvitationHelperprivate static ProjectManager_projectManagerprivate 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 booleancanInviteUsersToProject(String projectName, String lang)Check if the current user is allowed to invite users, and if the invitations are correctly configuredvoidcontextualize(Context context)voidenableLogging(Logger logger)static booleanisResourceFromWorkspace(String resourceId)True if the resource comes from workspacesstatic Stringproject()Returns the current projectstatic MapElementprojectCategoryColor()Return 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 StringprojectCategoryLabel()Return 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 StringprojectCreationDate()Returns the creation date of the current projectstatic StringprojectCreationDate(String projectName)Returns the creation date of the given projectstatic StringprojectDescription()Returns the description of the current projectstatic StringprojectDescription(String projectName)Returns the description of the given projectstatic StringprojectTitle()Returns 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)
-
-
-
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:
contextualizein interfaceContextualizable- Throws:
ContextException
-
enableLogging
public void enableLogging(Logger logger)
- Specified by:
enableLoggingin interfaceLogEnabled
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
servicein 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
-
-