Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: UNC-Libraries/Curators-Workbench
...
head fork: UNC-Libraries/Curators-Workbench
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 3 files changed
  • 0 commit comments
  • 1 contributor
View
15 mets.model/src/gov/loc/mets/util/METSUtils.java
@@ -40,11 +40,14 @@
import java.net.URLConnection;
import java.util.Collection;
import java.util.Date;
+import java.util.GregorianCalendar;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import javax.activation.MimetypesFileTypeMap;
+import javax.xml.datatype.DatatypeFactory;
+import javax.xml.datatype.XMLGregorianCalendar;
import org.eclipse.emf.common.util.TreeIterator;
import org.eclipse.emf.ecore.EObject;
@@ -204,7 +207,7 @@ public static DivType findBagDiv(MetsType m) {
* the original IFile
* @return the file element
*/
- public static FileType addFile(MetsType mets, URI originalData, String xmlid, long size, String md5) {
+ public static FileType addFile(MetsType mets, URI originalData, String xmlid, long size, Long createdTimestamp, String md5) {
FileType f = MetsFactory.eINSTANCE.createFileType();
f.setID(xmlid);
@@ -212,6 +215,16 @@ public static FileType addFile(MetsType mets, URI originalData, String xmlid, lo
f.setCHECKSUMTYPE(CHECKSUMTYPEType.MD5);
f.setCHECKSUM(md5);
}
+ if(createdTimestamp != null) {
+ GregorianCalendar cal= (GregorianCalendar) GregorianCalendar.getInstance();
+ cal.setTimeInMillis(createdTimestamp.longValue());
+ try {
+ XMLGregorianCalendar createdCal = DatatypeFactory.newInstance().newXMLGregorianCalendar(cal);
+ f.setCREATED(createdCal);
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+ }
f.setSIZE(size);
FileNameMap fileNameMap = URLConnection.getFileNameMap();
String type = fileNameMap.getContentTypeFor(originalData.toString());
View
17 workbench_plugin/src/main/java/unc/lib/cdr/workbench/capture/CaptureJob.java
@@ -24,6 +24,12 @@
import gov.loc.mets.util.METSConstants;
import gov.loc.mets.util.METSUtils;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.attribute.BasicFileAttributes;
+import java.nio.file.attribute.FileTime;
import java.text.Collator;
import java.util.ArrayList;
import java.util.Arrays;
@@ -310,11 +316,18 @@ private DivType makeDiv(OriginalFileStore original) throws CoreException {
// calc size and checksum.
IFileInfo sourceFileInfo = original.fetchInfo();
long size = sourceFileInfo.getLength();
-
+ //long lastModifiedTimestamp = sourceFileInfo.getLastModified();
+ Long createTimestamp = null;
+ Path path = Paths.get(original.getWrapped().toURI());
+ try {
+ BasicFileAttributes attr = Files.readAttributes(path, BasicFileAttributes.class);
+ FileTime create = attr.creationTime();
+ if(create != null) createTimestamp = new Long(create.toMillis());
+ } catch(IOException ignored) {}
// find File section (for previously captured) or make one
FileType ft = original.getMetsFileType();
if (ft == null) {
- ft = METSUtils.addFile(m, original.getWrapped().toURI(), original.getFileID(), size, null);
+ ft = METSUtils.addFile(m, original.getWrapped().toURI(), original.getFileID(), size, createTimestamp, null);
}
FptrType fptr = MetsFactory.eINSTANCE.createFptrType();
View
4 workbench_plugin/src/main/java/unc/lib/cdr/workbench/stage/StagingJob.java
@@ -107,9 +107,9 @@ protected IStatus run(IProgressMonitor monitor) {
FLocatType loc = original.getStagingLocatorType();
if (loc == null) {
toStage.add(original);
- System.err.println(" queued");
+ //System.err.println(" queued");
} else {
- System.err.println(" found stage flocat");
+ //System.err.println(" found stage flocat");
}
} else {
System.err.println(" cannot find original");

No commit comments for this range

Something went wrong with that request. Please try again.