Skip to content

Commit fb76e20

Browse files
committed
2 parents ca4085d + 90b525f commit fb76e20

File tree

20 files changed

+856
-130
lines changed

20 files changed

+856
-130
lines changed

CHANGELOG.md

+32
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,35 @@
1+
## v2.65.3 - 2024-09-17
2+
3+
[Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.65.2...v2.65.3)
4+
5+
## v2.65.2 - 2024-09-17
6+
7+
[Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.65.1...v2.65.2)
8+
9+
## v2.65.1 - 2024-09-17
10+
11+
[Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.65.0...v2.65.1)
12+
13+
## v2.65.0 - 2024-09-13
14+
15+
[Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.64.6...v2.65.0)
16+
17+
## v2.64.6 - 2024-09-06
18+
19+
[Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.64.5...v2.64.6)
20+
21+
## v2.64.5 - 2024-09-04
22+
23+
[Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.64.4...v2.64.5)
24+
25+
## v2.64.4 - 2024-09-03
26+
27+
[Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.64.3...v2.64.4)
28+
29+
## v2.64.3 - 2024-09-02
30+
31+
[Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.64.2...v2.64.3)
32+
133
## v2.64.2 - 2024-08-28
234

335
[Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.64.1...v2.64.2)

orcid-core/src/main/java/org/orcid/core/common/manager/impl/SummaryManagerImpl.java

+220-65
Large diffs are not rendered by default.

orcid-core/src/main/java/org/orcid/core/manager/impl/OrgDisambiguatedManagerImpl.java

+6-7
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,12 @@ synchronized public void processOrgsForIndexing() {
9191
entities = orgDisambiguatedDaoReadOnly.findOrgsPendingIndexing(startIndex, indexingBatchSize);
9292
LOGGER.info("Found chunk of {} disambiguated orgs for indexing", entities.size());
9393
for (OrgDisambiguatedEntity entity : entities) {
94-
processDisambiguatedOrgInTransaction(entity);
94+
try {
95+
processDisambiguatedOrgInTransaction(entity);
96+
}
97+
catch(Exception ex) {
98+
LOGGER.error("@@@FAILED to process the disambiguated org" + entity.getId() + " source id: " + entity.getSourceId(), ex);
99+
}
95100
}
96101
startIndex = startIndex + indexingBatchSize;
97102
} while (!entities.isEmpty());
@@ -162,12 +167,6 @@ private OrgDisambiguatedSolrDocument convertEntityToDocument(OrgDisambiguatedEnt
162167
document.setOrgNamesJson(entity.getNamesJson());
163168
}
164169

165-
List<OrgEntity> orgs = orgDao.findByOrgDisambiguatedId(entity.getId());
166-
if (orgs != null) {
167-
for (OrgEntity org : orgs) {
168-
orgNames.add(org.getName());
169-
}
170-
}
171170
document.setOrgNames(new ArrayList<>(orgNames));
172171

173172
if (OrgDisambiguatedSourceType.FUNDREF.name().equals(entity.getSourceType())) {

orcid-core/src/main/java/org/orcid/core/manager/v3/impl/ProfileEmailDomainManagerImpl.java

+7-34
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
package org.orcid.core.manager.v3.impl;
22

33

4+
import org.orcid.core.manager.ProfileEntityCacheManager;
45
import org.orcid.core.manager.v3.ProfileEmailDomainManager;
56
import org.orcid.core.manager.v3.read_only.impl.ProfileEmailDomainManagerReadOnlyImpl;
67
import org.orcid.jaxb.model.v3.release.common.Visibility;
78
import org.orcid.persistence.dao.EmailDao;
89
import org.orcid.persistence.dao.EmailDomainDao;
10+
import org.orcid.persistence.dao.ProfileDao;
911
import org.orcid.persistence.dao.ProfileEmailDomainDao;
1012
import org.orcid.persistence.jpa.entities.EmailDomainEntity;
1113
import org.orcid.persistence.jpa.entities.EmailEntity;
1214
import org.orcid.persistence.jpa.entities.ProfileEmailDomainEntity;
15+
import org.orcid.persistence.jpa.entities.ProfileEntity;
1316
import org.slf4j.Logger;
1417
import org.slf4j.LoggerFactory;
1518
import org.springframework.transaction.annotation.Transactional;
@@ -34,7 +37,8 @@ public class ProfileEmailDomainManagerImpl extends ProfileEmailDomainManagerRead
3437
@Resource(name = "emailDaoReadOnly")
3538
protected EmailDao emailDaoReadOnly;
3639

37-
private static final String DEFAULT_DOMAIN_VISIBILITY = Visibility.PRIVATE.toString().toUpperCase();
40+
@Resource
41+
private ProfileEntityCacheManager profileEntityCacheManager;
3842

3943
@Transactional
4044
public void updateEmailDomains(String orcid, org.orcid.pojo.ajaxForm.Emails newEmails) {
@@ -71,47 +75,16 @@ public void updateEmailDomains(String orcid, org.orcid.pojo.ajaxForm.Emails newE
7175
public void processDomain(String orcid, String email) {
7276
String domain = email.split("@")[1];
7377
EmailDomainEntity domainInfo = emailDomainDao.findByEmailDomain(domain);
74-
String domainVisibility = DEFAULT_DOMAIN_VISIBILITY;
7578
// Check if email is professional
7679
if (domainInfo != null && domainInfo.getCategory().equals(EmailDomainEntity.DomainCategory.PROFESSIONAL)) {
7780
ProfileEmailDomainEntity existingDomain = profileEmailDomainDao.findByEmailDomain(orcid, domain);
7881
// ADD NEW DOMAIN IF ONE DOESN'T EXIST
7982
if (existingDomain == null) {
8083
// Verify the user doesn't have more emails with that domain
81-
List<EmailEntity> existingEmails = emailDaoReadOnly.findByOrcid(orcid, System.currentTimeMillis());
82-
if(existingEmails != null && existingEmails.size() > 1) {
83-
for(EmailEntity emailEntity : existingEmails) {
84-
//If it is not the same emails that is being verified and it is verified
85-
if(!email.equals(emailEntity.getEmail()) && emailEntity.getVerified()) {
86-
try {
87-
String emailEntityDomain = (emailEntity.getEmail() == null) ? null : (email.split("@")[1]);
88-
// If one of the existing emails have the same domain as the email being verified check the visibility and select the less restrictive
89-
if(domain.equals(emailEntityDomain)){
90-
String entityVisibility = emailEntity.getVisibility();
91-
domainVisibility = getLessRestrictiveVisibility(domainVisibility, entityVisibility);
92-
}
93-
} catch (Exception e) {
94-
LOGGER.warn("Could not get email domain from email entity " + emailEntity.getEmail(), e);
95-
}
96-
}
97-
}
98-
}
84+
ProfileEntity profile = profileEntityCacheManager.retrieve(orcid);
85+
String domainVisibility = profile.getActivitiesVisibilityDefault();
9986
profileEmailDomainDao.addEmailDomain(orcid, domain, domainVisibility);
10087
}
10188
}
10289
}
103-
104-
private String getLessRestrictiveVisibility(String a, String b) {
105-
String visibility = DEFAULT_DOMAIN_VISIBILITY;
106-
if(Visibility.PUBLIC.name().equals(a) || Visibility.PUBLIC.name().equals(b)) {
107-
visibility = Visibility.PUBLIC.name();
108-
} else if(a.equals(b)) {
109-
visibility = a;
110-
} else if(Visibility.PRIVATE.name().equals(a)) {
111-
visibility = b;
112-
} else if(Visibility.PRIVATE.name().equals(b)) {
113-
visibility = a;
114-
}
115-
return visibility;
116-
}
11790
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
package org.orcid.core.model;
2+
3+
import java.util.Objects;
4+
5+
import javax.xml.bind.annotation.XmlAccessType;
6+
import javax.xml.bind.annotation.XmlAccessorType;
7+
import javax.xml.bind.annotation.XmlElement;
8+
import javax.xml.bind.annotation.XmlRootElement;
9+
import javax.xml.bind.annotation.XmlType;
10+
11+
import org.orcid.jaxb.model.v3.release.common.FuzzyDate;
12+
13+
import io.swagger.v3.oas.annotations.media.Schema;
14+
15+
@XmlAccessorType(XmlAccessType.FIELD)
16+
@XmlType(propOrder = { "putCode", "type", "organizationName", "role", "url", "startDate", "endDate", "validated" })
17+
@XmlRootElement(name = "education-qualification", namespace = "http://www.orcid.org/ns/summary")
18+
@Schema(description = "Education Qualification")
19+
public class EducationQualification {
20+
@XmlElement(name = "put-code", namespace = "http://www.orcid.org/ns/summary")
21+
protected Long putCode;
22+
@XmlElement(name = "start-date", namespace = "http://www.orcid.org/ns/common")
23+
protected FuzzyDate startDate;
24+
@XmlElement(name = "end-date", namespace = "http://www.orcid.org/ns/common")
25+
protected FuzzyDate endDate;
26+
@XmlElement(name = "type", namespace = "http://www.orcid.org/ns/summary")
27+
protected String type;
28+
@XmlElement(name = "organization-name", namespace = "http://www.orcid.org/ns/summary")
29+
protected String organizationName;
30+
@XmlElement(name = "role", namespace = "http://www.orcid.org/ns/summary")
31+
protected String role;
32+
@XmlElement(name = "url", namespace = "http://www.orcid.org/ns/summary")
33+
protected String url;
34+
@XmlElement(name = "validated", namespace = "http://www.orcid.org/ns/summary")
35+
protected boolean validated;
36+
37+
public Long getPutCode() {
38+
return putCode;
39+
}
40+
41+
public void setPutCode(Long putCode) {
42+
this.putCode = putCode;
43+
}
44+
45+
public FuzzyDate getStartDate() {
46+
return startDate;
47+
}
48+
49+
public void setStartDate(FuzzyDate startDate) {
50+
this.startDate = startDate;
51+
}
52+
53+
public FuzzyDate getEndDate() {
54+
return endDate;
55+
}
56+
57+
public void setEndDate(FuzzyDate endDate) {
58+
this.endDate = endDate;
59+
}
60+
61+
public String getType() {
62+
return type;
63+
}
64+
65+
public void setType(String type) {
66+
this.type = type;
67+
}
68+
69+
public String getOrganizationName() {
70+
return organizationName;
71+
}
72+
73+
public void setOrganizationName(String organizationName) {
74+
this.organizationName = organizationName;
75+
}
76+
77+
public String getRole() {
78+
return role;
79+
}
80+
81+
public void setRole(String role) {
82+
this.role = role;
83+
}
84+
85+
public String getUrl() {
86+
return url;
87+
}
88+
89+
public void setUrl(String url) {
90+
this.url = url;
91+
}
92+
93+
public boolean isValidated() {
94+
return validated;
95+
}
96+
97+
public void setValidated(boolean validated) {
98+
this.validated = validated;
99+
}
100+
101+
@Override
102+
public int hashCode() {
103+
return Objects.hash(endDate, organizationName, putCode, role, startDate, type, url, validated);
104+
}
105+
106+
@Override
107+
public boolean equals(Object obj) {
108+
if (this == obj)
109+
return true;
110+
if (obj == null)
111+
return false;
112+
if (getClass() != obj.getClass())
113+
return false;
114+
EducationQualification other = (EducationQualification) obj;
115+
return Objects.equals(endDate, other.endDate) && Objects.equals(organizationName, other.organizationName) && Objects.equals(putCode, other.putCode)
116+
&& Objects.equals(role, other.role) && Objects.equals(startDate, other.startDate) && Objects.equals(type, other.type) && Objects.equals(url, other.url)
117+
&& validated == other.validated;
118+
}
119+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
package org.orcid.core.model;
2+
3+
import java.io.Serializable;
4+
import java.util.List;
5+
import java.util.Objects;
6+
7+
import javax.xml.bind.annotation.XmlAccessType;
8+
import javax.xml.bind.annotation.XmlAccessorType;
9+
import javax.xml.bind.annotation.XmlElement;
10+
import javax.xml.bind.annotation.XmlRootElement;
11+
import javax.xml.bind.annotation.XmlType;
12+
13+
import io.swagger.v3.oas.annotations.media.Schema;
14+
15+
@XmlAccessorType(XmlAccessType.FIELD)
16+
@XmlType(propOrder = { "count", "educationQualifications" })
17+
@XmlRootElement(name = "education-qualifications", namespace = "http://www.orcid.org/ns/summary")
18+
@Schema(description = "Education qualifications list")
19+
public class EducationQualifications implements Serializable {
20+
/**
21+
*
22+
*/
23+
private static final long serialVersionUID = 1L;
24+
@XmlElement(name = "count", namespace = "http://www.orcid.org/ns/summary")
25+
private Integer count;
26+
@XmlElement(name = "education-qualification", namespace = "http://www.orcid.org/ns/summary")
27+
private List<EducationQualification> educationQualifications;
28+
29+
public Integer getCount() {
30+
return count;
31+
}
32+
33+
public void setCount(Integer count) {
34+
this.count = count;
35+
}
36+
37+
public List<EducationQualification> getEducationQualifications() {
38+
return educationQualifications;
39+
}
40+
41+
public void setEducationQualifications(List<EducationQualification> educationQualifications ) {
42+
this.educationQualifications = educationQualifications ;
43+
}
44+
45+
@Override
46+
public int hashCode() {
47+
return Objects.hash(count, educationQualifications);
48+
}
49+
50+
@Override
51+
public boolean equals(Object obj) {
52+
if (this == obj)
53+
return true;
54+
if (obj == null)
55+
return false;
56+
if (getClass() != obj.getClass())
57+
return false;
58+
EducationQualifications other = (EducationQualifications) obj;
59+
return Objects.equals(count, other.count) && Objects.equals(educationQualifications, other.educationQualifications);
60+
}
61+
62+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
package org.orcid.core.model;
2+
3+
import java.util.Objects;
4+
5+
import javax.xml.bind.annotation.XmlAccessType;
6+
import javax.xml.bind.annotation.XmlAccessorType;
7+
import javax.xml.bind.annotation.XmlElement;
8+
import javax.xml.bind.annotation.XmlRootElement;
9+
import javax.xml.bind.annotation.XmlType;
10+
11+
import org.orcid.jaxb.model.v3.release.common.FuzzyDate;
12+
import org.orcid.pojo.ajaxForm.Date;
13+
14+
import io.swagger.v3.oas.annotations.media.Schema;
15+
16+
@XmlAccessorType(XmlAccessType.FIELD)
17+
@XmlType(propOrder = { "value","createdDate", "lastModified"})
18+
@XmlRootElement(name = "education-qualification", namespace = "http://www.orcid.org/ns/summary")
19+
@Schema(description = "Education Qualification")
20+
public class EmailDomain {
21+
@XmlElement(name = "value", namespace = "http://www.orcid.org/ns/summary")
22+
protected String value;
23+
@XmlElement(name = "created-date", namespace = "http://www.orcid.org/ns/common")
24+
protected Date createdDate;
25+
@XmlElement(name = "last-modified-date", namespace = "http://www.orcid.org/ns/common")
26+
protected Date lastModified;
27+
28+
public String getValue() {
29+
return value;
30+
}
31+
32+
public void setValue(String value) {
33+
this.value = value;
34+
}
35+
36+
public Date getCreatedDate() {
37+
return createdDate;
38+
}
39+
40+
public void setCreatedDate(Date createdDate) {
41+
this.createdDate = createdDate;
42+
}
43+
44+
public Date getLastModified() {
45+
return lastModified;
46+
}
47+
48+
public void setLastModified(Date lastModified) {
49+
this.lastModified = lastModified;
50+
}
51+
52+
@Override
53+
public int hashCode() {
54+
return Objects.hash(value, createdDate, lastModified);
55+
}
56+
57+
@Override
58+
public boolean equals(Object obj) {
59+
if (this == obj)
60+
return true;
61+
if (obj == null)
62+
return false;
63+
if (getClass() != obj.getClass())
64+
return false;
65+
EmailDomain other = (EmailDomain) obj;
66+
return Objects.equals(createdDate, other.createdDate) && Objects.equals(lastModified, other.lastModified) && Objects.equals(value, other.value);
67+
}
68+
}

0 commit comments

Comments
 (0)