Skip to content

Commit

Permalink
#4349 - Project has date in the 70ies if no data is set in JSON
Browse files Browse the repository at this point in the history
- Set the current date if no dates are specified in the project export
  • Loading branch information
reckart committed Dec 5, 2023
1 parent 7e899cc commit 68adecc
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import java.io.File;
import java.io.IOException;
import java.util.Date;
import java.util.zip.ZipFile;

import de.tudarmstadt.ukp.clarin.webanno.api.export.FullProjectExportRequest;
Expand Down Expand Up @@ -88,6 +89,15 @@ public void importData(ProjectImportRequest aRequest, Project aProject,
aProject.setUpdated(aExProject.getUpdated());
aProject.setAnonymousCuration(aExProject.isAnonymousCuration());

// Set dates to now if no dates are set in the exported project
var now = new Date();
if (aProject.getCreated().getTime() == 0) {
aProject.setCreated(now);
}
if (aProject.getUpdated().getTime() == 0) {
aProject.setUpdated(now);
}

// Set default to LTR on import from old WebAnno versions
if (aExProject.getScriptDirection() == null) {
aProject.setScriptDirection(ScriptDirection.LTR);
Expand Down

0 comments on commit 68adecc

Please sign in to comment.