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 org.nuxeo.ecm.core.schema.types.CompositeType;
016
017import java.util.Set;
018
019/**
020 * Document types are composite types made of several schemas.
021 * <p>
022 * Sample document types are Workspace, Section, Domain,... The list of builtin document type is visible at
023 * NXCore/OSGI-INF/CoreExtensions.xml.
024 */
025public interface DocumentType extends CompositeType {
026
027    /**
028     * Gets the prefetch info, or null if no prefetch is defined.
029     * <p>
030     * If the prefetch info is not null, the caller should use it when instantiating a document to preload the fields
031     * defined by the prefetch info.
032     * <p>
033     * If no prefetch is specified by the document type, the caller is free to use a default prefetch info or no
034     * prefetch at all.
035     *
036     * @return the prefetch info or null
037     */
038    PrefetchInfo getPrefetchInfo();
039
040    /**
041     * Tests whether this type describes a document (not a folder!) or not.
042     *
043     * @return true if the type describes a document folder, otherwise returns false
044     */
045    boolean isFile();
046
047    /**
048     * Tests whether this type describes a folder or not.
049     *
050     * @return true if the type describes a folder, otherwise returns false
051     */
052    boolean isFolder();
053
054    /**
055     * Tests whether this type describe an ordered folder or not.
056     *
057     * @return true if the type describes an ordered folder, otherwise returns false
058     */
059    boolean isOrdered();
060
061    /**
062     * Gets all the facets of this document type.
063     * <p>
064     * Facets inherited from parents are taken into account.
065     *
066     * @return the facets
067     */
068    Set<String> getFacets();
069
070    /**
071     * Returns {@code true} if this document type has the given {@code facetName} facet, {@code false otherwise}.
072     *
073     * @since 5.7
074     */
075    boolean hasFacet(String facetName);
076
077}