001/*
002 * Copyright (c) 2006-2012 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the Eclipse Public License v1.0
006 * which accompanies this distribution, and is available at
007 * http://www.eclipse.org/legal/epl-v10.html
008 *
009 * Contributors:
010 *     Bogdan Stefanescu
011 *     Florent Guillaume
012 */
013package org.nuxeo.ecm.core.schema;
014
015import java.util.Set;
016
017import org.nuxeo.ecm.core.schema.types.Field;
018import org.nuxeo.ecm.core.schema.types.Schema;
019
020/**
021 * The Schema Manager manages core document types, schemas, facets and field types.
022 */
023public interface SchemaManager extends TypeProvider {
024
025    /**
026     * Returns the field with given xpath, or null if not found.
027     */
028    Field getField(String xpath);
029
030    /**
031     * Returns the field with given parent field and sub name, or null if not found.
032     *
033     * @since 7.2
034     */
035    Field getField(Field field, String subFieldName);
036
037    Schema getSchemaFromPrefix(String schemaPrefix);
038
039    Schema getSchemaFromURI(String schemaURI);
040
041    /**
042     * Returns the names of all document types that have given facet.
043     *
044     * @param facet
045     * @return null or the names as a guaranteed non-empty set.
046     */
047    Set<String> getDocumentTypeNamesForFacet(String facet);
048
049    /**
050     * Return the names of all document types extending the given one, which is included.
051     *
052     * @param docType
053     * @return null or the set of names.
054     */
055    Set<String> getDocumentTypeNamesExtending(String docType);
056
057    int getDocumentTypesCount();
058
059    /**
060     * Returns true if {@code docType} is or extends {@code superType}, false otherwise.
061     *
062     * @since 5.9.4
063     */
064    boolean hasSuperType(String docType, String superType);
065
066}