Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Overriding FedoraBinaryImpl.getVersionHistory()
  • Loading branch information
escowles committed Oct 20, 2014
1 parent 53cdb7e commit 9b4aa3b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
Expand Up @@ -377,7 +377,7 @@ public void testVersionOperationAddsVersionableMixin() throws Exception {
}

@Test
public void testDatastreamAutoVersioning() throws IOException {
public void testDatastreamAutoMixin() throws IOException {
final String pid = getRandomUniquePid();
createObject(pid);

Expand Down
Expand Up @@ -42,6 +42,7 @@
import javax.jcr.Property;
import javax.jcr.Repository;
import javax.jcr.RepositoryException;
import javax.jcr.version.VersionHistory;
import java.io.InputStream;
import java.net.URI;
import java.net.URISyntaxException;
Expand Down Expand Up @@ -346,6 +347,20 @@ private static void decorateContentNode(final Node contentNode) throws Repositor
}
}

/*
* (non-Javadoc)
* @see org.fcrepo.kernel.FedoraResource#getVersionHistory()
*/
@Override
public VersionHistory getVersionHistory() {
try {
return getSession().getWorkspace().getVersionManager().getVersionHistory(getDescription().getPath());
} catch (final RepositoryException e) {
throw new RepositoryRuntimeException(e);
}
}


@Override
public boolean isVersioned() {
return getDescription().isVersioned();
Expand Down
Expand Up @@ -441,8 +441,7 @@ public Version getBaseVersion() {
@Override
public VersionHistory getVersionHistory() {
try {
final String versionedPath = (FedoraBinaryImpl.hasMixin(node)) ? node.getParent().getPath() : getPath();
return getSession().getWorkspace().getVersionManager().getVersionHistory(versionedPath);
return getSession().getWorkspace().getVersionManager().getVersionHistory(getPath());
} catch (final RepositoryException e) {
throw new RepositoryRuntimeException(e);
}
Expand Down Expand Up @@ -581,7 +580,7 @@ public boolean equals(final Object object) {
}
}

private Session getSession() {
protected Session getSession() {
try {
return getNode().getSession();
} catch (final RepositoryException e) {
Expand Down

0 comments on commit 9b4aa3b

Please sign in to comment.