Skip to content
Permalink
Browse files

Added support for datastream properties.

  • Loading branch information...
daniel-dgi authored and mikedurbin committed Apr 2, 2015
1 parent cbf42f8 commit 445a67972339f87f055fd949ffe9f7267e4067db
@@ -72,4 +72,18 @@
* redirect datastream.
*/
public String getExternalOrRedirectURL();

/**
* Determines if this is the first version of a datastream.
*
* @return True if this is the first version, false otherwise.
*/
public boolean isFirstVersionIn(ObjectReference obj);

/**
* Determines if this is the last version of a datastream.
*
* @return True if this is the last version, false otherwise.
*/
public boolean isLastVersionIn(ObjectReference obj);
}
@@ -5,11 +5,11 @@
import org.fcrepo.migration.DatastreamVersion;
import org.fcrepo.migration.DefaultContentDigest;
import org.fcrepo.migration.DefaultObjectInfo;
import org.fcrepo.migration.ObjectReference;
import org.fcrepo.migration.StreamingFedoraObjectHandler;
import org.fcrepo.migration.FedoraObjectProcessor;
import org.fcrepo.migration.ObjectInfo;
import org.fcrepo.migration.ObjectProperties;

import org.apache.commons.codec.binary.Base64OutputStream;

import javax.xml.bind.JAXBContext;
@@ -24,6 +24,7 @@
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.events.XMLEvent;

import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
@@ -378,6 +379,17 @@ public String getExternalOrRedirectURL() {
}
}

@Override
public boolean isFirstVersionIn(ObjectReference obj) {
List<DatastreamVersion> datastreams = obj.getDatastreamVersions(getDatastreamInfo().getDatastreamId());
return datastreams.indexOf(this) == 0;
}

@Override
public boolean isLastVersionIn(ObjectReference obj) {
List<DatastreamVersion> datastreams = obj.getDatastreamVersions(getDatastreamInfo().getDatastreamId());
return datastreams.indexOf(this) == datastreams.size() - 1;
}
}

private static Map<String, String> getAttributes(XMLStreamReader r, String ... allowedNames) {
Oops, something went wrong.

0 comments on commit 445a679

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