Nuxeo Enterprise Platform 5.4

org.nuxeo.ecm.core.schema
Class DocumentTypeImpl

java.lang.Object
  extended by org.nuxeo.ecm.core.schema.types.AbstractType
      extended by org.nuxeo.ecm.core.schema.types.ComplexTypeImpl
          extended by org.nuxeo.ecm.core.schema.types.CompositeTypeImpl
              extended by org.nuxeo.ecm.core.schema.DocumentTypeImpl
All Implemented Interfaces:
java.io.Serializable, DocumentType, ComplexType, CompositeType, Type, ValueConverter

public class DocumentTypeImpl
extends CompositeTypeImpl
implements DocumentType

Implementation of a document type.

This class uses lazy loading for schemas and field types.

Schemas and fields are cached to improve lookups time.

Author:
Bogdan Stefanescu
See Also:
Serialized Form

Field Summary
static int T_DOCUMENT
           
static int T_FOLDER
           
static int T_ORDERED
           
 
Fields inherited from class org.nuxeo.ecm.core.schema.types.ComplexTypeImpl
F_UNSTRUCT_DEFAULT, F_UNSTRUCT_FALSE, F_UNSTRUCT_TRUE
 
Fields inherited from class org.nuxeo.ecm.core.schema.types.AbstractType
EMPTY_SUPERTYPES, F_NOTNULL, F_READONLY
 
Fields inherited from interface org.nuxeo.ecm.core.schema.types.Type
ANY
 
Constructor Summary
DocumentTypeImpl(DocumentType superType, java.lang.String name)
           
DocumentTypeImpl(DocumentType superType, java.lang.String name, java.lang.String[] declaredSchemas)
           
DocumentTypeImpl(DocumentType superType, java.lang.String name, java.lang.String[] declaredSchemas, java.lang.String[] declaredFacets)
           
DocumentTypeImpl(TypeRef<DocumentType> superType, java.lang.String name)
           
DocumentTypeImpl(TypeRef<DocumentType> superType, java.lang.String name, java.lang.String[] declaredSchemas)
           
DocumentTypeImpl(TypeRef<DocumentType> superType, java.lang.String name, java.lang.String[] declaredSchemas, java.lang.String[] facets)
           
DocumentTypeImpl(TypeRef<DocumentType> superType, java.lang.String name, java.lang.String[] declaredSchemas, java.lang.String[] facets, int type)
           
 
Method Summary
 void addSchemas(java.lang.String[] schemas)
          Adds specified schemas to the document type.
 java.lang.String[] getChildrenTypes()
          Gets the type names that can be used for children docs.
 java.util.Set<java.lang.String> getFacets()
          Gets all the facets of this document type.
 PrefetchInfo getPrefetchInfo()
          Gets the prefetch info, or null if no prefetch is defined.
 TypeRef<DocumentType> getRef()
          Gets a proxy (or reference to this type).
 DocumentType[] getResolvedChildrenTypes()
          Gets the resolved children doc types.
 boolean isChildTypeAllowed(java.lang.String name)
           
 boolean isFile()
          Tests whether this type describes a document (not a folder!)
 boolean isFolder()
          Tests whether this type describes a folder or not.
 boolean isOrdered()
          Tests whether this type describe an ordered folder or not.
 boolean isUnstructured()
          Tests whether this type is structured or not.
 void setChildrenTypes(java.lang.String[] subTypes)
          Sets the names of the allowed children doc types.
 void setDeclaredFacets(java.lang.String[] facets)
           
 void setPrefetchInfo(PrefetchInfo prefetchInfo)
          Sets the prefetch info.
 
Methods inherited from class org.nuxeo.ecm.core.schema.types.CompositeTypeImpl
addField, addSchema, addSchema, getField, getField, getFields, getSchema, getSchemaByPrefix, getSchemaNames, getSchemas, hasField, hasSchema, hasSchemas, isComplexType, isCompositeType, validate
 
Methods inherited from class org.nuxeo.ecm.core.schema.types.ComplexTypeImpl
addField, addField, addField, convert, getFieldsCount, getNamespace, hasField, hasFields, newInstance, toString
 
Methods inherited from class org.nuxeo.ecm.core.schema.types.AbstractType
decode, encode, getHelper, getName, getSchema, getSchemaName, getSuperType, getTypeHierarchy, isAny, isAnyType, isListType, isNotNull, isReadOnly, isSimpleType, isSuperTypeOf, setNotNull, setReadOnly
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.nuxeo.ecm.core.schema.types.CompositeType
addSchema, addSchema, getSchema, getSchemaByPrefix, getSchemaNames, getSchemas, hasSchema, hasSchemas
 
Methods inherited from interface org.nuxeo.ecm.core.schema.types.ComplexType
addField, addField, addField, addField, getField, getField, getFields, getFieldsCount, getNamespace, hasField, hasField, hasFields
 
Methods inherited from interface org.nuxeo.ecm.core.schema.types.Type
decode, encode, getHelper, getName, getSchema, getSchemaName, getSuperType, getTypeHierarchy, isAnyType, isComplexType, isCompositeType, isListType, isNotNull, isReadOnly, isSimpleType, isSuperTypeOf, newInstance, validate
 
Methods inherited from interface org.nuxeo.ecm.core.schema.types.ValueConverter
convert
 

Field Detail

T_DOCUMENT

public static final int T_DOCUMENT
See Also:
Constant Field Values

T_FOLDER

public static final int T_FOLDER
See Also:
Constant Field Values

T_ORDERED

public static final int T_ORDERED
See Also:
Constant Field Values
Constructor Detail

DocumentTypeImpl

public DocumentTypeImpl(DocumentType superType,
                        java.lang.String name)

DocumentTypeImpl

public DocumentTypeImpl(DocumentType superType,
                        java.lang.String name,
                        java.lang.String[] declaredSchemas)

DocumentTypeImpl

public DocumentTypeImpl(DocumentType superType,
                        java.lang.String name,
                        java.lang.String[] declaredSchemas,
                        java.lang.String[] declaredFacets)

DocumentTypeImpl

public DocumentTypeImpl(TypeRef<DocumentType> superType,
                        java.lang.String name)

DocumentTypeImpl

public DocumentTypeImpl(TypeRef<DocumentType> superType,
                        java.lang.String name,
                        java.lang.String[] declaredSchemas)

DocumentTypeImpl

public DocumentTypeImpl(TypeRef<DocumentType> superType,
                        java.lang.String name,
                        java.lang.String[] declaredSchemas,
                        java.lang.String[] facets)

DocumentTypeImpl

public DocumentTypeImpl(TypeRef<DocumentType> superType,
                        java.lang.String name,
                        java.lang.String[] declaredSchemas,
                        java.lang.String[] facets,
                        int type)
Method Detail

setPrefetchInfo

public void setPrefetchInfo(PrefetchInfo prefetchInfo)
Description copied from interface: DocumentType
Sets the prefetch info.

The prefetch info describes which fields (or entire schemas) should be prefetched when instantiating a document.

This is primarily intended to optimize document initialization time.

The prefetch info is a string array of length multiple of 2 containing a sequence of pairs composed by the schema name and the field name. If the field name is null then the entire schema should be prefetched. Example: "common", null, "dublincore", "title"

Specified by:
setPrefetchInfo in interface DocumentType

getPrefetchInfo

public PrefetchInfo getPrefetchInfo()
Description copied from interface: DocumentType
Gets the prefetch info, or null if no prefetch is defined.

If the prefetch info is not null, the caller should use it when instantiating a document to preload the fields defined by the prefetch info.

If no prefetch is specified by the document type, the caller is free to use a default prefetch info or no prefetch at all.

Specified by:
getPrefetchInfo in interface DocumentType
Returns:
the prefetch info or null

isUnstructured

public boolean isUnstructured()
Description copied from interface: ComplexType
Tests whether this type is structured or not.

An unstructured complex type accepts any field name and type.

By default, complex types inherit their unstructured property. If a type has no super-type then it is considered unstructured if it is not specifying any field.

Specified by:
isUnstructured in interface ComplexType
Overrides:
isUnstructured in class ComplexTypeImpl
Returns:
true if unstructured, false otherwise

isFile

public boolean isFile()
Description copied from interface: DocumentType
Tests whether this type describes a document (not a folder!) or not.

Specified by:
isFile in interface DocumentType
Returns:
true if the type describes a document folder, otherwise returns false

isFolder

public boolean isFolder()
Description copied from interface: DocumentType
Tests whether this type describes a folder or not.

Specified by:
isFolder in interface DocumentType
Returns:
true if the type describes a folder, otherwise returns false

isOrdered

public boolean isOrdered()
Description copied from interface: DocumentType
Tests whether this type describe an ordered folder or not.

Specified by:
isOrdered in interface DocumentType
Returns:
true if the type describes an ordered folder, otherwise returns false

getFacets

public java.util.Set<java.lang.String> getFacets()
Description copied from interface: DocumentType
Gets all the facets of this document type.

Facets inherited from parents are taken into account.

Specified by:
getFacets in interface DocumentType
Returns:
the facets

addSchemas

public void addSchemas(java.lang.String[] schemas)
Description copied from interface: DocumentType
Adds specified schemas to the document type.

Specified by:
addSchemas in interface DocumentType

setDeclaredFacets

public void setDeclaredFacets(java.lang.String[] facets)
Specified by:
setDeclaredFacets in interface DocumentType

getRef

public TypeRef<DocumentType> getRef()
Description copied from interface: Type
Gets a proxy (or reference to this type).

Specified by:
getRef in interface DocumentType
Specified by:
getRef in interface ComplexType
Specified by:
getRef in interface CompositeType
Specified by:
getRef in interface Type
Overrides:
getRef in class CompositeTypeImpl
Returns:
a reference to the type

getChildrenTypes

public java.lang.String[] getChildrenTypes()
Description copied from interface: DocumentType
Gets the type names that can be used for children docs.

Returned types may include special group of types like '*'.

Specified by:
getChildrenTypes in interface DocumentType
Returns:

setChildrenTypes

public void setChildrenTypes(java.lang.String[] subTypes)
Description copied from interface: DocumentType
Sets the names of the allowed children doc types.

Children types are document types allowed for the children of a document of the current type.

Type names may include '*' for all types.

Specified by:
setChildrenTypes in interface DocumentType
Parameters:
subTypes - null if no children types have been defined (i.e. this type cannot have children), else an array with children types

getResolvedChildrenTypes

public DocumentType[] getResolvedChildrenTypes()
Description copied from interface: DocumentType
Gets the resolved children doc types.

Special group of types like '*' and exclusion filters if any are applied and the set of actual children types is computed and resolved into real doc types.

Specified by:
getResolvedChildrenTypes in interface DocumentType
Returns:
null if no children types was defined (i.e. this type cannot have children) or an array with children types

isChildTypeAllowed

public boolean isChildTypeAllowed(java.lang.String name)
Specified by:
isChildTypeAllowed in interface DocumentType

Nuxeo Enterprise Platform 5.4

Copyright © 2010 Nuxeo SAS. All Rights Reserved.