Nuxeo ECM Projects 5.4.3-SNAPSHOT

org.nuxeo.ecm.platform.types
Class TypeService

java.lang.Object
  extended by org.nuxeo.runtime.model.DefaultComponent
      extended by org.nuxeo.ecm.platform.types.TypeService
All Implemented Interfaces:
TypeManager, Adaptable, Component, Extensible

public class TypeService
extends DefaultComponent
implements TypeManager


Field Summary
static String DEFAULT_CATEGORY
           
static String HIDDEN_IN_CREATION
           
static ComponentName ID
           
 
Constructor Summary
TypeService()
           
 
Method Summary
 void activate(ComponentContext context)
          Activates the component.
 boolean canCreate(String typeName, String containerTypeName)
          Returns true if typeName is a sub type, allowed in creation mode, of containerTypeName, false otherwise.
 boolean canCreate(String typeName, String containerTypeName, DocumentModel currentDoc)
          Returns true if typeName is a sub type, allowed in creation, of containerTypeName, false otherwise.
 void deactivate(ComponentContext context)
          Deactivates the component.
 Collection<Type> findAllAllowedSubTypesFrom(String typeName)
          Returns recursively all the allowed sub types from the given typeName.
 Collection<Type> findAllAllowedSubTypesFrom(String typeName, DocumentModel currentDoc)
          Returns recursively all the allowed sub types from the given typeName, filtered by a local UI types configuration retrieved from the currentDoc, if any.
 Collection<Type> getAllowedSubTypes(String typeName)
           
 Collection<Type> getAllowedSubTypes(String typeName, DocumentModel currentDoc)
          Returns the allowed sub types of the given typeName, filtered by a local UI types configuration retrieved from the currentDoc, if any.
 String[] getSuperTypes(String typeName)
          Gets the super type names for the given type.
 Type getType(String typeName)
          Returns the Type instance for the given typeName.
 Map<String,List<Type>> getTypeMapForDocumentType(String typeName, DocumentModel currentDoc)
          Returns the sub type of the given typeName, filtered by a local UI types configuration retrieved from the currentDoc, if any, and organized by type categories.
 TypeRegistry getTypeRegistry()
           
 Collection<Type> getTypes()
          Returns all the registered Types.
 TypeWidgetRegistry getTypeWidgetRegistry()
           
 boolean hasType(String typeName)
          Returns true if typeName is a registered Type, false otherwise.
 boolean isAllowedSubType(String typeName, String containerTypeName)
          Returns true if typeName is an allowed sub type of containerTypeName, false otherwise.
 boolean isAllowedSubType(String typeName, String containerTypeName, DocumentModel currentDoc)
          Returns true if typeName is an allowed sub type of containerTypeName, filtered by a local UI types configuration retrieved from the currentDoc, if any, false otherwise.
 void registerExtension(Extension extension)
          Registers the given extension.
 void registerTypeWidgetExtension(Extension extension)
           
 void unregisterExtension(Extension extension)
          Unregisters the given extension.
 void unregisterTypeWidgetExtension(Extension extension)
           
 
Methods inherited from class org.nuxeo.runtime.model.DefaultComponent
applicationStarted, getAdapter, registerContribution, unregisterContribution
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ID

public static final ComponentName ID

DEFAULT_CATEGORY

public static String DEFAULT_CATEGORY

HIDDEN_IN_CREATION

public static final String HIDDEN_IN_CREATION
See Also:
Constant Field Values
Constructor Detail

TypeService

public TypeService()
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 interface Component
Overrides:
activate in class DefaultComponent
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 interface Component
Overrides:
deactivate in class DefaultComponent
Parameters:
context - the runtime context

registerExtension

public void registerExtension(Extension extension)
Description copied from interface: Extensible
Registers the given extension.

Specified by:
registerExtension in interface Extensible
Overrides:
registerExtension in class DefaultComponent
Parameters:
extension - the extension to register

unregisterExtension

public void unregisterExtension(Extension extension)
Description copied from interface: Extensible
Unregisters the given extension.

Specified by:
unregisterExtension in interface Extensible
Overrides:
unregisterExtension in class DefaultComponent
Parameters:
extension - the extension to unregister

registerTypeWidgetExtension

public void registerTypeWidgetExtension(Extension extension)

unregisterTypeWidgetExtension

public void unregisterTypeWidgetExtension(Extension extension)

getTypeRegistry

public TypeRegistry getTypeRegistry()

getTypeWidgetRegistry

public TypeWidgetRegistry getTypeWidgetRegistry()

getSuperTypes

public String[] getSuperTypes(String typeName)
Description copied from interface: TypeManager
Gets the super type names for the given type.

Specified by:
getSuperTypes in interface TypeManager
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 the Type instance for the given typeName.

Specified by:
getType in interface TypeManager

hasType

public boolean hasType(String typeName)
Description copied from interface: TypeManager
Returns true if typeName is a registered Type, false otherwise.

Specified by:
hasType in interface TypeManager

getTypes

public Collection<Type> getTypes()
Description copied from interface: TypeManager
Returns all the registered Types.

Specified by:
getTypes in interface TypeManager

getAllowedSubTypes

public Collection<Type> getAllowedSubTypes(String typeName)
Specified by:
getAllowedSubTypes in interface TypeManager

getAllowedSubTypes

public Collection<Type> getAllowedSubTypes(String typeName,
                                           DocumentModel currentDoc)
Description copied from interface: TypeManager
Returns the allowed sub types of the given typeName, filtered by a local UI types configuration retrieved from the currentDoc, if any.

Specified by:
getAllowedSubTypes in interface TypeManager

findAllAllowedSubTypesFrom

public Collection<Type> findAllAllowedSubTypesFrom(String typeName)
Description copied from interface: TypeManager
Returns recursively all the allowed sub types from the given typeName.

Specified by:
findAllAllowedSubTypesFrom in interface TypeManager

findAllAllowedSubTypesFrom

public Collection<Type> findAllAllowedSubTypesFrom(String typeName,
                                                   DocumentModel currentDoc)
Description copied from interface: TypeManager
Returns recursively all the allowed sub types from the given typeName, filtered by a local UI types configuration retrieved from the currentDoc, if any.

Specified by:
findAllAllowedSubTypesFrom in interface TypeManager

getTypeMapForDocumentType

public Map<String,List<Type>> getTypeMapForDocumentType(String typeName,
                                                        DocumentModel currentDoc)
Description copied from interface: TypeManager
Returns the sub type of the given typeName, filtered by a local UI types configuration retrieved from the currentDoc, if any, and organized by type categories.

Specified by:
getTypeMapForDocumentType in interface TypeManager

canCreate

public boolean canCreate(String typeName,
                         String containerTypeName)
Description copied from interface: TypeManager
Returns true if typeName is a sub type, allowed in creation mode, of containerTypeName, false otherwise.

Specified by:
canCreate in interface TypeManager

canCreate

public boolean canCreate(String typeName,
                         String containerTypeName,
                         DocumentModel currentDoc)
Description copied from interface: TypeManager
Returns true if typeName is a sub type, allowed in creation, of containerTypeName, false otherwise.

It takes care of a local UI types configuration retrieved from the currentDoc to filter the sub types of typeName before checking the creation mode.

Specified by:
canCreate in interface TypeManager

isAllowedSubType

public boolean isAllowedSubType(String typeName,
                                String containerTypeName)
Description copied from interface: TypeManager
Returns true if typeName is an allowed sub type of containerTypeName, false otherwise.

Specified by:
isAllowedSubType in interface TypeManager

isAllowedSubType

public boolean isAllowedSubType(String typeName,
                                String containerTypeName,
                                DocumentModel currentDoc)
Description copied from interface: TypeManager
Returns true if typeName is an allowed sub type of containerTypeName, filtered by a local UI types configuration retrieved from the currentDoc, if any, false otherwise.

Specified by:
isAllowedSubType in interface TypeManager

Nuxeo ECM Projects 5.4.3-SNAPSHOT

Copyright © 2011 Nuxeo SAS. All Rights Reserved.