-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6831 from ORCID/8682-trust-summary-json-format
8682 trust summary json format
- Loading branch information
Showing
6 changed files
with
646 additions
and
5 deletions.
There are no files selected for viewing
137 changes: 137 additions & 0 deletions
137
orcid-core/src/main/java/org/orcid/pojo/summary/AffiliationSummary.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
package org.orcid.pojo.summary; | ||
|
||
import org.orcid.jaxb.model.v3.release.common.FuzzyDate; | ||
import org.orcid.pojo.ajaxForm.PojoUtil; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class AffiliationSummary { | ||
public String organizationName; | ||
public String url; | ||
public String startDate; | ||
public String endDate; | ||
public String role; | ||
public String title; | ||
public String type; | ||
public boolean validatedOrSelfAsserted; | ||
|
||
public String getOrganizationName() { | ||
return organizationName; | ||
} | ||
|
||
public void setOrganizationName(String organizationName) { | ||
this.organizationName = organizationName; | ||
} | ||
|
||
public String getUrl() { | ||
return url; | ||
} | ||
|
||
public void setUrl(String url) { | ||
this.url = url; | ||
} | ||
|
||
public String getStartDate() { | ||
return startDate; | ||
} | ||
|
||
public void setStartDate(String startDate) { | ||
this.startDate = startDate; | ||
} | ||
|
||
public String getEndDate() { | ||
return endDate; | ||
} | ||
|
||
public void setEndDate(String endDate) { | ||
this.endDate = endDate; | ||
} | ||
|
||
public String getRole() { | ||
return role; | ||
} | ||
|
||
public void setRole(String role) { | ||
this.role = role; | ||
} | ||
|
||
public String getTitle() { | ||
return title; | ||
} | ||
|
||
public void setTitle(String title) { | ||
this.title = title; | ||
} | ||
|
||
public String getType() { | ||
return type; | ||
} | ||
|
||
public void setType(String type) { | ||
this.type = type; | ||
} | ||
|
||
public boolean isValidatedOrSelfAsserted() { | ||
return validatedOrSelfAsserted; | ||
} | ||
|
||
public void setValidatedOrSelfAsserted(boolean validatedOrSelfAsserted) { | ||
this.validatedOrSelfAsserted = validatedOrSelfAsserted; | ||
} | ||
|
||
public static List<AffiliationSummary> valueOf(List<org.orcid.jaxb.model.v3.release.record.summary.AffiliationSummary> affiliationGroupForms, String orcid, String type) { | ||
List<AffiliationSummary> affiliationSummaries = new ArrayList<>(); | ||
|
||
affiliationGroupForms.forEach(affiliationGroupForm -> { | ||
affiliationSummaries.add(AffiliationSummary.valueOf(affiliationGroupForm, orcid, type)); | ||
}); | ||
|
||
return affiliationSummaries; | ||
} | ||
|
||
public static AffiliationSummary valueOf(org.orcid.jaxb.model.v3.release.record.summary.AffiliationSummary as, String orcid, String type) { | ||
AffiliationSummary form = new AffiliationSummary(); | ||
|
||
if (as != null) { | ||
if (as.getOrganization().getName() == null || as.getOrganization().getName().trim().length() == 0) { | ||
form.setOrganizationName(as.getOrganization().getName()); | ||
} | ||
|
||
if (!PojoUtil.isEmpty(as.getUrl())) { | ||
form.setUrl(as.getUrl().getValue()); | ||
} | ||
|
||
if (!PojoUtil.isEmpty(as.getStartDate())) { | ||
form.setStartDate(getDate(as.getStartDate())); | ||
} | ||
|
||
if (!PojoUtil.isEmpty(as.getEndDate())) { | ||
form.setEndDate(getDate(as.getEndDate())); | ||
} | ||
|
||
if (!PojoUtil.isEmpty(as.getRoleTitle())) { | ||
form.setRole(as.getRoleTitle()); | ||
} | ||
|
||
if (!PojoUtil.isEmpty(as.getDepartmentName())) { | ||
form.setOrganizationName(as.getDepartmentName()); | ||
} | ||
|
||
if (!PojoUtil.isEmpty(as.getRoleTitle())) { | ||
form.setRole(as.getRoleTitle()); | ||
} | ||
|
||
form.setType(type); | ||
|
||
if (as.getSource() != null) { | ||
form.setValidatedOrSelfAsserted(as.getSource().getSourceName().getContent().equals(orcid)); | ||
} | ||
} | ||
return form; | ||
} | ||
|
||
private static String getDate(FuzzyDate date) { | ||
return date != null ? date.toString() : null; | ||
} | ||
} |
68 changes: 68 additions & 0 deletions
68
orcid-core/src/main/java/org/orcid/pojo/summary/ExternalIdentifiersSummary.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package org.orcid.pojo.summary; | ||
|
||
import org.orcid.jaxb.model.v3.release.record.PersonExternalIdentifier; | ||
import org.orcid.jaxb.model.v3.release.record.PersonExternalIdentifiers; | ||
import org.orcid.pojo.ajaxForm.PojoUtil; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class ExternalIdentifiersSummary { | ||
private String id; | ||
private String url; | ||
private boolean validatedOrSelfAsserted; | ||
|
||
public String getId() { | ||
return id; | ||
} | ||
|
||
public void setId(String id) { | ||
this.id = id; | ||
} | ||
|
||
public String getUrl() { | ||
return url; | ||
} | ||
|
||
public void setUrl(String url) { | ||
this.url = url; | ||
} | ||
|
||
public boolean isValidatedOrSelfAsserted() { | ||
return validatedOrSelfAsserted; | ||
} | ||
|
||
public void setValidatedOrSelfAsserted(boolean validatedOrSelfAsserted) { | ||
this.validatedOrSelfAsserted = validatedOrSelfAsserted; | ||
} | ||
|
||
public static List<ExternalIdentifiersSummary> valueOf(PersonExternalIdentifiers personExternalIdentifiers, String orcid) { | ||
List<ExternalIdentifiersSummary> externalIdentifiersSummaryList = new ArrayList<>(); | ||
|
||
personExternalIdentifiers.getExternalIdentifiers().forEach(personExternalIdentifier -> { | ||
externalIdentifiersSummaryList.add(ExternalIdentifiersSummary.valueOf(personExternalIdentifier, orcid)); | ||
}); | ||
|
||
return externalIdentifiersSummaryList; | ||
} | ||
|
||
public static ExternalIdentifiersSummary valueOf(PersonExternalIdentifier personExternalIdentifier, String orcid) { | ||
ExternalIdentifiersSummary form = new ExternalIdentifiersSummary(); | ||
|
||
if (personExternalIdentifier != null) { | ||
if (!PojoUtil.isEmpty(personExternalIdentifier.getUrl())) { | ||
form.setUrl(personExternalIdentifier.getUrl().getValue()); | ||
} | ||
|
||
if (personExternalIdentifier.getPutCode() != null) { | ||
form.setId(String.valueOf(personExternalIdentifier.getPutCode())); | ||
} | ||
|
||
if (personExternalIdentifier.getSource() != null) { | ||
form.setValidatedOrSelfAsserted(personExternalIdentifier.getSource().retrieveSourcePath().equals(orcid)); | ||
} | ||
} | ||
return form; | ||
} | ||
|
||
} |
144 changes: 144 additions & 0 deletions
144
orcid-core/src/main/java/org/orcid/pojo/summary/RecordSummary.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
package org.orcid.pojo.summary; | ||
|
||
|
||
import java.util.List; | ||
|
||
public class RecordSummary { | ||
private String name; | ||
private String orcid; | ||
private List<AffiliationSummary> employmentAffiliations; | ||
private int employmentAffiliationsCount; | ||
private String creation; | ||
private String lastModified; | ||
private int validatedWorks; | ||
private int selfAssertedWorks; | ||
private int reviews; | ||
private int peerReviewPublicationGrants; | ||
private int validatedFunds; | ||
private int selfAssertedFunds; | ||
private List<AffiliationSummary> professionalActivities; | ||
private int professionalActivitiesCount; | ||
private List<ExternalIdentifiersSummary> externalIdentifiers; | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
|
||
public String getOrcid() { | ||
return orcid; | ||
} | ||
|
||
public void setOrcid(String orcid) { | ||
this.orcid = orcid; | ||
} | ||
|
||
public List<AffiliationSummary> getEmploymentAffiliations() { | ||
return employmentAffiliations; | ||
} | ||
|
||
public void setEmploymentAffiliations(List<AffiliationSummary> employmentAffiliations) { | ||
this.employmentAffiliations = employmentAffiliations; | ||
} | ||
|
||
public int getEmploymentAffiliationsCount() { | ||
return employmentAffiliationsCount; | ||
} | ||
|
||
public void setEmploymentAffiliationsCount(int employmentAffiliationsCount) { | ||
this.employmentAffiliationsCount = employmentAffiliationsCount; | ||
} | ||
|
||
public String getCreation() { | ||
return creation; | ||
} | ||
|
||
public void setCreation(String creation) { | ||
this.creation = creation; | ||
} | ||
|
||
public String getLastModified() { | ||
return lastModified; | ||
} | ||
|
||
public void setLastModified(String lastModified) { | ||
this.lastModified = lastModified; | ||
} | ||
|
||
public int getValidatedWorks() { | ||
return validatedWorks; | ||
} | ||
|
||
public void setValidatedWorks(int validatedWorks) { | ||
this.validatedWorks = validatedWorks; | ||
} | ||
|
||
public int getSelfAssertedWorks() { | ||
return selfAssertedWorks; | ||
} | ||
|
||
public void setSelfAssertedWorks(int selfAssertedWorks) { | ||
this.selfAssertedWorks = selfAssertedWorks; | ||
} | ||
|
||
public int getReviews() { | ||
return reviews; | ||
} | ||
|
||
public void setReviews(int reviews) { | ||
this.reviews = reviews; | ||
} | ||
|
||
public int getPeerReviewPublicationGrants() { | ||
return peerReviewPublicationGrants; | ||
} | ||
|
||
public void setPeerReviewPublicationGrants(int peerReviewPublicationGrants) { | ||
this.peerReviewPublicationGrants = peerReviewPublicationGrants; | ||
} | ||
|
||
public int getValidatedFunds() { | ||
return validatedFunds; | ||
} | ||
|
||
public void setValidatedFunds(int validatedFunds) { | ||
this.validatedFunds = validatedFunds; | ||
} | ||
|
||
public int getSelfAssertedFunds() { | ||
return selfAssertedFunds; | ||
} | ||
|
||
public void setSelfAssertedFunds(int selfAssertedFunds) { | ||
this.selfAssertedFunds = selfAssertedFunds; | ||
} | ||
|
||
public List<AffiliationSummary> getProfessionalActivities() { | ||
return professionalActivities; | ||
} | ||
|
||
public void setProfessionalActivities(List<AffiliationSummary> professionalActivities) { | ||
this.professionalActivities = professionalActivities; | ||
} | ||
|
||
public int getProfessionalActivitiesCount() { | ||
return professionalActivitiesCount; | ||
} | ||
|
||
public void setProfessionalActivitiesCount(int professionalActivitiesCount) { | ||
this.professionalActivitiesCount = professionalActivitiesCount; | ||
} | ||
|
||
public List<ExternalIdentifiersSummary> getExternalIdentifiers() { | ||
return externalIdentifiers; | ||
} | ||
|
||
public void setExternalIdentifiers(List<ExternalIdentifiersSummary> externalIdentifiers) { | ||
this.externalIdentifiers = externalIdentifiers; | ||
} | ||
|
||
|
||
} |
Oops, something went wrong.