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.impl.models;
007
008import org.fcrepo.kernel.api.Transaction;
009import org.fcrepo.kernel.api.cache.UserTypesCache;
010import org.fcrepo.kernel.api.exception.PathNotFoundException;
011import org.fcrepo.kernel.api.exception.PathNotFoundRuntimeException;
012import org.fcrepo.kernel.api.identifiers.FedoraId;
013import org.fcrepo.kernel.api.models.FedoraResource;
014import org.fcrepo.kernel.api.models.ResourceFactory;
015import org.fcrepo.kernel.api.models.WebacAcl;
016import org.fcrepo.persistence.api.PersistentStorageSessionManager;
017
018/**
019 * Webac Acl class
020 *
021 * @author whikloj
022 */
023public class WebacAclImpl extends ContainerImpl implements WebacAcl {
024
025    /**
026     * Constructor
027     * @param fedoraID the internal identifier
028     * @param transaction the current transactionId
029     * @param pSessionManager a session manager
030     * @param resourceFactory a resource factory instance.
031     * @param userTypesCache the user types cache
032     */
033    public WebacAclImpl(final FedoraId fedoraID,
034                        final Transaction transaction,
035                        final PersistentStorageSessionManager pSessionManager,
036                        final ResourceFactory resourceFactory,
037                        final UserTypesCache userTypesCache) {
038        super(fedoraID, transaction, pSessionManager, resourceFactory, userTypesCache);
039    }
040
041    @Override
042    public FedoraResource getContainer() {
043        final var originalId = FedoraId.create(getFedoraId().getBaseId());
044        try {
045
046            return resourceFactory.getResource(transaction, originalId);
047        } catch (final PathNotFoundException exc) {
048            throw new PathNotFoundRuntimeException(exc.getMessage(), exc);
049        }
050    }
051
052    @Override
053    public boolean isOriginalResource() {
054        return false;
055    }
056
057    @Override
058    public boolean isAcl() {
059        return true;
060    }
061}