Package org.nuxeo.ecm.core.schema
Class DocumentTypeImpl
- java.lang.Object
-
- org.nuxeo.ecm.core.schema.types.AbstractType
-
- org.nuxeo.ecm.core.schema.types.ComplexTypeImpl
-
- org.nuxeo.ecm.core.schema.types.CompositeTypeImpl
-
- org.nuxeo.ecm.core.schema.DocumentTypeImpl
-
- All Implemented Interfaces:
Serializable
,DocumentType
,ComplexType
,CompositeType
,Type
public class DocumentTypeImpl extends CompositeTypeImpl implements DocumentType
Implementation of a document type.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected Set<String>
allowedSubtypes
protected Set<String>
facets
protected Set<String>
forbiddenSubtypes
protected PrefetchInfo
prefetchInfo
protected Set<String>
subtypes
-
Fields inherited from class org.nuxeo.ecm.core.schema.types.CompositeTypeImpl
schemas
-
Fields inherited from class org.nuxeo.ecm.core.schema.types.ComplexTypeImpl
fields, fieldsByName, ns
-
Fields inherited from class org.nuxeo.ecm.core.schema.types.AbstractType
constraints, EMPTY_SUPERTYPES, name, schema, superType
-
-
Constructor Summary
Constructors Constructor Description DocumentTypeImpl(String name)
DocumentTypeImpl(String name, DocumentType superType, List<Schema> schemas, Collection<String> facets, PrefetchInfo prefetchInfo)
Constructs a document type.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Set<String>
getAllowedSubtypes()
Returns the list of types that can effectively be created inside this type.Set<String>
getFacets()
Gets all the facets of this document type.Set<String>
getForbiddenSubtypes()
Returns the types of the children that cannot be created inside this type.PrefetchInfo
getPrefetchInfo()
Gets the prefetch info, or null if no prefetch is defined.Set<String>
getSubtypes()
Returns the types of the children that can be created inside this type.boolean
hasAllowedSubtype(String subtype)
Returnstrue
if the givensubtype
type can effectively be created inside this type.boolean
hasFacet(String facetName)
Returnstrue
if this document type has the givenfacetName
facet,false otherwise
.boolean
hasForbiddenSubtype(String subtype)
Returnstrue
if the givensubtype
type was forbidden from being created inside this type.boolean
hasSubtype(String subtype)
Returnstrue
if the givensubtype
type was explicitly allowed to be created inside this type.boolean
isFile()
Tests whether this type describes a document (not a folder!) or not.boolean
isFolder()
Tests whether this type describes a folder or not.boolean
isOrdered()
Tests whether this type describe an ordered folder or not.void
setForbiddenSubtypes(Collection<String> forbiddenSubtypes)
Sets the types of the children that cannot be created inside the this type.void
setPrefetchInfo(PrefetchInfo prefetchInfo)
void
setSubtypes(Collection<String> subtypes)
Sets the types of the children that can be created inside the this type.-
Methods inherited from class org.nuxeo.ecm.core.schema.types.CompositeTypeImpl
getField, getSchema, getSchemaNames, getSchemas, hasSchema, hasSchemas, isComplexType, isCompositeType
-
Methods inherited from class org.nuxeo.ecm.core.schema.types.ComplexTypeImpl
addField, addField, canonicalXPath, convert, getField, getFields, getFieldsCount, getNamespace, hasField, hasFields, newInstance, toString, validate
-
Methods inherited from class org.nuxeo.ecm.core.schema.types.AbstractType
addConstraints, decode, encode, getConstraints, getName, getObjectResolver, getSchema, getSchemaName, getSuperType, getTypeHierarchy, isAny, isAnyType, isListType, isSimpleType, isSuperTypeOf, validateConstraints
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.nuxeo.ecm.core.schema.types.ComplexType
addField, getField, getField, getFields, getFieldsCount, getNamespace, hasField, hasFields
-
Methods inherited from interface org.nuxeo.ecm.core.schema.types.CompositeType
getSchema, getSchemaNames, getSchemas, hasSchema, hasSchemas
-
Methods inherited from interface org.nuxeo.ecm.core.schema.types.Type
convert, decode, encode, getConstraints, getName, getObjectResolver, getSchema, getSchemaName, getSuperType, getTypeHierarchy, isAnyType, isComplexType, isCompositeType, isListType, isSimpleType, isSuperTypeOf, newInstance, validate
-
-
-
-
Constructor Detail
-
DocumentTypeImpl
public DocumentTypeImpl(String name, DocumentType superType, List<Schema> schemas, Collection<String> facets, PrefetchInfo prefetchInfo)
Constructs a document type. Schemas and facets must include those from the super type.
-
DocumentTypeImpl
public DocumentTypeImpl(String name)
-
-
Method Detail
-
setPrefetchInfo
public void setPrefetchInfo(PrefetchInfo prefetchInfo)
-
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 interfaceDocumentType
- Returns:
- the prefetch info or null
-
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 interfaceDocumentType
- 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 interfaceDocumentType
- 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 interfaceDocumentType
- Returns:
- true if the type describes an ordered folder, otherwise returns false
-
getFacets
public Set<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 interfaceDocumentType
- Returns:
- the facets
-
hasFacet
public boolean hasFacet(String facetName)
Description copied from interface:DocumentType
Returnstrue
if this document type has the givenfacetName
facet,false otherwise
.- Specified by:
hasFacet
in interfaceDocumentType
-
getSubtypes
public Set<String> getSubtypes()
Description copied from interface:DocumentType
Returns the types of the children that can be created inside this type.- Specified by:
getSubtypes
in interfaceDocumentType
-
setSubtypes
public void setSubtypes(Collection<String> subtypes)
Description copied from interface:DocumentType
Sets the types of the children that can be created inside the this type.- Specified by:
setSubtypes
in interfaceDocumentType
-
hasSubtype
public boolean hasSubtype(String subtype)
Description copied from interface:DocumentType
Returnstrue
if the givensubtype
type was explicitly allowed to be created inside this type.- Specified by:
hasSubtype
in interfaceDocumentType
-
getForbiddenSubtypes
public Set<String> getForbiddenSubtypes()
Description copied from interface:DocumentType
Returns the types of the children that cannot be created inside this type.- Specified by:
getForbiddenSubtypes
in interfaceDocumentType
-
setForbiddenSubtypes
public void setForbiddenSubtypes(Collection<String> forbiddenSubtypes)
Description copied from interface:DocumentType
Sets the types of the children that cannot be created inside the this type.- Specified by:
setForbiddenSubtypes
in interfaceDocumentType
-
hasForbiddenSubtype
public boolean hasForbiddenSubtype(String subtype)
Description copied from interface:DocumentType
Returnstrue
if the givensubtype
type was forbidden from being created inside this type.- Specified by:
hasForbiddenSubtype
in interfaceDocumentType
-
getAllowedSubtypes
public Set<String> getAllowedSubtypes()
Description copied from interface:DocumentType
Returns the list of types that can effectively be created inside this type. Allowed types results from the exclusion of the forbidden subtypes from the subtypes.- Specified by:
getAllowedSubtypes
in interfaceDocumentType
-
hasAllowedSubtype
public boolean hasAllowedSubtype(String subtype)
Description copied from interface:DocumentType
Returnstrue
if the givensubtype
type can effectively be created inside this type.- Specified by:
hasAllowedSubtype
in interfaceDocumentType
-
-