Skip to content

Commit

Permalink
checkstyle, dead code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
acoburn committed Sep 3, 2015
1 parent 3069cb9 commit cc91941
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
Expand Up @@ -16,7 +16,6 @@
package org.fcrepo.auth.webac;

import static org.fcrepo.auth.webac.URIConstants.FOAF_AGENT_VALUE;
import static org.fcrepo.auth.webac.URIConstants.WEBAC_ACCESS_CONTROL;
import static org.fcrepo.auth.webac.URIConstants.WEBAC_MODE_APPEND;
import static org.fcrepo.auth.webac.URIConstants.WEBAC_MODE_READ;
import static org.fcrepo.auth.webac.URIConstants.WEBAC_MODE_WRITE;
Expand Down Expand Up @@ -52,8 +51,6 @@
*/
public class WebACAuthorizationDelegate extends AbstractRolesAuthorizationDelegate {

public static final String EVERYONE_NAME = "EVERYONE";

/**
* Class-level logger.
*/
Expand Down
Expand Up @@ -28,7 +28,6 @@

import java.net.URI;
import java.util.AbstractMap;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
Expand All @@ -46,7 +45,6 @@
import javax.jcr.RepositoryException;
import javax.jcr.Session;

import com.hp.hpl.jena.graph.Triple;
import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.Property;
import com.hp.hpl.jena.rdf.model.Resource;
Expand All @@ -60,6 +58,10 @@
import org.fcrepo.kernel.modeshape.rdf.impl.PropertiesRdfContext;
import org.modeshape.jcr.value.Path;

/**
* @author acoburn
* @since 9/3/15
*/
class WebACAccessRolesProvider implements AccessRolesProvider {

@Override
Expand Down Expand Up @@ -139,7 +141,7 @@ public Map<String, List<String>> findRolesForPath(final Path absPath, final Sess

final Predicate<Property> isAclPredicate =
p -> !p.isAnon() && p.getNameSpace().startsWith(WEBAC_NAMESPACE_VALUE);

private List<WebACAuthorization> getAuthorizations(final Node node, final String location) {
final List<WebACAuthorization> authorizations = new ArrayList<>();
final Model model = createDefaultModel();
Expand All @@ -150,7 +152,7 @@ private List<WebACAuthorization> getAuthorizations(final Node node, final String
new DefaultIdentifierTranslator(node.getSession());

final List<String> EMPTY = Collections.unmodifiableList(new ArrayList<>());

resource.getChildren().forEachRemaining(child -> {
if (child.getTypes().contains(WEBAC_AUTHORIZATION)) {
final Map<String, List<String>> tripleMap = new HashMap<>();
Expand All @@ -161,13 +163,15 @@ private List<WebACAuthorization> getAuthorizations(final Node node, final String
if (t.getObject().isURI()) {
tripleMap.get(t.getPredicate().getURI()).add(t.getObject().getURI());
} else if (t.getObject().isLiteral()) {
tripleMap.get(t.getPredicate().getURI()).add(t.getObject().getLiteralValue().toString());
tripleMap.get(t.getPredicate().getURI()).add(
t.getObject().getLiteralValue().toString());
}
});
authorizations.add(new WebACAuthorizationImpl(
tripleMap.getOrDefault(WEBAC_AGENT_VALUE, EMPTY),
tripleMap.getOrDefault(WEBAC_AGENT_CLASS_VALUE, EMPTY),
tripleMap.getOrDefault(WEBAC_MODE_VALUE, EMPTY).stream().map(URI::create).collect(Collectors.toList()),
tripleMap.getOrDefault(WEBAC_MODE_VALUE, EMPTY).stream()
.map(URI::create).collect(Collectors.toList()),
tripleMap.getOrDefault(WEBAC_ACCESSTO_VALUE, EMPTY),
tripleMap.getOrDefault(WEBAC_ACCESSTO_CLASS_VALUE, EMPTY)));
}
Expand Down
Expand Up @@ -22,6 +22,10 @@
import org.junit.runner.RunWith;
import org.mockito.runners.MockitoJUnitRunner;

/**
* @author acoburn
* @since 9/3/15
*/
@RunWith(MockitoJUnitRunner.class)
public class WebACAccessRolesProviderTest {

Expand Down

0 comments on commit cc91941

Please sign in to comment.