001/*
002 * (C) Copyright 2006-2019 Nuxeo (http://nuxeo.com/) and others.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 *
016 * Contributors:
017 *     Bogdan Stefanescu
018 *     Florent Guillaume
019 */
020package org.nuxeo.ecm.core.schema;
021
022import java.util.Set;
023
024import org.nuxeo.ecm.core.schema.types.Field;
025import org.nuxeo.ecm.core.schema.types.Schema;
026
027/**
028 * The Schema Manager manages core document types, schemas, facets and field types.
029 */
030public interface SchemaManager extends TypeProvider, PropertyCharacteristicHandler {
031
032    /**
033     * Returns the field with given xpath, or null if not found.
034     */
035    Field getField(String xpath);
036
037    /**
038     * Returns the field with given parent field and sub name, or null if not found.
039     *
040     * @since 7.2
041     */
042    Field getField(Field field, String subFieldName);
043
044    Schema getSchemaFromPrefix(String schemaPrefix);
045
046    /**
047     * @deprecated since 11.1, seems unused
048     */
049    @Deprecated(since = "11.1")
050    Schema getSchemaFromURI(String schemaURI);
051
052    /**
053     * Returns the names of all document types that have given facet.
054     *
055     * @return null or the names as a guaranteed non-empty set.
056     */
057    Set<String> getDocumentTypeNamesForFacet(String facet);
058
059    /**
060     * Return the names of all document types extending the given one, which is included.
061     *
062     * @return null or the set of names.
063     */
064    Set<String> getDocumentTypeNamesExtending(String docType);
065
066    int getDocumentTypesCount();
067
068    /**
069     * Returns true if {@code docType} is or extends {@code superType}, false otherwise.
070     *
071     * @since 5.9.4
072     */
073    boolean hasSuperType(String docType, String superType);
074
075    /**
076     * Returns the types of the children that can be created inside a given {@code type} type.
077     *
078     * @since 8.4
079     */
080    Set<String> getAllowedSubTypes(String type);
081
082    /**
083     * @return the deprecated properties handler
084     * @since 9.2
085     * @deprecated since 11.1, use {@link PropertyCharacteristicHandler} methods instead
086     */
087    @Deprecated(since = "11.1")
088    PropertyDeprecationHandler getDeprecatedProperties();
089
090    /**
091     * @return the removed properties handler
092     * @since 9.2
093     * @deprecated since 11.1, use {@link PropertyCharacteristicHandler} methods instead
094     */
095    @Deprecated(since = "11.1")
096    PropertyDeprecationHandler getRemovedProperties();
097
098    /**
099     * Whether or not to ignore any previous values when setting complex properties.
100     *
101     * @return {@code true} if setting a complex property ignores any previous values
102     * @since 9.3
103     */
104    boolean getClearComplexPropertyBeforeSet();
105
106    /**
107     * Whether we allow to write the dublincore schema on a version.
108     *
109     * @return {@code true} if write to the dublincore schema of a version is allowed
110     * @since 10.3
111     */
112    boolean getAllowVersionWriteForDublinCore();
113
114}