no message
parent
52bceed971
commit
8cb464c1e9
@ -0,0 +1,38 @@
|
||||
package eu.eudat.controllers.controllerhandler;
|
||||
|
||||
import eu.eudat.models.helpers.responses.ResponseItem;
|
||||
import eu.eudat.services.ApiContext;
|
||||
import eu.eudat.types.ApiMessageCode;
|
||||
import eu.eudat.types.WarningLevel;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||
import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* Created by ikalyvas on 3/1/2018.
|
||||
*/
|
||||
@ControllerAdvice
|
||||
public class GeneralErrorHandler extends ResponseEntityExceptionHandler {
|
||||
|
||||
private ApiContext apiContext;
|
||||
|
||||
@Autowired
|
||||
public GeneralErrorHandler(ApiContext apiContext) {
|
||||
this.apiContext = apiContext;
|
||||
}
|
||||
|
||||
@ExceptionHandler(Exception.class)
|
||||
@ResponseStatus(HttpStatus.BAD_REQUEST)
|
||||
@ResponseBody
|
||||
public ResponseItem<?> processValidationError(HttpServletRequest req, Exception ex) {
|
||||
apiContext.getHelpersService().getLoggerService().log(ex.getMessage(), WarningLevel.ERROR);
|
||||
return new ResponseItem().status(ApiMessageCode.ERROR_MESSAGE).message(ex.getMessage());
|
||||
}
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package eu.eudat.controllers.interceptors;
|
||||
|
||||
import eu.eudat.services.helpers.LoggerService;
|
||||
import eu.eudat.types.WarningLevel;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Created by ikalyvas on 3/1/2018.
|
||||
*/
|
||||
@Component
|
||||
public class RequestInterceptor extends HandlerInterceptorAdapter {
|
||||
|
||||
private LoggerService loggerService;
|
||||
|
||||
@Autowired
|
||||
public RequestInterceptor(LoggerService loggerService) {
|
||||
this.loggerService = loggerService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request,
|
||||
HttpServletResponse response, Object handler) throws Exception {
|
||||
String reqUri = request.getRequestURI();
|
||||
this.loggerService.log("Call to " + reqUri + " method: " + request.getMethod() + " at: " + new Date(), WarningLevel.INFO);
|
||||
return super.preHandle(request, response, handler);
|
||||
}
|
||||
}
|
@ -1,23 +1,14 @@
|
||||
package eu.eudat.services;
|
||||
|
||||
import eu.eudat.builders.BuilderFactory;
|
||||
import eu.eudat.proxy.fetching.RemoteFetcher;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.MessageSource;
|
||||
|
||||
import eu.eudat.services.helpers.HelpersService;
|
||||
import eu.eudat.services.operations.OperationsContext;
|
||||
import eu.eudat.services.utilities.UtilitiesService;
|
||||
|
||||
public interface ApiContext {
|
||||
DatabaseRepository getDatabaseRepository();
|
||||
|
||||
ApplicationContext getApplicationContext();
|
||||
|
||||
InvitationService getInvitationService();
|
||||
|
||||
RemoteFetcher getRemoteFetcher();
|
||||
|
||||
MailService getMailService();
|
||||
HelpersService getHelpersService();
|
||||
|
||||
MessageSource getMessageSource();
|
||||
OperationsContext getOperationsContext();
|
||||
|
||||
BuilderFactory getBuilderFactory();
|
||||
UtilitiesService getUtilitiesService();
|
||||
}
|
||||
|
@ -1,91 +1,36 @@
|
||||
package eu.eudat.services;
|
||||
|
||||
import eu.eudat.builders.BuilderFactory;
|
||||
import eu.eudat.proxy.fetching.RemoteFetcher;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.MessageSource;
|
||||
import eu.eudat.services.helpers.HelpersService;
|
||||
import eu.eudat.services.operations.OperationsContext;
|
||||
import eu.eudat.services.utilities.UtilitiesService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
||||
@Service("apiContext")
|
||||
public class ApiContextImpl implements ApiContext {
|
||||
|
||||
private DatabaseRepository databaseRepository;
|
||||
private ApplicationContext applicationContext;
|
||||
private RemoteFetcher remoteFetcher;
|
||||
private InvitationService invitationService;
|
||||
private MailService mailService;
|
||||
private MessageSource messageSource;
|
||||
private BuilderFactory builderFactory;
|
||||
private OperationsContext operationsContext;
|
||||
private HelpersService helpersService;
|
||||
private UtilitiesService utilitiesService;
|
||||
|
||||
@Autowired
|
||||
public void setDatabaseRepository(DatabaseRepository databaseRepository) {
|
||||
this.databaseRepository = databaseRepository;
|
||||
public ApiContextImpl(OperationsContext operationsContext, HelpersService helpersService, UtilitiesService utilitiesService) {
|
||||
this.operationsContext = operationsContext;
|
||||
this.helpersService = helpersService;
|
||||
this.utilitiesService = utilitiesService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DatabaseRepository getDatabaseRepository() {
|
||||
return databaseRepository;
|
||||
public OperationsContext getOperationsContext() {
|
||||
return operationsContext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApplicationContext getApplicationContext() {
|
||||
return applicationContext;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setApplicationContext(ApplicationContext applicationContext) {
|
||||
this.applicationContext = applicationContext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RemoteFetcher getRemoteFetcher() {
|
||||
return remoteFetcher;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setRemoteFetcher(RemoteFetcher remoteFetcher) {
|
||||
this.remoteFetcher = remoteFetcher;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InvitationService getInvitationService() {
|
||||
return invitationService;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setInvitationService(InvitationService invitationService) {
|
||||
this.invitationService = invitationService;
|
||||
public HelpersService getHelpersService() {
|
||||
return helpersService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MailService getMailService() {
|
||||
return mailService;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setMailService(MailService mailService) {
|
||||
this.mailService = mailService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MessageSource getMessageSource() {
|
||||
return messageSource;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setMessageSource(MessageSource messageSource) {
|
||||
this.messageSource = messageSource;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BuilderFactory getBuilderFactory() {
|
||||
return builderFactory;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setBuilderFactory(BuilderFactory builderFactory) {
|
||||
this.builderFactory = builderFactory;
|
||||
public UtilitiesService getUtilitiesService() {
|
||||
return utilitiesService;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,45 @@
|
||||
package eu.eudat.services.forms;
|
||||
|
||||
import eu.eudat.models.user.components.commons.Rule;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* Created by ikalyvas on 3/5/2018.
|
||||
*/
|
||||
public class VisibilityContext {
|
||||
private List<VisibilityRule> visibilityRules = new LinkedList<>();
|
||||
|
||||
public List<VisibilityRule> getVisibilityRules() {
|
||||
return visibilityRules;
|
||||
}
|
||||
|
||||
public VisibilityRule get(String id) {
|
||||
Optional<VisibilityRule> rule = visibilityRules.stream().filter(item -> item.getVisibilityRuleTargetId().equals(id)).findFirst();
|
||||
if (rule.isPresent()) return rule.get();
|
||||
return null;
|
||||
}
|
||||
|
||||
public void buildVisibilityContext(List<Rule> sources) {
|
||||
sources.forEach(this::addToVisibilityRulesContext);
|
||||
}
|
||||
|
||||
private void addToVisibilityRulesContext(Rule item) {
|
||||
VisibilityRuleSource source = new VisibilityRuleSource();
|
||||
source.setVisibilityRuleSourceId(item.getSourceField());
|
||||
source.setVisibilityRuleSourceValue(item.getRequiredValue());
|
||||
|
||||
Optional<VisibilityRule> visibilityRuleOptional = visibilityRules.stream().filter(rule -> rule.getVisibilityRuleTargetId().equals(item.getTargetField())).findFirst();
|
||||
if (visibilityRuleOptional.isPresent()) visibilityRuleOptional.get().getVisibilityRuleSources().add(source);
|
||||
else {
|
||||
List<VisibilityRuleSource> sources = new LinkedList<>();
|
||||
sources.add(source);
|
||||
VisibilityRule visibilityRule = new VisibilityRule();
|
||||
visibilityRule.setVisibilityRuleTargetId(item.getTargetField());
|
||||
visibilityRule.setVisibilityRuleSources(sources);
|
||||
this.visibilityRules.add(visibilityRule);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package eu.eudat.services.forms;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by ikalyvas on 3/5/2018.
|
||||
*/
|
||||
public class VisibilityRule {
|
||||
private String visibilityRuleTargetId;
|
||||
private List<VisibilityRuleSource> visibilityRuleSources;
|
||||
|
||||
public String getVisibilityRuleTargetId() {
|
||||
return visibilityRuleTargetId;
|
||||
}
|
||||
|
||||
public void setVisibilityRuleTargetId(String visibilityRuleTargetId) {
|
||||
this.visibilityRuleTargetId = visibilityRuleTargetId;
|
||||
}
|
||||
|
||||
public List<VisibilityRuleSource> getVisibilityRuleSources() {
|
||||
return visibilityRuleSources;
|
||||
}
|
||||
|
||||
public void setVisibilityRuleSources(List<VisibilityRuleSource> visibilityRuleSources) {
|
||||
this.visibilityRuleSources = visibilityRuleSources;
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package eu.eudat.services.forms;
|
||||
|
||||
import eu.eudat.models.user.components.commons.Rule;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created by ikalyvas on 3/5/2018.
|
||||
*/
|
||||
public interface VisibilityRuleService {
|
||||
Boolean isElementVisible(String id);
|
||||
|
||||
void buildVisibilityContext(List<Rule> sources);
|
||||
|
||||
void setProperties(Map<String, Object> properties);
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
package eu.eudat.services.forms;
|
||||
|
||||
import eu.eudat.models.user.components.commons.Rule;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created by ikalyvas on 3/5/2018.
|
||||
*/
|
||||
@Service("visibilityRuleService")
|
||||
public class VisibilityRuleServiceImpl implements VisibilityRuleService {
|
||||
private Map<String, Boolean> elementVisibility = new HashMap<>();
|
||||
private VisibilityContext visibilityContext;
|
||||
private Map<String, Object> properties;
|
||||
|
||||
public Boolean isElementVisible(String id) {
|
||||
if (!this.elementVisibility.containsKey(id) || this.elementVisibility.get(id)) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setProperties(Map<String, Object> properties) {
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
public void buildVisibilityContext(List<Rule> sources) {
|
||||
this.visibilityContext = new VisibilityContext();
|
||||
this.visibilityContext.buildVisibilityContext(sources);
|
||||
this.visibilityContext.getVisibilityRules().forEach(item-> this.evaluateVisibility(item));
|
||||
}
|
||||
|
||||
private void evaluateVisibility(VisibilityRule rule) {
|
||||
List<VisibilityRuleSource> sources = rule.getVisibilityRuleSources();
|
||||
for(int i = 0; i < sources.size(); i++){
|
||||
if (!properties.containsKey(sources.get(i).getVisibilityRuleSourceId()) || !properties.get(sources.get(i).getVisibilityRuleSourceId()).equals(sources.get(i).getVisibilityRuleSourceValue())) {
|
||||
this.elementVisibility.put(rule.getVisibilityRuleTargetId(), false);
|
||||
return;
|
||||
}else{
|
||||
this.elementVisibility.put(rule.getVisibilityRuleTargetId(), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package eu.eudat.services.forms;
|
||||
|
||||
/**
|
||||
* Created by ikalyvas on 3/5/2018.
|
||||
*/
|
||||
public class VisibilityRuleSource {
|
||||
private String visibilityRuleSourceId;
|
||||
private String visibilityRuleSourceValue;
|
||||
|
||||
public String getVisibilityRuleSourceId() {
|
||||
return visibilityRuleSourceId;
|
||||
}
|
||||
|
||||
public void setVisibilityRuleSourceId(String visibilityRuleSourceId) {
|
||||
this.visibilityRuleSourceId = visibilityRuleSourceId;
|
||||
}
|
||||
|
||||
public String getVisibilityRuleSourceValue() {
|
||||
return visibilityRuleSourceValue;
|
||||
}
|
||||
|
||||
public void setVisibilityRuleSourceValue(String visibilityRuleSourceValue) {
|
||||
this.visibilityRuleSourceValue = visibilityRuleSourceValue;
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package eu.eudat.services.helpers;
|
||||
|
||||
import org.springframework.context.MessageSource;
|
||||
|
||||
/**
|
||||
* Created by ikalyvas on 3/1/2018.
|
||||
*/
|
||||
public interface HelpersService {
|
||||
|
||||
MessageSource getMessageSource();
|
||||
|
||||
LoggerService getLoggerService();
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package eu.eudat.services.helpers;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.MessageSource;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* Created by ikalyvas on 3/1/2018.
|
||||
*/
|
||||
@Service("helpersService")
|
||||
public class HelpersServiceImpl implements HelpersService {
|
||||
|
||||
private MessageSource messageSource;
|
||||
private LoggerService loggerService;
|
||||
|
||||
@Autowired
|
||||
public HelpersServiceImpl(MessageSource messageSource, LoggerService loggerService) {
|
||||
this.messageSource = messageSource;
|
||||
this.loggerService = loggerService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MessageSource getMessageSource() {
|
||||
return messageSource;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LoggerService getLoggerService() {
|
||||
return loggerService;
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package eu.eudat.services.helpers;
|
||||
|
||||
import eu.eudat.types.WarningLevel;
|
||||
|
||||
/**
|
||||
* Created by ikalyvas on 3/1/2018.
|
||||
*/
|
||||
public interface LoggerService {
|
||||
void log(String message);
|
||||
|
||||
void log(String message, WarningLevel level);
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package eu.eudat.services.helpers;
|
||||
|
||||
import eu.eudat.types.WarningLevel;
|
||||
import eu.eudat.utilities.interfaces.Applier;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created by ikalyvas on 3/1/2018.
|
||||
*/
|
||||
@Service("loggerService")
|
||||
public class LoggerServiceImpl implements LoggerService {
|
||||
private static final Logger logger = LoggerFactory.getLogger(LoggerServiceImpl.class);
|
||||
private WarningLevel level;
|
||||
private Map<WarningLevel, Applier<Logger, String>> options = new HashMap<>();
|
||||
|
||||
public void setLevel(WarningLevel level) {
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
public LoggerServiceImpl() {
|
||||
this.options.put(WarningLevel.DEBUG, (logger, message) -> logger.debug(message));
|
||||
this.options.put(WarningLevel.INFO, (logger, message) -> logger.info(message));
|
||||
this.options.put(WarningLevel.WARN, (logger, message) -> logger.warn(message));
|
||||
this.options.put(WarningLevel.ERROR, (logger, message) -> logger.error(message));
|
||||
}
|
||||
|
||||
public void log(String message) {
|
||||
this.options.get(this.level).apply(logger, message);
|
||||
}
|
||||
|
||||
public void log(String message, WarningLevel level) {
|
||||
this.options.get(level).apply(logger, message);
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package eu.eudat.services.operations;
|
||||
|
||||
import eu.eudat.entities.Credential;
|
||||
import eu.eudat.entities.UserToken;
|
||||
import eu.eudat.models.login.Credentials;
|
||||
import eu.eudat.models.loginprovider.LoginProviderUser;
|
||||
import eu.eudat.models.security.Principal;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Created by ikalyvas on 3/1/2018.
|
||||
*/
|
||||
public interface AuthenticationService {
|
||||
|
||||
Principal Touch(LoginProviderUser profile);
|
||||
|
||||
Principal Touch(Credentials credentials);
|
||||
|
||||
void Logout(UUID token);
|
||||
|
||||
Principal Touch(UUID token);
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package eu.eudat.services;
|
||||
package eu.eudat.services.operations;
|
||||
|
||||
import eu.eudat.dao.entities.*;
|
||||
import eu.eudat.dao.entities.security.CredentialDao;
|
@ -1,4 +1,4 @@
|
||||
package eu.eudat.services;
|
||||
package eu.eudat.services.operations;
|
||||
|
||||
import eu.eudat.dao.entities.*;
|
||||
import eu.eudat.dao.entities.security.CredentialDao;
|
@ -0,0 +1,20 @@
|
||||
package eu.eudat.services.operations;
|
||||
|
||||
import eu.eudat.builders.BuilderFactory;
|
||||
import eu.eudat.proxy.fetching.RemoteFetcher;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
|
||||
/**
|
||||
* Created by ikalyvas on 3/1/2018.
|
||||
*/
|
||||
public interface OperationsContext {
|
||||
|
||||
DatabaseRepository getDatabaseRepository();
|
||||
|
||||
ApplicationContext getApplicationContext();
|
||||
|
||||
BuilderFactory getBuilderFactory();
|
||||
|
||||
RemoteFetcher getRemoteFetcher();
|
||||
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
package eu.eudat.services.operations;
|
||||
|
||||
import eu.eudat.builders.BuilderFactory;
|
||||
import eu.eudat.proxy.fetching.RemoteFetcher;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* Created by ikalyvas on 3/1/2018.
|
||||
*/
|
||||
@Service("operationsContext")
|
||||
public class OperationsContextImpl implements OperationsContext {
|
||||
|
||||
private DatabaseRepository databaseRepository;
|
||||
private ApplicationContext applicationContext;
|
||||
private RemoteFetcher remoteFetcher;
|
||||
private BuilderFactory builderFactory;
|
||||
|
||||
@Autowired
|
||||
public OperationsContextImpl(DatabaseRepository databaseRepository, ApplicationContext applicationContext, RemoteFetcher remoteFetcher, BuilderFactory builderFactory) {
|
||||
this.databaseRepository = databaseRepository;
|
||||
this.applicationContext = applicationContext;
|
||||
this.remoteFetcher = remoteFetcher;
|
||||
this.builderFactory = builderFactory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DatabaseRepository getDatabaseRepository() {
|
||||
return databaseRepository;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApplicationContext getApplicationContext() {
|
||||
return applicationContext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RemoteFetcher getRemoteFetcher() {
|
||||
return remoteFetcher;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BuilderFactory getBuilderFactory() {
|
||||
return builderFactory;
|
||||
}
|
||||
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package eu.eudat.services;
|
||||
package eu.eudat.services.utilities;
|
||||
|
||||
|
||||
import eu.eudat.dao.entities.DMPDao;
|
@ -1,4 +1,4 @@
|
||||
package eu.eudat.services;
|
||||
package eu.eudat.services.utilities;
|
||||
|
||||
import eu.eudat.dao.entities.DMPDao;
|
||||
import eu.eudat.dao.entities.InvitationDao;
|
@ -1,4 +1,4 @@
|
||||
package eu.eudat.services;
|
||||
package eu.eudat.services.utilities;
|
||||
|
||||
import eu.eudat.models.mail.SimpleMail;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package eu.eudat.services;
|
||||
package eu.eudat.services.utilities;
|
||||
|
||||
import eu.eudat.models.mail.SimpleMail;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
@ -0,0 +1,15 @@
|
||||
package eu.eudat.services.utilities;
|
||||
|
||||
import eu.eudat.services.forms.VisibilityRuleService;
|
||||
|
||||
/**
|
||||
* Created by ikalyvas on 3/1/2018.
|
||||
*/
|
||||
public interface UtilitiesService {
|
||||
|
||||
InvitationService getInvitationService();
|
||||
|
||||
MailService getMailService();
|
||||
|
||||
VisibilityRuleService getVisibilityRuleService();
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package eu.eudat.services.utilities;
|
||||
|
||||
import eu.eudat.services.forms.VisibilityRuleService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* Created by ikalyvas on 3/1/2018.
|
||||
*/
|
||||
@Service("utilitiesService")
|
||||
public class UtilitiesServiceImpl implements UtilitiesService {
|
||||
|
||||
private InvitationService invitationService;
|
||||
private MailService mailService;
|
||||
private VisibilityRuleService visibilityRuleService;
|
||||
|
||||
@Autowired
|
||||
public UtilitiesServiceImpl(InvitationService invitationService, MailService mailService, VisibilityRuleService visibilityRuleService) {
|
||||
this.invitationService = invitationService;
|
||||
this.mailService = mailService;
|
||||
this.visibilityRuleService = visibilityRuleService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VisibilityRuleService getVisibilityRuleService() {
|
||||
return visibilityRuleService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InvitationService getInvitationService() {
|
||||
return invitationService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MailService getMailService() {
|
||||
return mailService;
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package eu.eudat.types;
|
||||
|
||||
/**
|
||||
* Created by ikalyvas on 3/5/2018.
|
||||
*/
|
||||
public enum ApiResponseType {
|
||||
JSON_RESPONSE(0), FILE_RESPONSE(1);
|
||||
|
||||
private Integer value;
|
||||
|
||||
private ApiResponseType(Integer value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public Integer getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public static ApiResponseType fromInteger(Integer value) {
|
||||
switch (value) {
|
||||
case 0:
|
||||
return JSON_RESPONSE;
|
||||
case 200:
|
||||
return FILE_RESPONSE;
|
||||
default:
|
||||
throw new RuntimeException("Unsupported Api Response Type Code");
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
package eu.eudat.types;
|
||||
|
||||
/**
|
||||
* Created by ikalyvas on 3/1/2018.
|
||||
*/
|
||||
public enum WarningLevel {
|
||||
INFO, WARN, DEBUG, ERROR
|
||||
}
|
@ -1,8 +1,8 @@
|
||||
package eu.eudat.utilities.interfaces;
|
||||
|
||||
/**
|
||||
* Created by ikalyvas on 2/27/2018.
|
||||
* Created by ikalyvas on 3/1/2018.
|
||||
*/
|
||||
public interface Applier<A, V, R> {
|
||||
R apply(A applier, V value);
|
||||
public interface Applier<A, V> {
|
||||
void apply(A applier, V value);
|
||||
}
|
||||
|
@ -0,0 +1,8 @@
|
||||
package eu.eudat.utilities.interfaces;
|
||||
|
||||
/**
|
||||
* Created by ikalyvas on 2/27/2018.
|
||||
*/
|
||||
public interface ApplierWithValue<A, V, R> {
|
||||
R apply(A applier, V value);
|
||||
}
|
Binary file not shown.
@ -0,0 +1,4 @@
|
||||
export enum ApiResponseCode {
|
||||
JSON_RESPONSE = 0,
|
||||
FILE_RESPONSE = 1,
|
||||
}
|
Binary file not shown.
Loading…
Reference in New Issue