Skip to content

Commit

Permalink
#43 Export ROR id and 2nd/3rd affilation to Datacite
Browse files Browse the repository at this point in the history
  • Loading branch information
haarli committed Sep 1, 2022
1 parent 00d458d commit 7c2dd4c
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,28 @@ public String generateXML(DvObject dvObject) {
}
}
if (author.getAffiliation() != null && !author.getAffiliation().getDisplayValue().isEmpty()) {
creatorsElement.append("<affiliation>" + author.getAffiliation().getDisplayValue() + "</affiliation>");
creatorsElement.append("<affiliation");
if(author.getAffiliationId() != null && !author.getAffiliationId().getDisplayValue().isEmpty()) {
creatorsElement.append(" schemeURI=\"https://ror.org/\" affiliationIdentifierScheme=\"ROR\" affiliationIdentifier=\""+ author.getAffiliationId().getValue() +"\"");
}
creatorsElement.append(">" + author.getAffiliation().getDisplayValue() + "</affiliation>");

}
if (author.getAffiliation2() != null && !author.getAffiliation2().getDisplayValue().isEmpty()) {
creatorsElement.append("<affiliation");
if(author.getAffiliation2Id() != null && !author.getAffiliation2Id().getDisplayValue().isEmpty()) {
creatorsElement.append(" schemeURI=\"https://ror.org/\" affiliationIdentifierScheme=\"ROR\" affiliationIdentifier=\""+ author.getAffiliation2Id().getValue() +"\"");
}
creatorsElement.append(">" + author.getAffiliation2().getDisplayValue() + "</affiliation>");

}
if (author.getAffiliation3() != null && !author.getAffiliation3().getDisplayValue().isEmpty()) {
creatorsElement.append("<affiliation");
if(author.getAffiliation3Id() != null && !author.getAffiliation3Id().getDisplayValue().isEmpty()) {
creatorsElement.append(" schemeURI=\"https://ror.org/\" affiliationIdentifierScheme=\"ROR\" affiliationIdentifier=\""+ author.getAffiliation3Id().getValue() +"\"");
}
creatorsElement.append(">" + author.getAffiliation3().getDisplayValue() + "</affiliation>");

}
creatorsElement.append("</creator>");
}
Expand Down
40 changes: 39 additions & 1 deletion src/main/java/edu/harvard/iq/dataverse/DatasetAuthor.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,45 @@ public DatasetField getAffiliation() {
public void setAffiliation(DatasetField affiliation) {
this.affiliation = affiliation;
}


private DatasetField affiliationId;
public DatasetField getAffiliationId() {
return this.affiliationId;
}
public void setAffiliationId(DatasetField affiliationId) {
this.affiliationId = affiliationId;
}

private DatasetField affiliation2;
public DatasetField getAffiliation2() {
return this.affiliation2;
}
public void setAffiliation2(DatasetField affiliation2) {
this.affiliation2 = affiliation2;
}
private DatasetField affiliation2Id;
public DatasetField getAffiliation2Id() {
return this.affiliation2Id;
}
public void setAffiliation2Id(DatasetField affiliation2Id) {
this.affiliation2Id = affiliation2Id;
}

private DatasetField affiliation3;
public DatasetField getAffiliation3() {
return this.affiliation3;
}
public void setAffiliation3(DatasetField affiliation3) {
this.affiliation3 = affiliation3;
}
private DatasetField affiliation3Id;
public DatasetField getAffiliation3Id() {
return this.affiliation3Id;
}
public void setAffiliation3Id(DatasetField affiliation3Id) {
this.affiliation3Id = affiliation3Id;
}

private String idType;

public String getIdType() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ public class DatasetFieldConstant implements java.io.Serializable {
public final static String datasetId = "datasetId";
public final static String authorName ="authorName";
public final static String authorAffiliation = "authorAffiliation";
public final static String authorAffiliationId = "authorAffiliationId";
public final static String authorAffiliation2 = "authorAffiliation2";
public final static String authorAffiliation2Id = "authorAffiliation2Id";
public final static String authorAffiliation3 = "authorAffiliation3";
public final static String authorAffiliation3Id = "authorAffiliation3Id";

public final static String authorIdType = "authorIdentifierScheme";
public final static String authorIdValue = "authorIdentifier";
public final static String otherIdValue="otherIdValue";
Expand Down
15 changes: 15 additions & 0 deletions src/main/java/edu/harvard/iq/dataverse/DatasetVersion.java
Original file line number Diff line number Diff line change
Expand Up @@ -892,6 +892,21 @@ public List<DatasetAuthor> getDatasetAuthors() {
if (subField.getDatasetFieldType().getName().equals(DatasetFieldConstant.authorAffiliation)) {
datasetAuthor.setAffiliation(subField);
}
if (subField.getDatasetFieldType().getName().equals(DatasetFieldConstant.authorAffiliation2)) {
datasetAuthor.setAffiliation2(subField);
}
if (subField.getDatasetFieldType().getName().equals(DatasetFieldConstant.authorAffiliation3)) {
datasetAuthor.setAffiliation3(subField);
}
if (subField.getDatasetFieldType().getName().equals(DatasetFieldConstant.authorAffiliationId)) {
datasetAuthor.setAffiliationId(subField);
}
if (subField.getDatasetFieldType().getName().equals(DatasetFieldConstant.authorAffiliation2Id)) {
datasetAuthor.setAffiliation2Id(subField);
}
if (subField.getDatasetFieldType().getName().equals(DatasetFieldConstant.authorAffiliation3Id)) {
datasetAuthor.setAffiliation3Id(subField);
}
if (subField.getDatasetFieldType().getName().equals(DatasetFieldConstant.authorIdType)){
datasetAuthor.setIdType(subField.getRawValue());
}
Expand Down

0 comments on commit 7c2dd4c

Please sign in to comment.