Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Camelia-Orcid committed Nov 14, 2023
1 parent 05c8a6a commit c1bf046
Show file tree
Hide file tree
Showing 3 changed files with 127 additions and 125 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ public interface ProfileDao extends GenericDao<ProfileEntity, String> {
void updateLastModifiedDateAndIndexingStatusWithoutResult(String orcid, Date lastModified, IndexingStatus indexingStatus);

public List<Triple<String, Boolean, Date>> findEmailsUnverfiedDays(int daysUnverified, int maxResults);

public List<Triple<String, Boolean, String>> findEmailsUnverifiedDaysByEventType(int daysUnverified, int tooOldNumberOfDays);

String retrieveOrcidType(String orcid);

List<Object[]> findInfoForDecryptionAnalysis();
Expand Down Expand Up @@ -158,10 +158,10 @@ public interface ProfileDao extends GenericDao<ProfileEntity, String> {
public List<Object[]> getSigninLock(String orcid);

public void startSigninLock(String orcid);

public void resetSigninLock(String orcid);

public void updateSigninLock(String orcid, Integer count);

boolean haveMemberPushedWorksOrAffiliationsToRecord(String orcid, String clientId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
public class ProfileDaoImpl extends GenericDaoImpl<ProfileEntity, String> implements ProfileDao {

private static final String PRIVATE_VISIBILITY = "PRIVATE";

private static final Logger LOGGER = LoggerFactory.getLogger(ProfileDaoImpl.class);

@Value("${org.orcid.postgres.query.timeout:30000}")
Expand Down Expand Up @@ -155,9 +155,8 @@ public List<Triple<String, Boolean, Date>> findEmailsUnverfiedDays(int daysUnver
results.add(pair);
});
return results;
}


}

@SuppressWarnings("unchecked")
@Override
public List<Triple<String, Boolean, String>> findEmailsUnverifiedDaysByEventType(int daysUnverified, int tooOldNumberOfDays) {
Expand All @@ -166,8 +165,8 @@ public List<Triple<String, Boolean, String>> findEmailsUnverifiedDaysByEventType
queryString.append("JOIN profile p on p.orcid = e.orcid and p.claimed = true ");
queryString.append("AND p.deprecated_date is null AND p.profile_deactivation_date is null AND p.account_expiry is null ");
queryString.append("where e.is_verified = false ");
queryString.append("and e.date_created between (now() - CAST('").append(tooOldNumberOfDays)
.append("' AS INTERVAL DAY)) and (now() - CAST('").append(daysUnverified).append("' AS INTERVAL DAY)) ");
queryString.append("and e.date_created between (now() - CAST('").append(tooOldNumberOfDays).append("' AS INTERVAL DAY)) and (now() - CAST('")
.append(daysUnverified).append("' AS INTERVAL DAY)) ");
queryString.append("and e.date_created < (now() - CAST('").append(daysUnverified).append("' AS INTERVAL DAY)) ");
queryString.append("and (e.source_id = e.orcid OR e.source_id is null)");
queryString.append(" ORDER BY e.last_modified");
Expand All @@ -180,7 +179,7 @@ public List<Triple<String, Boolean, String>> findEmailsUnverifiedDaysByEventType
results.add(pair);
});
return results;
}
}

@SuppressWarnings("unchecked")
@Override
Expand Down Expand Up @@ -815,7 +814,7 @@ public void startSigninLock(String orcid) {
query.executeUpdate();
return;
}

@Override
@Transactional
public void resetSigninLock(String orcid) {
Expand All @@ -839,18 +838,18 @@ public void updateSigninLock(String orcid, Integer count) {
query.executeUpdate();
return;
}

public boolean haveMemberPushedWorksOrAffiliationsToRecord(String orcid, String clientId) {
try {
String queryString = "select p.orcid from profile p where p.orcid = :orcid and ( exists (select 1 from work w where w.orcid = p.orcid and w.client_source_id = :clientId) or exists (select 1 from org_affiliation_relation o where o.orcid = p.orcid and o.client_source_id = :clientId));";
Query query = entityManager.createNativeQuery(queryString);
query.setParameter("orcid", orcid);
query.setParameter("clientId", clientId);
String result = (String) query.getSingleResult();
if(orcid.equals(result)) {
if (orcid.equals(result)) {
return true;
}
} catch(NoResultException nre) {
}
} catch (NoResultException nre) {
return false;
}
return false;
Expand Down
Loading

0 comments on commit c1bf046

Please sign in to comment.