Skip to content
Permalink
Browse files

Redoing acoburns changes to predicates

  • Loading branch information...
ajs6f committed Jul 14, 2015
1 parent dd84a23 commit df73eccc802a08b184a1183523e821db9aea9676
Showing with 6 additions and 9 deletions.
  1. +6 −9 fcrepo-http-api/src/main/java/org/fcrepo/http/api/ContentExposingResource.java
@@ -16,11 +16,11 @@
package org.fcrepo.http.api;


import static com.google.common.base.Predicates.not;
import static com.google.common.collect.Iterators.concat;
import static com.google.common.collect.Iterators.filter;
import static com.google.common.collect.Iterators.transform;
import static com.hp.hpl.jena.rdf.model.ModelFactory.createDefaultModel;
import static com.hp.hpl.jena.vocabulary.RDF.type;
import static javax.ws.rs.core.HttpHeaders.CACHE_CONTROL;
import static javax.ws.rs.core.MediaType.APPLICATION_OCTET_STREAM_TYPE;
import static javax.ws.rs.core.Response.ok;
@@ -105,14 +105,14 @@
import com.hp.hpl.jena.graph.Triple;
import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.Statement;
import com.hp.hpl.jena.vocabulary.RDF;

/**
* An abstract class that sits between AbstractResource and any resource that
* wishes to share the routines for building responses containing binary
* content.
*
* @author Mike Durbin
* @author ajs6f
*/
public abstract class ContentExposingResource extends FedoraBaseResource {

@@ -136,6 +136,9 @@

private static final long MAX_BUFFER_SIZE = 10240000;

private static final Predicate<Triple> IS_MANAGED_TYPE = t -> t.getPredicate().equals(type.asNode()) &&
isManagedNamespace.apply(t.getObject().getNameSpace());

protected abstract String externalPath();

protected Response getContent(final String rangeValue,
@@ -205,13 +208,7 @@ protected RdfStream getResourceTriples() {
if (ldpPreferences.prefersServerManaged()) {
tripleFilter = x -> true;
} else {
tripleFilter = new Predicate<Triple>() {
@Override
public boolean test(final Triple input) {
return input.getPredicate().equals(RDF.type.asNode())
&& isManagedNamespace.apply(input.getObject().getNameSpace());
}
}.negate().and(not(isManagedTriple)::apply);
tripleFilter = IS_MANAGED_TYPE.or(isManagedTriple::apply).negate();
}

if (ldpPreferences.prefersServerManaged()) {

0 comments on commit df73ecc

Please sign in to comment.
You can’t perform that action at this time.