Skip to content

Commit

Permalink
Implement possiblity to scan id date field in QR Code
Browse files Browse the repository at this point in the history
  • Loading branch information
GenieTim committed Sep 12, 2020
1 parent b85d507 commit d37c0ec
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public class UnitTrayLabelParser implements TaxonNameReturner, DrawerNameReturne
private String drawerNumber;
private String collection; // collection from which the material came
private String identifiedBy;
private String identifiedDate;
private String sex;
private boolean parsedFromJSON;

Expand Down Expand Up @@ -103,6 +104,7 @@ protected void parse() {
infraspecificEpithet = "";
infraspecificRank = "";
drawerNumber = "";
identifiedDate = "";

// Can't parse text if it is null.
if (text != null) {
Expand Down Expand Up @@ -513,6 +515,15 @@ public void setSex(String sex) {
this.sex = sex;
}

public void setIdentifiedDate(String identifiedDate) {
this.identifiedDate = identifiedDate;
}

@Override
public String getIdentifiedDate() {
return identifiedDate;
}

/**
* Was this Parse done from JSON.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public class UnitTrayLabel
private String collection; // collection from which the material came
private Integer ordinal; // order in which to print
private String identifiedBy;
private String identifiedDate;
private String sex;

public UnitTrayLabel() {
Expand All @@ -75,6 +76,7 @@ public UnitTrayLabel() {
this.collection = "";
this.sex = "";
this.ordinal = 1;
this.identifiedDate = "";
this.dateCreated = new Date();
this.dateLastUpdated = new Date();
}
Expand Down Expand Up @@ -326,6 +328,9 @@ public static UnitTrayLabel createFromJSONString(String jsonEncodedLabel) {
if (key.equals("id")) {
result.setIdentifiedBy(value);
}
if (key.equals("idD")) {
result.setIdentifiedBy(value);
}
if (key.equals("x")) {
result.setSex(value);
}
Expand Down Expand Up @@ -629,6 +634,15 @@ public void setDateLastUpdated(Date dateLastUpdated) {
this.dateLastUpdated = dateLastUpdated;
}

public void setIdentifiedDate(String identifiedDate) {
this.identifiedDate = identifiedDate;
}

@Override
public String getIdentifiedDate() {
return identifiedDate;
}

public String getSex() {
return sex;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ public interface TaxonNameReturner {
*/
String getIdentifiedBy();

/**
* @return the determiner
*/
String getIdentifiedDate();

/**
* @return the sex (male, female, worker)
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,7 @@ protected static void createDatabaseRecordForSpecimen(File containedFile, ScanCo
} else {
s.setSex(sex);
}
s.setDateIdentified(parser.getIdentifiedDate());
} else {
// We failed over to OCR, try lookup in DB.
s.setFamily(""); // make sure there's a a non-null value in family.
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/log4j.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
### direct messages to file hibernate.log ###
log4j.appender.file=org.apache.log4j.FileAppender
log4j.appender.file.File=imagecapture.log
log4j.appender.file.File=datashot.log
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
### set log levels - for more verbose logging change 'info' to 'debug' ###
Expand Down

0 comments on commit d37c0ec

Please sign in to comment.