001/*
002 * The contents of this file are subject to the license and copyright
003 * detailed in the LICENSE and NOTICE files at the root of the source
004 * tree.
005 */
006package org.fcrepo.kernel.api.models;
007
008import org.fcrepo.kernel.api.Transaction;
009import org.fcrepo.kernel.api.identifiers.FedoraId;
010
011/**
012 * Utility class interface for helper methods.
013 * @author whikloj
014 * @since 6.0.0
015 */
016public interface ResourceHelper {
017
018    /**
019     * Check if a resource exists.
020     * @param transaction The current transaction
021     * @param fedoraId The internal identifier
022     * @param includeDeleted Whether to check for deleted resources too.
023     * @return True if the identifier resolves to a resource.
024     */
025    public boolean doesResourceExist(final Transaction transaction, final FedoraId fedoraId,
026                                     final boolean includeDeleted);
027
028    /**
029     * Is the resource a "ghost node". Ghost nodes are defined as a resource that does not exist, but whose URI is part
030     * of the URI of another resource? For example:
031     *
032     * http://localhost/rest/a/b - does exist
033     * http://localhost/rest/a - does not exist and is therefore a ghost node.
034     *
035     * @param transaction The transaction
036     * @param resourceId Identifier of the resource
037     * @return Whether the resource does not exist, but has
038     */
039    public boolean isGhostNode(final Transaction transaction, final FedoraId resourceId);
040}