Skip to content

Commit

Permalink
Save the last update date of nahima export
Browse files Browse the repository at this point in the history
  • Loading branch information
GenieTim committed Dec 12, 2023
1 parent 2cee9c0 commit e739816
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -760,8 +760,7 @@ public JSONObject resolvePerson(String personName) throws IOException, Interrupt
}}));
}
log.debug("Resolved person " + personName + " to first name " + finalFirstName + ", last name " + finalLastName + ", birth date " + birthdate + ", and death date " + deathdate);
JSONObject results = this.resolveOrCreateInteractive(personName, "person", "person__public", new JSONObject(personHashMap), true, 0);
return results;
return this.resolveOrCreateInteractive(personName, "person", "person__public", new JSONObject(personHashMap), true, 0);
}

public JSONObject resolveRegionType(String type) throws IOException, InterruptedException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,9 @@
<property name="nahimaExported" type="java.lang.Boolean">
<column name="nahimaExported" default="0"/>
</property>
<property name="dateLastNahimaUpdated" type="timestamp">
<column name="DateLastNahimaUpdated" length="0"/>
</property>
<property name="nahimaId" type="string">
<column name="nahimaId" default=""/>
</property>
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/edu/harvard/mcz/imagecapture/entity/Specimen.java
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ public class Specimen implements Serializable {
private String citedInPublicationLink;
private String citedInPublicationComment;
private String citedInPublicationYear;
private Date dateLastNahimaUpdated;


public Specimen() {
setDefaults();
Expand Down Expand Up @@ -256,6 +258,14 @@ public void setNahimaId(String nahimaId) {
this.nahimaId = nahimaId;
}

public Date getDateLastNahimaUpdated() {
return dateLastNahimaUpdated;
}

public void setDateLastNahimaUpdated(Date dateLastNahimaUpdated) {
this.dateLastNahimaUpdated = dateLastNahimaUpdated;
}

public String getHigherOrder() {
return higherOrder;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ public void start() {
specimen.setWorkFlowStatus(WorkFlowStatus.STAGE_DONE);
}
specimen.setNahimaId(result.getString("_global_object_id"));
specimen.setDateLastNahimaUpdated(new Date());
if (specimen.getSpecimenId() != null && specimen.getSpecimenId() > 0) {
try {
sls.attachDirty(specimen);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,8 @@ protected String putRequest(String url, String data, Map<String, String> headers
.PUT(HttpRequest.BodyPublishers.ofString(data))
.uri(URI.create(url))
.setHeader("User-Agent", "DataShot " + ImageCaptureApp.getAppVersion()) // add request header
.setHeader("Content-Type", "application/x-www-form-urlencoded");
.setHeader("Content-Type", "application/x-www-form-urlencoded")
.timeout(Duration.ofMinutes(3));

if (headers != null) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ALTER TABLE Specimen
ADD `DateLastNahimaUpdated` TIMESTAMP NULL DEFAULT NULL;
INSERT INTO `allowed_version` (`version`)
VALUES ('1.16.2');

0 comments on commit e739816

Please sign in to comment.