001/*
002 * (C) Copyright 2006-2011 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 */
020
021package org.nuxeo.ecm.core.schema;
022
023import java.util.Collections;
024import java.util.List;
025import java.util.Set;
026
027import org.nuxeo.ecm.core.schema.types.CompositeType;
028import org.nuxeo.ecm.core.schema.types.Schema;
029
030/**
031 * A provider of types (schemas, document types, facets).
032 */
033public interface TypeProvider {
034
035    /** Gets a schema. */
036    Schema getSchema(String schema);
037
038    /** Gets the list of schemas. */
039    Schema[] getSchemas();
040
041    /** Gets a document type. */
042    DocumentType getDocumentType(String docType);
043
044    /** Gets the list of document types. */
045    DocumentType[] getDocumentTypes();
046
047    /**
048     * Gets the list of document types excluded from copy.
049     * @since 11.1
050     */
051    default Set<String> getSpecialDocumentTypes() {
052        return Collections.emptySet();
053    }
054
055    /** Gets a facet. */
056    CompositeType getFacet(String name);
057
058    /** Gets the list of facets. */
059    CompositeType[] getFacets();
060
061    /** Finds which facets are configured as no-per-instance-query. */
062    Set<String> getNoPerDocumentQueryFacets();
063
064    /** Gets the schemas on a proxy for a document of the given type. */
065    List<Schema> getProxySchemas(String docType);
066
067    /** Checks if a schema is on a proxy for a document of the given type. */
068    boolean isProxySchema(String schema, String docType);
069
070}