Skip to content

Commit

Permalink
FedoraEvent now always returns the node path for getPath(), not somet…
Browse files Browse the repository at this point in the history
…imes a property's path
  • Loading branch information
escowles committed May 30, 2014
1 parent 5a4248c commit b26aa74
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Expand Up @@ -20,6 +20,7 @@
import static org.slf4j.LoggerFactory.getLogger;
import static javax.jcr.observation.Event.PROPERTY_ADDED;
import static javax.jcr.observation.Event.PROPERTY_CHANGED;
import static javax.jcr.observation.Event.PROPERTY_REMOVED;

import java.util.Iterator;

Expand Down Expand Up @@ -105,7 +106,8 @@ public void remove() {

private void addProperty( final FedoraEvent fedoraEvent, final Event e ) {
try {
if ( e.getType() == PROPERTY_ADDED || e.getType() == PROPERTY_CHANGED ) {
if ( e.getType() == PROPERTY_ADDED || e.getType() == PROPERTY_CHANGED
|| e.getType() == PROPERTY_REMOVED ) {
fedoraEvent.addProperty( e.getPath().substring(e.getPath().lastIndexOf("/") + 1) );
}
} catch (final RepositoryException ex) {
Expand Down
Expand Up @@ -20,6 +20,9 @@
import static com.google.common.base.Throwables.propagate;
import static com.google.common.collect.Sets.union;
import static java.util.Collections.singleton;
import static javax.jcr.observation.Event.PROPERTY_ADDED;
import static javax.jcr.observation.Event.PROPERTY_CHANGED;
import static javax.jcr.observation.Event.PROPERTY_REMOVED;

import java.util.HashMap;
import java.util.HashSet;
Expand Down Expand Up @@ -98,7 +101,11 @@ public FedoraEvent addProperty( final String property ) {
* @return the path of the underlying JCR {@link Event}s
*/
public String getPath() throws RepositoryException {
return e.getPath();
if ( e.getType() == PROPERTY_ADDED || e.getType() == PROPERTY_CHANGED || e.getType() == PROPERTY_REMOVED ) {
return e.getPath().substring(0, e.getPath().lastIndexOf("/"));
} else {
return e.getPath();
}
}

/**
Expand Down

0 comments on commit b26aa74

Please sign in to comment.