001/* 002 * Licensed to DuraSpace under one or more contributor license agreements. 003 * See the NOTICE file distributed with this work for additional information 004 * regarding copyright ownership. 005 * 006 * DuraSpace licenses this file to you under the Apache License, 007 * Version 2.0 (the "License"); you may not use this file except in 008 * compliance with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, software 013 * distributed under the License is distributed on an "AS IS" BASIS, 014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 015 * See the License for the specific language governing permissions and 016 * limitations under the License. 017 */ 018package org.fcrepo.kernel.impl.models; 019 020import org.fcrepo.kernel.api.Transaction; 021import org.fcrepo.kernel.api.exception.PathNotFoundException; 022import org.fcrepo.kernel.api.exception.PathNotFoundRuntimeException; 023import org.fcrepo.kernel.api.identifiers.FedoraId; 024import org.fcrepo.kernel.api.models.FedoraResource; 025import org.fcrepo.kernel.api.models.ResourceFactory; 026import org.fcrepo.kernel.api.models.WebacAcl; 027import org.fcrepo.persistence.api.PersistentStorageSessionManager; 028 029/** 030 * Webac Acl class 031 * 032 * @author whikloj 033 */ 034public class WebacAclImpl extends ContainerImpl implements WebacAcl { 035 036 /** 037 * Constructor 038 * @param fedoraID the internal identifier 039 * @param transaction the current transactionId 040 * @param pSessionManager a session manager 041 * @param resourceFactory a resource factory instance. 042 */ 043 public WebacAclImpl(final FedoraId fedoraID, final Transaction transaction, 044 final PersistentStorageSessionManager pSessionManager, final ResourceFactory resourceFactory) { 045 super(fedoraID, transaction, pSessionManager, resourceFactory); 046 } 047 048 @Override 049 public FedoraResource getContainer() { 050 final var originalId = FedoraId.create(getFedoraId().getBaseId()); 051 try { 052 053 return resourceFactory.getResource(transaction, originalId); 054 } catch (final PathNotFoundException exc) { 055 throw new PathNotFoundRuntimeException(exc.getMessage(), exc); 056 } 057 } 058 059 @Override 060 public boolean isOriginalResource() { 061 return false; 062 } 063 064 @Override 065 public boolean isAcl() { 066 return true; 067 } 068}