Package org.nuxeo.ecm.platform.types
Class TypeService
- java.lang.Object
-
- org.nuxeo.runtime.model.DefaultComponent
-
- org.nuxeo.ecm.platform.types.TypeService
-
- All Implemented Interfaces:
TypeManager
,Adaptable
,Component
,Extensible
,TimestampedService
public class TypeService extends DefaultComponent implements TypeManager
-
-
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_CATEGORY
static String
HIDDEN_IN_CREATION
static ComponentName
ID
-
Fields inherited from class org.nuxeo.runtime.model.DefaultComponent
lastModified, name
-
-
Constructor Summary
Constructors Constructor Description TypeService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
activate(ComponentContext context)
Activates the component.boolean
canCreate(String typeName, String containerTypeName)
Returnstrue
iftypeName
is a sub type, allowed in creation mode, ofcontainerTypeName
,false
otherwise.boolean
canCreate(String typeName, String containerTypeName, DocumentModel currentDoc)
Returnstrue
iftypeName
is a sub type, allowed in creation, ofcontainerTypeName
,false
otherwise.protected boolean
canCreate(String typeName, Map<String,SubType> allowedSubTypes)
protected boolean
canCreate(SubType subType)
void
deactivate(ComponentContext context)
Deactivates the component.protected Map<String,SubType>
filterSubTypesFromConfiguration(Map<String,SubType> allowedSubTypes, DocumentModel currentDoc)
Collection<Type>
findAllAllowedSubTypesFrom(String typeName)
Returns recursively all the allowed sub types from the giventypeName
.Collection<Type>
findAllAllowedSubTypesFrom(String typeName, DocumentModel currentDoc)
Returns recursively all the allowed sub types from the giventypeName
, filtered by a local UI types configuration retrieved from thecurrentDoc
, if any.protected Collection<Type>
findAllAllowedSubTypesFrom(String typeName, DocumentModel currentDoc, List<String> alreadyProcessedTypes)
Collection<Type>
getAllowedSubTypes(String typeName)
Collection<Type>
getAllowedSubTypes(String typeName, DocumentModel currentDoc)
Returns the allowed sub types of the giventypeName
, filtered by a local UI types configuration retrieved from thecurrentDoc
, if any.protected UITypesConfiguration
getConfiguration(DocumentModel currentDoc)
protected Map<String,SubType>
getFilteredAllowedSubTypes(String containerTypeName, DocumentModel currentDoc)
String[]
getSuperTypes(String typeName)
Gets the super type names for the given type.Type
getType(String typeName)
Returns theType
instance for the giventypeName
.Map<String,List<Type>>
getTypeMapForDocumentType(String typeName, DocumentModel currentDoc)
Returns the sub type of the giventypeName
, filtered by a local UI types configuration retrieved from thecurrentDoc
, if any, and organized by type categories.TypeRegistry
getTypeRegistry()
Collection<Type>
getTypes()
Returns all the registeredType
s.boolean
hasType(String typeName)
Returnstrue
iftypeName
is a registered Type,false
otherwise.boolean
isAllowedSubType(String typeName, String containerTypeName)
Returnstrue
iftypeName
is an allowed sub type ofcontainerTypeName
,false
otherwise.boolean
isAllowedSubType(String typeName, String containerTypeName, DocumentModel currentDoc)
Returnstrue
iftypeName
is an allowed sub type ofcontainerTypeName
, filtered by a local UI types configuration retrieved from thecurrentDoc
, if any,false
otherwise.protected boolean
isAllowedSubType(String typeName, Map<String,SubType> allowedSubTypes)
void
registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
void
unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
-
Methods inherited from class org.nuxeo.runtime.model.DefaultComponent
addRuntimeMessage, addRuntimeMessage, getAdapter, getDescriptor, getDescriptors, getLastModified, getRegistry, register, registerExtension, setLastModified, setModifiedNow, setName, start, stop, unregister, unregisterExtension
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.nuxeo.runtime.model.Component
applicationStarted, getApplicationStartedOrder
-
Methods inherited from interface org.nuxeo.runtime.service.TimestampedService
getLastModified, setLastModified
-
-
-
-
Field Detail
-
ID
public static final ComponentName ID
-
DEFAULT_CATEGORY
public static final String DEFAULT_CATEGORY
- See Also:
- Constant Field Values
-
HIDDEN_IN_CREATION
public static final String HIDDEN_IN_CREATION
- See Also:
- Constant Field Values
-
-
Method Detail
-
activate
public void activate(ComponentContext context)
Description copied from interface:Component
Activates the component.This method is called by the runtime when a component is activated.
- Specified by:
activate
in interfaceComponent
- Overrides:
activate
in classDefaultComponent
- Parameters:
context
- the runtime context
-
deactivate
public void deactivate(ComponentContext context)
Description copied from interface:Component
Deactivates the component.This method is called by the runtime when a component is deactivated.
- Specified by:
deactivate
in interfaceComponent
- Overrides:
deactivate
in classDefaultComponent
- Parameters:
context
- the runtime context
-
registerContribution
public void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
- Overrides:
registerContribution
in classDefaultComponent
-
unregisterContribution
public void unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
- Overrides:
unregisterContribution
in classDefaultComponent
-
getTypeRegistry
public TypeRegistry getTypeRegistry()
-
getSuperTypes
public String[] getSuperTypes(String typeName)
Description copied from interface:TypeManager
Gets the super type names for the given type.- Specified by:
getSuperTypes
in interfaceTypeManager
- Returns:
- an array of supertypes or an empty array if no supertype exists. null is returned if no such type exists
-
getType
public Type getType(String typeName)
Description copied from interface:TypeManager
Returns theType
instance for the giventypeName
.- Specified by:
getType
in interfaceTypeManager
-
hasType
public boolean hasType(String typeName)
Description copied from interface:TypeManager
Returnstrue
iftypeName
is a registered Type,false
otherwise.- Specified by:
hasType
in interfaceTypeManager
-
getTypes
public Collection<Type> getTypes()
Description copied from interface:TypeManager
Returns all the registeredType
s.- Specified by:
getTypes
in interfaceTypeManager
-
getAllowedSubTypes
public Collection<Type> getAllowedSubTypes(String typeName)
- Specified by:
getAllowedSubTypes
in interfaceTypeManager
-
getAllowedSubTypes
public Collection<Type> getAllowedSubTypes(String typeName, DocumentModel currentDoc)
Description copied from interface:TypeManager
Returns the allowed sub types of the giventypeName
, filtered by a local UI types configuration retrieved from thecurrentDoc
, if any.- Specified by:
getAllowedSubTypes
in interfaceTypeManager
-
findAllAllowedSubTypesFrom
public Collection<Type> findAllAllowedSubTypesFrom(String typeName)
Description copied from interface:TypeManager
Returns recursively all the allowed sub types from the giventypeName
.- Specified by:
findAllAllowedSubTypesFrom
in interfaceTypeManager
-
findAllAllowedSubTypesFrom
public Collection<Type> findAllAllowedSubTypesFrom(String typeName, DocumentModel currentDoc)
Description copied from interface:TypeManager
Returns recursively all the allowed sub types from the giventypeName
, filtered by a local UI types configuration retrieved from thecurrentDoc
, if any.- Specified by:
findAllAllowedSubTypesFrom
in interfaceTypeManager
-
findAllAllowedSubTypesFrom
protected Collection<Type> findAllAllowedSubTypesFrom(String typeName, DocumentModel currentDoc, List<String> alreadyProcessedTypes)
-
getConfiguration
protected UITypesConfiguration getConfiguration(DocumentModel currentDoc)
-
getTypeMapForDocumentType
public Map<String,List<Type>> getTypeMapForDocumentType(String typeName, DocumentModel currentDoc)
Description copied from interface:TypeManager
Returns the sub type of the giventypeName
, filtered by a local UI types configuration retrieved from thecurrentDoc
, if any, and organized by type categories.- Specified by:
getTypeMapForDocumentType
in interfaceTypeManager
-
canCreate
public boolean canCreate(String typeName, String containerTypeName)
Description copied from interface:TypeManager
Returnstrue
iftypeName
is a sub type, allowed in creation mode, ofcontainerTypeName
,false
otherwise.- Specified by:
canCreate
in interfaceTypeManager
-
canCreate
public boolean canCreate(String typeName, String containerTypeName, DocumentModel currentDoc)
Description copied from interface:TypeManager
Returnstrue
iftypeName
is a sub type, allowed in creation, ofcontainerTypeName
,false
otherwise.It takes care of a local UI types configuration retrieved from the
currentDoc
to filter the sub types oftypeName
before checking the creation mode.- Specified by:
canCreate
in interfaceTypeManager
-
getFilteredAllowedSubTypes
protected Map<String,SubType> getFilteredAllowedSubTypes(String containerTypeName, DocumentModel currentDoc)
-
canCreate
protected boolean canCreate(SubType subType)
-
isAllowedSubType
public boolean isAllowedSubType(String typeName, String containerTypeName)
Description copied from interface:TypeManager
Returnstrue
iftypeName
is an allowed sub type ofcontainerTypeName
,false
otherwise.- Specified by:
isAllowedSubType
in interfaceTypeManager
-
isAllowedSubType
protected boolean isAllowedSubType(String typeName, Map<String,SubType> allowedSubTypes)
-
isAllowedSubType
public boolean isAllowedSubType(String typeName, String containerTypeName, DocumentModel currentDoc)
Description copied from interface:TypeManager
Returnstrue
iftypeName
is an allowed sub type ofcontainerTypeName
, filtered by a local UI types configuration retrieved from thecurrentDoc
, if any,false
otherwise.- Specified by:
isAllowedSubType
in interfaceTypeManager
-
-