Compare commits

...

2 Commits

Author SHA1 Message Date
Konstantinos Spyrou 19923c19fc refactoring 2023-01-31 14:51:34 +02:00
Konstantinos Spyrou 1a3399f7d7 changed level in verbose logs 2023-01-31 14:35:48 +02:00
3 changed files with 429 additions and 551 deletions

View File

@ -18,7 +18,10 @@ import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Component;
import java.util.*;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.stream.Collectors;
@Component("emailUtils")
@ -50,8 +53,6 @@ public class EmailUtilsImpl implements EmailUtils {
@Override
public void sendAdministratorRequestToEnableMetrics(PiwikInfo piwikInfo) {
try {
String subject = "[OpenAIRE-Usage Statistics] New request to enable usage statistics";
String message =
@ -67,16 +68,10 @@ public class EmailUtilsImpl implements EmailUtils {
message = createAdminMail(message);
this.sendMail(this.usageStatsAdminEmail, subject, message);
} catch (Exception e) {
logger.error("Error while sending request to enable metrics email to administrator: " + this.usageStatsAdminEmail, e);
}
}
@Override
public void sendUserRequestToEnableMetrics(PiwikInfo piwikInfo) {
try {
String subject = "[OpenAIRE-Usage Statistics] Your request to enable usage statistics";
String message = "Dear " + piwikInfo.getRequestorName() + ",\n" +
@ -103,16 +98,10 @@ public class EmailUtilsImpl implements EmailUtils {
"The OpenAIRE team";
this.sendMail(piwikInfo.getRequestorEmail(), subject, message);
} catch (Exception e) {
logger.error("Error while sending request to enable metrics email to user: " + piwikInfo.getRequestorEmail(), e);
}
}
@Override
public void sendAdministratorMetricsEnabled(PiwikInfo piwikInfo) {
try {
String subject = "[OpenAIRE-Usage Statistics] Usage statistics have been enabled";
String message =
@ -126,16 +115,10 @@ public class EmailUtilsImpl implements EmailUtils {
message = createAdminMail(message);
this.sendMail(this.usageStatsAdminEmail, subject, message);
} catch (Exception e) {
logger.error("Error while sending metrics enabled notification email to administator: " + this.usageStatsAdminEmail, e);
}
}
@Override
public void sendUserMetricsEnabled(PiwikInfo piwikInfo) {
try {
String subject = "[OpenAIRE-Usage Statistics] Usage statistics have been enabled";
String message = "Dear " + piwikInfo.getRequestorName() + ",\n" +
@ -153,15 +136,10 @@ public class EmailUtilsImpl implements EmailUtils {
"The OpenAIRE team";
this.sendMail(piwikInfo.getRequestorEmail(), subject, message);
} catch (Exception e) {
logger.error("Error while sending metrics enabled notification email to user: " + piwikInfo.getRequestorEmail(), e);
}
}
@Override
public void sendAdminRegistrationEmail(Repository repository, Authentication authentication) {
try {
String subject = "OpenAIRE content provider registration for " +
repository.getEoscDatasourceType() + "[" + repository.getOfficialname() + "]";
@ -176,15 +154,10 @@ public class EmailUtilsImpl implements EmailUtils {
message = createAdminMail(message);
this.sendMail(this.provideAdminEmail, subject, message);
} catch (Exception e) {
logger.error("Error while sending registration notification email to the administrator", e);
}
}
@Override
public void sendUserRegistrationEmail(Repository repository, Authentication authentication) {
try {
String subject = "OpenAIRE content provider registration for " +
repository.getEoscDatasourceType() + "[" + repository.getOfficialname() + "]";
@ -197,16 +170,16 @@ public class EmailUtilsImpl implements EmailUtils {
"If you have any questions, write to 'helpdesk@openaire.eu'.";
message = createUserMail(message, authentication);
this.sendMail(repository.getRegisteredby(), subject, message);
} catch (Exception e) {
logger.error("Error while sending registration notification email to user: " + repository.getRegisteredby(), e);
Collection<String> emailTo = new HashSet<>();
if (repository.getRegisteredby() != null) {
emailTo.add(repository.getRegisteredby());
}
emailTo.add(User.from(((OIDCAuthenticationToken) authentication).getUserInfo()).getEmail());
this.sendMail(emailTo, subject, message);
}
@Override
public void sendAdminRegisterInterfaceEmail(Repository repository, String comment, RepositoryInterface repositoryInterface, String desiredCompatibility, Authentication authentication) {
try {
String subject = "OpenAIRE new interface registration request started for " +
repository.getEoscDatasourceType() + "[" + repository.getOfficialname() + "]";
@ -214,7 +187,7 @@ public class EmailUtilsImpl implements EmailUtils {
"We received a request to add the following interface: \n\n" +
"Base URL: " + repositoryInterface.getBaseurl() + "\n" +
"Set: " + repositoryInterface.getAccessSet() + "\n" +
"Selected Guidelines: " + desiredCompatibility != null ? desiredCompatibility : repositoryInterface.getCompatibilityOverride() + "\n\n" +
"Selected Guidelines: " + getSelectedGuidelines(desiredCompatibility, repositoryInterface) + "\n\n" +
"to " + repository.getEoscDatasourceType() + "[" + repository.getOfficialname() + "].\n";
if (comment != null)
@ -230,22 +203,17 @@ public class EmailUtilsImpl implements EmailUtils {
message = createAdminMail(message);
this.sendMail(this.provideAdminEmail, subject, message);
} catch (Exception e) {
logger.error("Error while sending registration of interface notification email to the administrator", e);
}
}
@Override
public void sendUserRegisterInterfaceEmail(Repository repository, String comment, RepositoryInterface repositoryInterface, String desiredCompatibility, Authentication authentication) {
try {
String subject = "OpenAIRE new interface registration request started for " +
repository.getEoscDatasourceType() + "[" + repository.getOfficialname() + "]";
String message =
"We received a request to add the following interface: \n\n" +
"Base URL: " + repositoryInterface.getBaseurl() + "\n" +
"Set: " + repositoryInterface.getAccessSet() + "\n" +
"Selected Guidelines: " + desiredCompatibility != null ? desiredCompatibility : repositoryInterface.getCompatibilityOverride() + "\n\n" +
"Selected Guidelines: " + getSelectedGuidelines(desiredCompatibility, repositoryInterface) + "\n\n" +
"to " + repository.getEoscDatasourceType() + "[" + repository.getOfficialname() + "].\n";
if (comment != null) {
@ -265,15 +233,10 @@ public class EmailUtilsImpl implements EmailUtils {
}
emailTo.add(User.from(((OIDCAuthenticationToken) authentication).getUserInfo()).getEmail());
this.sendMail(emailTo, subject, message);
} catch (Exception e) {
logger.error("Error while sending registration of interface notification email to user: " + repository.getRegisteredby(), e);
}
}
@Override
public void sendUserRegistrationResultsSuccessEmail(String issuerEmail, String jobId, RepositoryInterface repositoryInterface, String desiredCompatibility, Repository repository, Authentication authentication) {
try {
String subject = "OpenAIRE new interface registration request - results (success) for " +
repository.getEoscDatasourceType() + "[" + repository.getOfficialname() + "]";
@ -286,7 +249,7 @@ public class EmailUtilsImpl implements EmailUtils {
"\nOfficial Name:" + repository.getOfficialname() +
"\n\nBase URL: " + repositoryInterface.getBaseurl() +
"\n\nSet: " + repositoryInterface.getAccessSet() +
"\n\nSelected Guidelines: " + desiredCompatibility != null ? desiredCompatibility : repositoryInterface.getCompatibilityOverride() +
"\n\nSelected Guidelines: " + getSelectedGuidelines(desiredCompatibility, repositoryInterface) +
"\n\nYou can review the validation results here.\n" + valBaseUrl + "" + jobId +
"\n\n\nPlease do not reply to this email\n" +
"This message has been generated manually\n\n" +
@ -299,15 +262,10 @@ public class EmailUtilsImpl implements EmailUtils {
}
emailTo.add(User.from(((OIDCAuthenticationToken) authentication).getUserInfo()).getEmail());
this.sendMail(emailTo, subject, message);
} catch (Exception e) {
logger.error("Error while sending registration notification email to user: " + repository.getRegisteredby(), e);
}
}
@Override
public void sendAdminRegistrationResultsSuccessEmail(String issuerEmail, String jobId, RepositoryInterface repositoryInterface, String desiredCompatibility, Repository repository, Authentication authentication) {
try {
String subject = "OpenAIRE new interface registration request - results (success) for " +
repository.getEoscDatasourceType() + "[" + repository.getOfficialname() + "]";
@ -320,7 +278,7 @@ public class EmailUtilsImpl implements EmailUtils {
"\nOfficial Name:" + repository.getOfficialname() +
"\n\nBase URL: " + repositoryInterface.getBaseurl() +
"\n\nSet: " + repositoryInterface.getAccessSet() +
"\n\nDesired Selected Guidelines: " + desiredCompatibility != null ? desiredCompatibility : repositoryInterface.getCompatibilityOverride() +
"\n\nDesired Selected Guidelines: " + getSelectedGuidelines(desiredCompatibility, repositoryInterface) +
"\n\nUser Contact:" + issuerEmail + "" +
"\n\nYou can review the validation results here.\n" + valBaseUrl + "" + jobId +
"\n\n\nPlease do not reply to this email\n" +
@ -329,15 +287,10 @@ public class EmailUtilsImpl implements EmailUtils {
message = createAdminMail(message);
this.sendMail(this.provideAdminEmail, subject, message);
} catch (Exception e) {
logger.error("Error while sending registration notification email to user: " + repository.getRegisteredby(), e);
}
}
@Override
public void sendUserRegistrationResultsFailureEmail(String jobId, RepositoryInterface repositoryInterface, String desiredCompatibility, Repository repository, Authentication authentication) {
try {
String subject = "OpenAIRE new interface registration request - results (failure) for " +
repository.getEoscDatasourceType() + "[" + repository.getOfficialname() + "]";
String message =
@ -349,7 +302,7 @@ public class EmailUtilsImpl implements EmailUtils {
"\nOfficial Name:" + repository.getOfficialname() +
"\n\nBase URL: " + repositoryInterface.getBaseurl() +
"\n\nSet: " + repositoryInterface.getAccessSet() +
"\n\nSelected Guidelines: " + desiredCompatibility != null ? desiredCompatibility : repositoryInterface.getCompatibilityOverride() +
"\n\nSelected Guidelines: " + getSelectedGuidelines(desiredCompatibility, repositoryInterface) +
"\n\nYou can review the validation results here.\n" + valBaseUrl + "" + jobId +
"\n\n\nPlease do not reply to this email\n" +
"This message has been generated manually\n\n" +
@ -362,15 +315,10 @@ public class EmailUtilsImpl implements EmailUtils {
}
emailTo.add(User.from(((OIDCAuthenticationToken) authentication).getUserInfo()).getEmail());
this.sendMail(emailTo, subject, message);
} catch (Exception e) {
logger.error("Error while sending registration notification email to user: " + repository.getRegisteredby(), e);
}
}
@Override
public void sendAdminRegistrationResultsFailureEmail(String issuerEmail, String jobId, RepositoryInterface repositoryInterface, String desiredCompatibility, Repository repository, Authentication authentication) {
try {
String subject = "OpenAIRE new interface registration request - results (failure) for " +
repository.getEoscDatasourceType() + "[" + repository.getOfficialname() + "]";
@ -383,7 +331,7 @@ public class EmailUtilsImpl implements EmailUtils {
"\nOfficial Name:" + repository.getOfficialname() +
"\n\nBase URL: " + repositoryInterface.getBaseurl() +
"\n\nSet: " + repositoryInterface.getAccessSet() +
"\n\nSelected Guidelines: " + desiredCompatibility != null ? desiredCompatibility : repositoryInterface.getCompatibilityOverride() +
"\n\nSelected Guidelines: " + getSelectedGuidelines(desiredCompatibility, repositoryInterface) +
"\n\nUser Contact:" + issuerEmail + "" +
"\n\nYou can review the validation results here.\n" + valBaseUrl + "" + jobId +
"\n\n\nPlease do not reply to this email\n" +
@ -392,15 +340,10 @@ public class EmailUtilsImpl implements EmailUtils {
message = createAdminMail(message);
this.sendMail(this.provideAdminEmail, subject, message);
} catch (Exception e) {
logger.error("Error while sending registration notification email to user: " + repository.getRegisteredby(), e);
}
}
@Override
public void sendUserUpdateResultsSuccessEmail(String issuer, String jobId, RepositoryInterface repositoryInterface, String desiredCompatibility, Repository repository, Authentication authentication) {
try {
String subject = "OpenAIRE interface update request - results (success) for " +
repository.getEoscDatasourceType() + "[" + repository.getOfficialname() + "]";
@ -411,7 +354,7 @@ public class EmailUtilsImpl implements EmailUtils {
"\nOfficial Name:" + repository.getOfficialname() +
"\n\nBase URL: " + repositoryInterface.getBaseurl() +
"\n\nSet: " + repositoryInterface.getAccessSet() +
"\n\nSelected Guidelines: " + desiredCompatibility != null ? desiredCompatibility : repositoryInterface.getCompatibilityOverride() +
"\n\nSelected Guidelines: " + getSelectedGuidelines(desiredCompatibility, repositoryInterface) +
"\n\nYou can review the validation results here.\n" + valBaseUrl + "" + jobId +
"\n\n\nPlease do not reply to this email\n" +
"This message has been generated manually\n\n" +
@ -419,15 +362,10 @@ public class EmailUtilsImpl implements EmailUtils {
message = createUserMail(message, authentication);
this.sendMail(issuer, subject, message);
} catch (Exception e) {
logger.error("Error while sending registration notification email to the administrator", e);
}
}
@Override
public void sendAdminUpdateResultsSuccessEmail(String issuerEmail, String jobId, RepositoryInterface repositoryInterface, String desiredCompatibility, Repository repository, Authentication authentication) {
try {
String subject = "OpenAIRE interface update request - results (success) for " +
repository.getEoscDatasourceType() + "[" + repository.getOfficialname() + "]";
@ -438,7 +376,7 @@ public class EmailUtilsImpl implements EmailUtils {
"\nOfficial Name:" + repository.getOfficialname() +
"\n\nBase URL: " + repositoryInterface.getBaseurl() +
"\n\nSet: " + repositoryInterface.getAccessSet() +
"\n\nSelected Guidelines: " + desiredCompatibility != null ? desiredCompatibility : repositoryInterface.getCompatibilityOverride() +
"\n\nSelected Guidelines: " + getSelectedGuidelines(desiredCompatibility, repositoryInterface) +
"\n\nUser Contact:" + issuerEmail + "" +
"\n\nYou can review the validation results here.\n" + valBaseUrl + "" + jobId +
"\n\n\nPlease do not reply to this email\n" +
@ -447,28 +385,22 @@ public class EmailUtilsImpl implements EmailUtils {
message = createAdminMail(message);
this.sendMail(this.provideAdminEmail, subject, message);
} catch (Exception e) {
logger.error("Error while sending registration notification email to the administrator", e);
}
}
@Override
public void sendUserUpdateResultsFailureEmail(String issuer, String jobId, RepositoryInterface repositoryInterface, String desiredCompatibility, Repository repository, Authentication authentication) {
try {
String subject = "OpenAIRE interface update request - results (failure) for " +
repository.getEoscDatasourceType() + "[" + repository.getOfficialname() + "]";
String message =
"the compatibility test on " + "[" + repository.getOfficialname() + "]" +
" was not successful." +
"the compatibility test on [" + repository.getOfficialname() + "] was not successful." +
"\n\n" +
"WWe will check your transmitted information to see what caused the problem and get back to you within a couple of days.\n\n" +
"We will check your transmitted information to see what caused the problem and get back to you within a couple of days.\n\n" +
"Registration identifier in OpenAIRE: " + repository.getNamespaceprefix() +
"\nOfficial Name:" + repository.getOfficialname() +
"\n\nBase URL: " + repositoryInterface.getBaseurl() +
"\n\nSet: " + repositoryInterface.getAccessSet() +
"\n\nSelected Guidelines: " + desiredCompatibility != null ? desiredCompatibility : repositoryInterface.getCompatibilityOverride() +
"\n\nSelected Guidelines: " + getSelectedGuidelines(desiredCompatibility, repositoryInterface) +
"\n\nYou can review the validation results here.\n" + valBaseUrl + "" + jobId +
"\n\n\nPlease do not reply to this email\n" +
"This message has been generated manually\n\n" +
@ -476,15 +408,10 @@ public class EmailUtilsImpl implements EmailUtils {
message = createUserMail(message, authentication);
this.sendMail(issuer, subject, message);
} catch (Exception e) {
logger.error("Error while sending registration notification email to user: " + repository.getRegisteredby(), e);
}
}
@Override
public void sendAdminUpdateResultsFailureEmail(String issuerEmail, String jobId, RepositoryInterface repositoryInterface, String desiredCompatibility, Repository repository, Authentication authentication) {
try {
String subject = "OpenAIRE interface update request - results (failure) for " +
repository.getEoscDatasourceType() + "[" + repository.getOfficialname() + "]";
@ -497,7 +424,7 @@ public class EmailUtilsImpl implements EmailUtils {
"\nOfficial Name:" + repository.getOfficialname() +
"\n\nBase URL: " + repositoryInterface.getBaseurl() +
"\n\nSet: " + repositoryInterface.getAccessSet() +
"\n\nSelected Guidelines: " + desiredCompatibility != null ? desiredCompatibility : repositoryInterface.getCompatibilityOverride() +
"\n\nSelected Guidelines: " + getSelectedGuidelines(desiredCompatibility, repositoryInterface) +
"\n\nUser Contact:" + issuerEmail + "" +
"\n\nYou can review the validation results here.\n" + valBaseUrl + "" + jobId +
"\n\n\nPlease do not reply to this email\n" +
@ -506,15 +433,10 @@ public class EmailUtilsImpl implements EmailUtils {
message = createAdminMail(message);
this.sendMail(this.provideAdminEmail, subject, message);
} catch (Exception e) {
logger.error("Error while sending registration notification email to user: " + repository.getRegisteredby(), e);
}
}
@Override
public void sendUserUpdateInterfaceComplianceFailure(List<String> emails, Repository repository, RepositoryInterface repositoryInterface, InterfaceComplianceRequest request) {
try {
String subject = "OpenAIRE interface update compliance request - results (failure) for " +
repository.getEoscDatasourceType() + "[" + repository.getOfficialname() + "]";
@ -534,15 +456,10 @@ public class EmailUtilsImpl implements EmailUtils {
message = createRepoAdminsMail(message);
this.sendMail(emails, subject, message);
} catch (Exception e) {
logger.error("Notification email to repository admins failed.\nRepository: {}\nRequest: {}", repository, request, e);
}
}
@Override
public void sendAdminUpdateInterfaceComplianceFailure(Repository repository, RepositoryInterface repositoryInterface, InterfaceComplianceRequest request) {
try {
String subject = "OpenAIRE interface update compliance request - results (failure) for " +
repository.getEoscDatasourceType() + "[" + repository.getOfficialname() + "]";
@ -562,15 +479,10 @@ public class EmailUtilsImpl implements EmailUtils {
message = createAdminMail(message);
this.sendMail(this.provideAdminEmail, subject, message);
} catch (Exception e) {
logger.error("Error while sending registration notification email to user: " + repository.getRegisteredby(), e);
}
}
@Override
public void sendUserValidationResults(String issuer, String jobId, RepositoryInterface repositoryInterface, Repository repository, Authentication authentication) {
try {
String subject = "OpenAIRE validator - Test results ";
String message =
@ -581,20 +493,16 @@ public class EmailUtilsImpl implements EmailUtils {
message = createUserMail(message, authentication);
Collection<String> emailTo = new HashSet<>();
emailTo.add(issuer);
if (repository.getRegisteredby() != null) {
emailTo.add(repository.getRegisteredby());
}
emailTo.add(User.from(((OIDCAuthenticationToken) authentication).getUserInfo()).getEmail());
this.sendMail(emailTo, subject, message);
} catch (Exception e) {
logger.error("Error while sending validation submission notification email to user: " + issuer, e);
}
}
@Override
public void sendAdminValidationResults(String issuer, String jobId, RepositoryInterface repositoryInterface, Repository repository, Authentication authentication) {
try {
String subject = "OpenAIRE validator - Test results ";
String message =
@ -606,15 +514,10 @@ public class EmailUtilsImpl implements EmailUtils {
message = createAdminMail(message);
this.sendMail(this.provideAdminEmail, subject, message);
} catch (Exception e) {
logger.error("Error while sending validation submission notification email to user: " + issuer, e);
}
}
@Override
public void sendAdminGeneralFailure(String issuer, String jobId, RepositoryInterface repositoryInterface, Repository repository, Authentication authentication) {
try {
String subject = "OpenAIRE validator - job failure";
String message =
@ -626,15 +529,10 @@ public class EmailUtilsImpl implements EmailUtils {
message = createAdminMail(message);
this.sendMail(this.provideAdminEmail, subject, message);
} catch (Exception e) {
logger.error("Error while sending validation submission notification email to user: " + issuer, e);
}
}
@Override
public void sendAdminUpdateRepositoryInfoEmail(Repository repository, Authentication authentication) {
try {
String subject = "OpenAIRE content provider update information for " +
repository.getEoscDatasourceType() + "[" + repository.getOfficialname() + "]";
@ -646,15 +544,10 @@ public class EmailUtilsImpl implements EmailUtils {
message = createAdminMail(message);
this.sendMail(this.provideAdminEmail, subject, message);
} catch (Exception e) {
logger.error("Error while sending registration notification email to the administrator", e);
}
}
@Override
public void sendUserUpdateRepositoryInfoEmail(Repository repository, Authentication authentication) {
try {
String subject = "OpenAIRE content provider update information for " +
repository.getEoscDatasourceType() + "[" + repository.getOfficialname() + "]";
@ -671,15 +564,10 @@ public class EmailUtilsImpl implements EmailUtils {
}
emailTo.add(User.from(((OIDCAuthenticationToken) authentication).getUserInfo()).getEmail());
this.sendMail(emailTo, subject, message);
} catch (Exception e) {
logger.error("Error while sending registration notification email to user: " + repository.getRegisteredby(), e);
}
}
@Override
public void sendAdminUpdateInterfaceEmail(Repository repository, String comment, RepositoryInterface repositoryInterface, String desiredCompatibility, Authentication authentication) {
try {
String subject = "OpenAIRE interface update request started for " +
repository.getEoscDatasourceType() + "[" + repository.getOfficialname() + "]";
@ -687,7 +575,7 @@ public class EmailUtilsImpl implements EmailUtils {
"We received a request to update the following interface: \n\n" +
"Base URL: " + repositoryInterface.getBaseurl() + "\n" +
"Set: " + repositoryInterface.getAccessSet() + "\n" +
"Selected Guidelines: " + desiredCompatibility != null ? desiredCompatibility : repositoryInterface.getCompatibilityOverride() + "\n\n" +
"Selected Guidelines: " + getSelectedGuidelines(desiredCompatibility, repositoryInterface) + "\n\n" +
"for " + repository.getEoscDatasourceType() + "[" + repository.getOfficialname() + "].\n";
if (comment != null)
@ -701,15 +589,10 @@ public class EmailUtilsImpl implements EmailUtils {
message = createAdminMail(message);
this.sendMail(this.provideAdminEmail, subject, message);
} catch (Exception e) {
logger.error("Error while sending registration notification email to the administrator", e);
}
}
@Override
public void sendUserUpdateInterfaceEmail(Repository repository, String comment, RepositoryInterface repositoryInterface, String desiredCompatibility, Authentication authentication) {
try {
String subject = "OpenAIRE interface update request started for " +
repository.getEoscDatasourceType() + "[" + repository.getOfficialname() + "]";
@ -717,7 +600,7 @@ public class EmailUtilsImpl implements EmailUtils {
"We received a request to update the following interface: \n\n" +
"Base URL: " + repositoryInterface.getBaseurl() + "\n" +
"Set: " + repositoryInterface.getAccessSet() + "\n" +
"Selected Guidelines: " + desiredCompatibility != null ? desiredCompatibility : repositoryInterface.getCompatibilityOverride() + "\n\n" +
"Selected Guidelines: " + getSelectedGuidelines(desiredCompatibility, repositoryInterface) + "\n\n" +
"for " + repository.getEoscDatasourceType() + "[" + repository.getOfficialname() + "].\n";
if (comment != null) {
@ -736,15 +619,10 @@ public class EmailUtilsImpl implements EmailUtils {
}
emailTo.add(User.from(((OIDCAuthenticationToken) authentication).getUserInfo()).getEmail());
this.sendMail(emailTo, subject, message);
} catch (Exception e) {
logger.error("Error while sending registration notification email to user: " + repository.getRegisteredby(), e);
}
}
@Override
public void sendSubmitJobForValidationEmail(Authentication authentication, JobForValidation jobForValidation) {
try {
String subject = "OpenAIRE validator - Test submission ";
String message =
@ -755,10 +633,6 @@ public class EmailUtilsImpl implements EmailUtils {
message = createUserMail(message, authentication);
this.sendMail(jobForValidation.getUserEmail(), subject, message);
} catch (Exception e) {
logger.error("Error while sending validation submission notification email to user: " + jobForValidation.getUserEmail(), e);
}
}
@Override
@ -848,4 +722,8 @@ public class EmailUtilsImpl implements EmailUtils {
}
return user; // It may be just "user". TODO - Wouldn't be better if it was null?
}
private String getSelectedGuidelines(String desiredCompatibility, RepositoryInterface repositoryInterface) {
return desiredCompatibility != null ? desiredCompatibility : repositoryInterface.getCompatibilityOverride();
}
}

View File

@ -217,8 +217,8 @@ public class RepositoryServiceImpl implements RepositoryService {
resultSet = objectMapper.readValue(objectMapper.writeValueAsString(datasourceDetailsList),
objectMapper.getTypeFactory().constructCollectionType(List.class, RepositorySnippet.class));
if (logger.isDebugEnabled()) {
logger.debug("resultSet: {}", objectMapper.writeValueAsString(resultSet));
if (logger.isTraceEnabled()) {
logger.trace("resultSet: {}", objectMapper.writeValueAsString(resultSet));
}
resultSet.parallelStream().forEach(repositorySnippet -> {
repositorySnippet.setPiwikInfo(piWikService.getPiwikSiteForRepo(repositorySnippet.getId()));

View File

@ -131,8 +131,8 @@ public class AuthorizationServiceImpl implements AuthorizationService {
UserInfo userInfo = ((OIDCAuthenticationToken) SecurityContextHolder.getContext().getAuthentication()).getUserInfo();
roles = getUserRolesByEmail(userInfo.getEmail());
if (logger.isDebugEnabled()) {
logger.debug("User Roles: {}", String.join(",", roles));
if (logger.isTraceEnabled()) {
logger.trace("User Roles: {}", String.join(",", roles));
}
return roles;
}