Platform Explorer / Nuxeo Platform LTS 2019 10.10

Component org.nuxeo.ecm.core.schema.TypeService

Implementation

Javadoc: org.nuxeo.ecm.core.schema.TypeService

Services

Extension points

Contributions

XML source

<?xml version="1.0"?>

<component name="org.nuxeo.ecm.core.schema.TypeService"
  version="1.0.0">
  <documentation>
    Manage document types and schemas.
    Allows registrering new types defined using XSD schemas
    @author Bogdan Stefanescu (bs@nuxeo.com)
  </documentation>

  <require>org.nuxeo.ecm.core.schema.ObjectResolverService</require>

  <service>
    <provide
      interface="org.nuxeo.ecm.core.schema.SchemaManager"/>
  </service>

  <implementation class="org.nuxeo.ecm.core.schema.TypeService" />

  <extension-point name="configuration">

    <documentation>
      Type manager configuration.
      <p/>
      This contains default prefetch options and clearComplexPropertyBeforeSet options. For example:
      <code>
        <configuration>
          <prefetch>common.icon, dc:title, dc:modified, dc:contributors, dc:creator</prefetch>
          <clearComplexPropertyBeforeSet>true</clearComplexPropertyBeforeSet>
          <allowVersionWriteForDublinCore>false</allowVersionWriteForDublinCore>
        </configuration>
      </code>
      Note that setting clearComplexPropertyBeforeSet to false is DEPRECATED since 9.3.
      Note that setting allowVersionWriteForDublinCore to true is DEPRECATED since 10.3.
    </documentation>

    <object
      class="org.nuxeo.ecm.core.schema.TypeConfiguration" />
  </extension-point>

  <extension-point name="doctype">

    <documentation>
      Extension Point to register new document types and facets.
      <p/>
      Document types may implement several schemas and extends other
      document types. You can compare document types with java
      classes and schemas with java interfaces. Document types may
      also contains several facets that define a behavior.
      <p/>
      The prefetch element defines what fields are synchronously
      indexed, and are made available in search results listings.
      <p/>
      A doctype XML extension may contain several 'doctype' elements.
      A doctype element may look like this:

      <code>
        <doctype name="File" extends="Document">
          <schema name="common" />
          <schema name="file" />
          <schema name="dublincore" />
          <schema name="uid" />
          <facet name="Downloadable" />
          <facet name="Versionable" />
          <prefetch>dc:title, dc:modified, uid.uid</prefetch>
        </doctype>
      </code>

      Document types may also specify subtypes, which are sets of other
      document types that can be created inside the this document type
      being defined.
      <p/>
      This configuration only applies in the UI and will not affect
      documents created through APIs (e.g. REST, Java)
      This can be achieved as follows:

      <code>
        <doctype name="SomeFolder" extends="Document">
          <subtypes>
            <type>File</type>
          </subtypes>
        </doctype>
      </code>

      When extending a doctype, forbidden subtypes can also be specified
      to prevent a specific type from being created.
      <p/>
      This configuration only applies in the UI and will not affect
      documents created through APIs (e.g. REST, Java)

      <code>
        <doctype name="SomeFolder" append="true">
          <subtypes>
            <type>SomeOtherFile</type>
          </subtypes>
          <subtypes-forbidden>
            <type>File</type>
          </subtypes-forbidden>
        </doctype>
      </code>

      Facets are also defined by this extension point.
      They can have zero or more schemas:

      <code>
        <facet name="MyFacet" perDocumentQuery="false"/>
        <facet name="MyFacetWithData">
          <schema name="myschema" />
          <schema name="otherschema" />
        </facet>
      </code>

      Queries using ecm:mixinType on facets marked with
      perDocumentQuery="false" will not match any document where
      this facet has been added using DocumentModel.addFacet() and does
      not belong to the document type (this is done for performance reasons).

      It's also possible to associate one or more schemas to all proxies:
      <code>
        <proxies>
          <schema name="myschema" />
        </proxies>
      </code>
    </documentation>

    <object
      class="org.nuxeo.ecm.core.schema.DocumentTypeDescriptor" />
    <object
      class="org.nuxeo.ecm.core.schema.FacetDescriptor" />
    <object
      class="org.nuxeo.ecm.core.schema.ProxiesDescriptor" />
  </extension-point>

  <extension-point name="schema">

    <documentation>
      Extension Point to register new schemas.
      <p/>
      Schemas are defined using XSD files.
      The schema extension XML may containg  several 'schema' objects as
      the following ones:
      <code>
        <schema name="common" src="schema/common.xsd" />
        <schema name="dublincore" prefix="dc" src="schema/dublincore.xsd" />
      </code>
      The <i>name</i> attribute uniquely identify the schema, the <i>src</i> attribute specify
      the path to that schema (relative to the bundle root) and the <i>prefix</i> is used as
      a prefix (short name) of the schema namespace.
      The schema namespace is the targetNamespace defined inside the XSD file
      <p/>
      Note that multiple schemas can share the same target namespace and prefix
      <p/>
      You can also create a Nuxeo Schema from a sub part of the XSD schema.
      For that you can use the xsdRootElement attribute to indicate the complex type to use.
      <code>
        <schema name="employeeSchema" src="schema/testExtension.xsd" xsdRootElement="employee"/>
      </code>
    </documentation>

    <object
      class="org.nuxeo.ecm.core.schema.SchemaBindingDescriptor" />
  </extension-point>

  <extension-point name="deprecation">

    <documentation>
      Extension Point to register deprecated/removed properties.
      XML extensions may contain any number of 'property' elements of the form:
      <code>
        <property schema="common" name="size" deprecated="true" />
        <property schema="file" name="filename" fallback="content/name" />
      </code>
      A property contributed to this extension point enables deprecation mechanisms inside Nuxeo Platform.
      This generates WARN message of usage to help to remove deprecated usage.
      <p />
      A contribution is one of these types:
      <ul>
        <li>deprecated: property still exists in schema definition, but it'll be removed in next version</li>
        <li>removed: property has been removed from schema definition, relax platform behavior. This will avoid Nuxeo
          property not found exceptions for remaining use of the property</li>
      </ul>
      The fallback attribute is optional, its value has to be a xpath referencing an existing property in the same
      schema than removed/deprecated property.
      When presents, it is used:
      <ul>
        <li>to set the value to the fallback property</li>
        <li>to get the value from the fallback property if it exists</li>
      </ul>
      Note: for a deprecated property, setValue also set value to property and getValue get value from property if
      fallback value is null.
      <p />
      For example, the contribution below enables WARN message of usage of property <i>file:filename</i>. This will also
      get/set the value from/to <i>file:content/name</i> for deprecated usage of <i>file:filename</i> property.
      <code>
        <property schema="file" name="filename" fallback="content/name" />
      </code>
      As it, each usage of this property will automatically fallback on the fallback and avoid exception from platform.
      This will also allows to import document declaring the removed property.
    </documentation>

    <object class="org.nuxeo.ecm.core.schema.PropertyDeprecationDescriptor" />

  </extension-point>

</component>

Documentation

Manage document types and schemas. Allows registrering new types defined using XSD schemas