001/*
002 * (C) Copyright 2006-2012 Nuxeo SA (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 {
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    Schema getSchemaFromURI(String schemaURI);
047
048    /**
049     * Returns the names of all document types that have given facet.
050     *
051     * @param facet
052     * @return null or the names as a guaranteed non-empty set.
053     */
054    Set<String> getDocumentTypeNamesForFacet(String facet);
055
056    /**
057     * Return the names of all document types extending the given one, which is included.
058     *
059     * @param docType
060     * @return null or the set of names.
061     */
062    Set<String> getDocumentTypeNamesExtending(String docType);
063
064    int getDocumentTypesCount();
065
066    /**
067     * Returns true if {@code docType} is or extends {@code superType}, false otherwise.
068     *
069     * @since 5.9.4
070     */
071    boolean hasSuperType(String docType, String superType);
072
073    /**
074     * Returns the types of the children that can be created inside a given {@code type} type.
075     *
076     * @since 8.4
077     */
078    Set<String> getAllowedSubTypes(String type);
079
080    /**
081     * @return the deprecated properties handler
082     * @since 9.2
083     */
084    PropertyDeprecationHandler getDeprecatedProperties();
085
086    /**
087     * @return the removed properties handler
088     * @since 9.2
089     */
090    PropertyDeprecationHandler getRemovedProperties();
091
092    /**
093     * Whether or not to ignore any previous values when setting complex properties.
094     *
095     * @return {@code true} if setting a complex property ignores any previous values
096     * @since 9.3
097     */
098    boolean getClearComplexPropertyBeforeSet();
099
100}