Class NodeTypeHierarchyComponent
- java.lang.Object
-
- org.apache.avalon.framework.logger.AbstractLogEnabled
-
- org.ametys.workspaces.repository.jcr.NodeTypeHierarchyComponent
-
- All Implemented Interfaces:
Component
,Contextualizable
,LogEnabled
,Serviceable
public class NodeTypeHierarchyComponent extends AbstractLogEnabled implements Component, Contextualizable, Serviceable
Node type hierarchy component.
-
-
Field Summary
Fields Modifier and Type Field Description protected Context
_context
The avalon context.protected ServiceManager
_manager
The service manager.protected RepositoryProvider
_repositoryProvider
The repository provider.protected Map<String,Map<String,Set<String>>>
_subTypes
The subtypes registry, by workspace.static String
ROLE
The avalon role.
-
Constructor Summary
Constructors Constructor Description NodeTypeHierarchyComponent()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
_buildTypeHierarchy(String workspaceName)
Compute the primary type hierarchy.protected Workspace
_getWorkspace(Request request, String workspaceName)
Get the repository and session and set the _repository and _session protected fieldsvoid
contextualize(Context context)
Set<String>
getAvailableChildrenTypes(NodeDefinition nodeDef, String workspaceName)
Get the available children types for a given node type in a workspace.Set<String>
getDirectSubTypes(NodeType nodeType, String workspaceName)
Get the sub types of a given node type in a specific workspace.Set<String>
getRecursiveSubTypes(String nodeType, String workspaceName)
Get the sub types of a given node type in a specific workspace.void
service(ServiceManager manager)
-
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
-
-
-
Field Detail
-
_subTypes
protected Map<String,Map<String,Set<String>>> _subTypes
The subtypes registry, by workspace.
-
_repositoryProvider
protected RepositoryProvider _repositoryProvider
The repository provider.
-
_manager
protected ServiceManager _manager
The service manager.
-
-
Constructor Detail
-
NodeTypeHierarchyComponent
public NodeTypeHierarchyComponent()
-
-
Method Detail
-
contextualize
public void contextualize(Context context) throws ContextException
- Specified by:
contextualize
in interfaceContextualizable
- Throws:
ContextException
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
getDirectSubTypes
public Set<String> getDirectSubTypes(NodeType nodeType, String workspaceName) throws RepositoryException
Get the sub types of a given node type in a specific workspace.- Parameters:
nodeType
- the node type.workspaceName
- the workspace name.- Returns:
- the sub types of the node type in the given workspace.
- Throws:
RepositoryException
- if an error occurred
-
getRecursiveSubTypes
public Set<String> getRecursiveSubTypes(String nodeType, String workspaceName) throws RepositoryException
Get the sub types of a given node type in a specific workspace.- Parameters:
nodeType
- the node type.workspaceName
- the workspace name.- Returns:
- the sub types of the node type in the given workspace.
- Throws:
RepositoryException
- if an error occurred
-
getAvailableChildrenTypes
public Set<String> getAvailableChildrenTypes(NodeDefinition nodeDef, String workspaceName) throws RepositoryException
Get the available children types for a given node type in a workspace.- Parameters:
nodeDef
- the node definition.workspaceName
- the workspace name.- Returns:
- the available node types.
- Throws:
RepositoryException
- if an error occurred
-
_buildTypeHierarchy
protected void _buildTypeHierarchy(String workspaceName) throws RepositoryException
Compute the primary type hierarchy.- Parameters:
workspaceName
- The workspace name to use- Throws:
RepositoryException
- if an error occurs.
-
_getWorkspace
protected Workspace _getWorkspace(Request request, String workspaceName) throws RepositoryException, ServiceException
Get the repository and session and set the _repository and _session protected fields- Parameters:
request
- The requestworkspaceName
- The jcr workspace- Returns:
- the workspace.
- Throws:
RepositoryException
- if an error occured.ServiceException
- if the repository can't be looked up.
-
-