Skip to content

Commit df13163

Browse files
committed
Remove dc.date.created test
1 parent d6b2e4a commit df13163

1 file changed

Lines changed: 16 additions & 22 deletions

File tree

dspace/src/main/edu/georgetown/library/fileAnalyzer/importer/IngestFolderCreate.java

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
*
4747
*/
4848
public class IngestFolderCreate extends DefaultImporter {
49-
private static enum IngestStatsItems implements StatsItemEnum {
49+
static enum IngestStatsItems implements StatsItemEnum {
5050
LineNo(StatsItem.makeStringStatsItem("Line No").setExport(false).setWidth(60)),
5151
Folder(StatsItem.makeStringStatsItem("Folder")),
5252
Status(StatsItem.makeEnumStatsItem(status.class, "Status").setWidth(60)),
@@ -104,9 +104,9 @@ class column {
104104

105105
}
106106

107-
private static enum FileStats {NA, NOT_FOUND, ERROR, ALREADY_EXISTS, MOVED_TO_INGEST, COPIED_TO_INGEST;}
108-
private static enum MetaStats {NA, ERROR, CREATED, OVERWRITTEN;}
109-
private static enum InputMetaStats {NA, MISSING, FORMAT_ERROR, DUPLICATE, OK;}
107+
static enum FileStats {NA, NOT_FOUND, ERROR, ALREADY_EXISTS, MOVED_TO_INGEST, COPIED_TO_INGEST;}
108+
static enum MetaStats {NA, ERROR, CREATED, OVERWRITTEN;}
109+
static enum InputMetaStats {NA, MISSING, FORMAT_ERROR, DUPLICATE, OK;}
110110
class CreateException extends Exception {
111111
private static final long serialVersionUID = 5042987495219000857L;
112112

@@ -166,7 +166,7 @@ public String getDescription() {
166166
"\t3) Thumbnail file name - optional, file must exist if present\n"+
167167
"\t4) License file name - optional, file must exist if present\n"+
168168
"\tAddition columns should have a dublin core field name in their header. Columns without a 'dc.' header will be ignored\n" +
169-
"A title (dc.title) and a properly formatted creation date (dc.date.created) must be present somewhere in the set of additional columns.";
169+
validateRowDescription();
170170
}
171171
public String getShortName() {
172172
return "Ingest Folder";
@@ -373,6 +373,16 @@ public ActionResult importFile(File selectedFile) throws IOException {
373373
return new ActionResult(selectedFile, selectedFile.getName(), this.toString(), getDetails(), types, true, timer.getDuration());
374374
}
375375

376+
public String validateRowDescription() {
377+
return "A title (dc.title) must be present .";
378+
}
379+
public void validateRow(Vector<String> cols,Stats stats) throws CreateException {
380+
if (!hasColumnValue(cols, "dc.title")) {
381+
stats.setVal(IngestStatsItems.InputMetadata, InputMetaStats.MISSING);
382+
throw new CreateException("Item must have element [dc.title]");
383+
}
384+
}
385+
376386
public void importRow(File selectedFile, Vector<String> cols,Stats stats, String globalThumb, String globalLicense) {
377387
StringBuffer buf = new StringBuffer();
378388
try {
@@ -433,23 +443,7 @@ public void importRow(File selectedFile, Vector<String> cols,Stats stats, String
433443
}
434444
}
435445

436-
if (!hasColumnValue(cols, "dc.title")) {
437-
stats.setVal(IngestStatsItems.InputMetadata, InputMetaStats.MISSING);
438-
throw new CreateException("Item must have element [dc.title]");
439-
} else if (!hasColumnValue(cols, "dc.date.created")) {
440-
stats.setVal(IngestStatsItems.InputMetadata, InputMetaStats.MISSING);
441-
throw new CreateException("Item must have element [dc.date.created]");
442-
} else {
443-
for(column col: colHeaderDefs) {
444-
if (col.valid && col.element.equals("date")) {
445-
String val = getColumnValue(cols, col.name, "");
446-
if (!testDate(val)) {
447-
stats.setVal(IngestStatsItems.InputMetadata, InputMetaStats.FORMAT_ERROR);
448-
throw new CreateException(col.name +" [" + val + "] must start with either YYYY-MM-DD, YYYY-MM, YYYY or 'No Date'.");
449-
}
450-
}
451-
}
452-
}
446+
validateRow(cols, stats);
453447
stats.setVal(IngestStatsItems.InputMetadata, InputMetaStats.OK);
454448

455449
testFile(stats, IngestStatsItems.ItemFileStats, selectedFile, folder, file);

0 commit comments

Comments
 (0)