Enable creating an API using Spring Web #5
14
core/pom.xml
14
core/pom.xml
@ -54,6 +54,10 @@
|
|||||||
<groupId>org.glassfish.jersey.inject</groupId>
|
<groupId>org.glassfish.jersey.inject</groupId>
|
||||||
<artifactId>jersey-hk2</artifactId>
|
<artifactId>jersey-hk2</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-context</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!--QueryDSL-->
|
<!--QueryDSL-->
|
||||||
<dependency>
|
<dependency>
|
||||||
@ -76,6 +80,16 @@
|
|||||||
<groupId>jakarta.transaction</groupId>
|
<groupId>jakarta.transaction</groupId>
|
||||||
<artifactId>jakarta.transaction-api</artifactId>
|
<artifactId>jakarta.transaction-api</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.hibernate.orm</groupId>
|
||||||
|
<artifactId>hibernate-core</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.hsqldb</groupId>
|
||||||
|
<artifactId>hsqldb</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!--Additional stuff-->
|
<!--Additional stuff-->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -1,13 +1,11 @@
|
|||||||
package se.su.dsv.scipro.war;
|
package se.su.dsv.scipro;
|
||||||
|
|
||||||
import com.google.common.eventbus.EventBus;
|
import com.google.common.eventbus.EventBus;
|
||||||
import jakarta.inject.Provider;
|
import jakarta.inject.Provider;
|
||||||
import jakarta.persistence.EntityManager;
|
import jakarta.persistence.EntityManager;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import se.su.dsv.scipro.DataInitializer;
|
|
||||||
import se.su.dsv.scipro.activityplan.ActivityPlanFacade;
|
import se.su.dsv.scipro.activityplan.ActivityPlanFacade;
|
||||||
import se.su.dsv.scipro.activityplan.ActivityPlanFacadeImpl;
|
import se.su.dsv.scipro.activityplan.ActivityPlanFacadeImpl;
|
||||||
import se.su.dsv.scipro.activityplan.ActivityPlanServiceImpl;
|
import se.su.dsv.scipro.activityplan.ActivityPlanServiceImpl;
|
||||||
@ -17,8 +15,6 @@ import se.su.dsv.scipro.checklist.ChecklistAnswerServiceImpl;
|
|||||||
import se.su.dsv.scipro.checklist.ChecklistServiceImpl;
|
import se.su.dsv.scipro.checklist.ChecklistServiceImpl;
|
||||||
import se.su.dsv.scipro.checklist.ChecklistTemplateService;
|
import se.su.dsv.scipro.checklist.ChecklistTemplateService;
|
||||||
import se.su.dsv.scipro.checklist.ChecklistTemplateServiceImpl;
|
import se.su.dsv.scipro.checklist.ChecklistTemplateServiceImpl;
|
||||||
import se.su.dsv.scipro.crosscutting.ReviewerAssignedNotifications;
|
|
||||||
import se.su.dsv.scipro.crosscutting.ReviewerSupportMailer;
|
|
||||||
import se.su.dsv.scipro.daisyExternal.http.DaisyAPIImpl;
|
import se.su.dsv.scipro.daisyExternal.http.DaisyAPIImpl;
|
||||||
import se.su.dsv.scipro.date.DateServiceImpl;
|
import se.su.dsv.scipro.date.DateServiceImpl;
|
||||||
import se.su.dsv.scipro.file.FileDescriptionRepo;
|
import se.su.dsv.scipro.file.FileDescriptionRepo;
|
||||||
@ -44,8 +40,6 @@ import se.su.dsv.scipro.finalseminar.FinalSeminarSettingsServiceImpl;
|
|||||||
import se.su.dsv.scipro.finalseminar.FinalSeminarUploadControllerImpl;
|
import se.su.dsv.scipro.finalseminar.FinalSeminarUploadControllerImpl;
|
||||||
import se.su.dsv.scipro.finalthesis.FinalThesisService;
|
import se.su.dsv.scipro.finalthesis.FinalThesisService;
|
||||||
import se.su.dsv.scipro.finalthesis.FinalThesisServiceImpl;
|
import se.su.dsv.scipro.finalthesis.FinalThesisServiceImpl;
|
||||||
import se.su.dsv.scipro.finalthesis.PublishingConsentService;
|
|
||||||
import se.su.dsv.scipro.finalthesis.PublishingConsentUnavailable;
|
|
||||||
import se.su.dsv.scipro.firstmeeting.FirstMeetingServiceImpl;
|
import se.su.dsv.scipro.firstmeeting.FirstMeetingServiceImpl;
|
||||||
import se.su.dsv.scipro.forum.AbstractThreadRepository;
|
import se.su.dsv.scipro.forum.AbstractThreadRepository;
|
||||||
import se.su.dsv.scipro.forum.BasicForumService;
|
import se.su.dsv.scipro.forum.BasicForumService;
|
||||||
@ -734,12 +728,6 @@ public class CoreConfig {
|
|||||||
return new PublicationMetadataServiceImpl(publicationMetadataRepository);
|
return new PublicationMetadataServiceImpl(publicationMetadataRepository);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
|
||||||
@ConditionalOnMissingBean(PublishingConsentService.class)
|
|
||||||
public PublishingConsentUnavailable publishingConsentService() {
|
|
||||||
return new PublishingConsentUnavailable();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public ReflectionServiceImpl reflectionService(
|
public ReflectionServiceImpl reflectionService(
|
||||||
AuthorRepository authorRepository,
|
AuthorRepository authorRepository,
|
||||||
@ -910,26 +898,6 @@ public class CoreConfig {
|
|||||||
return new NotificationMailFormatterImpl();
|
return new NotificationMailFormatterImpl();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
|
||||||
public ReviewerSupportMailer reviewerSupportMailer(
|
|
||||||
EventBus eventBus,
|
|
||||||
GeneralSystemSettingsService generalSystemSettingsService,
|
|
||||||
MailEventService mailEventService)
|
|
||||||
{
|
|
||||||
return new ReviewerSupportMailer(eventBus, mailEventService, generalSystemSettingsService);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public ReviewerAssignedNotifications reviewerAssignedNotifications(
|
|
||||||
EventBus eventBus,
|
|
||||||
NotificationController notificationController,
|
|
||||||
RoughDraftApprovalService roughDraftApprovalService,
|
|
||||||
FinalSeminarApprovalService finalSeminarApprovalService)
|
|
||||||
{
|
|
||||||
return new ReviewerAssignedNotifications(roughDraftApprovalService,
|
|
||||||
finalSeminarApprovalService, notificationController, eventBus);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public ReviewerAssignedDeadline reviewerAssignedDeadline(
|
public ReviewerAssignedDeadline reviewerAssignedDeadline(
|
||||||
EventBus eventBus,
|
EventBus eventBus,
|
@ -1,4 +1,4 @@
|
|||||||
package se.su.dsv.scipro.war;
|
package se.su.dsv.scipro;
|
||||||
|
|
||||||
import jakarta.inject.Provider;
|
import jakarta.inject.Provider;
|
||||||
import jakarta.persistence.EntityManager;
|
import jakarta.persistence.EntityManager;
|
@ -14,10 +14,8 @@ import org.springframework.context.annotation.Import;
|
|||||||
import se.su.dsv.scipro.profiles.CurrentProfile;
|
import se.su.dsv.scipro.profiles.CurrentProfile;
|
||||||
import se.su.dsv.scipro.sukat.Sukat;
|
import se.su.dsv.scipro.sukat.Sukat;
|
||||||
import se.su.dsv.scipro.system.CurrentUser;
|
import se.su.dsv.scipro.system.CurrentUser;
|
||||||
import se.su.dsv.scipro.war.CoreConfig;
|
import se.su.dsv.scipro.CoreConfig;
|
||||||
import se.su.dsv.scipro.war.MailConfig;
|
import se.su.dsv.scipro.RepositoryConfiguration;
|
||||||
import se.su.dsv.scipro.war.RepositoryConfiguration;
|
|
||||||
import se.su.dsv.scipro.war.WicketConfiguration;
|
|
||||||
|
|
||||||
import java.time.Clock;
|
import java.time.Clock;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
@ -62,7 +60,7 @@ public abstract class SpringTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Configuration(proxyBeanMethods = false)
|
@Configuration(proxyBeanMethods = false)
|
||||||
@Import({CoreConfig.class, RepositoryConfiguration.class, MailConfig.class, WicketConfiguration.class})
|
@Import({CoreConfig.class, RepositoryConfiguration.class})
|
||||||
public static class TestContext {
|
public static class TestContext {
|
||||||
@Bean
|
@Bean
|
||||||
public InMemoryFileStore inMemoryFileStore() {
|
public InMemoryFileStore inMemoryFileStore() {
|
@ -81,12 +81,6 @@
|
|||||||
<artifactId>api</artifactId>
|
<artifactId>api</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.hsqldb</groupId>
|
|
||||||
<artifactId>hsqldb</artifactId>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
@ -7,6 +7,7 @@ import jakarta.servlet.ServletContext;
|
|||||||
import jakarta.servlet.ServletException;
|
import jakarta.servlet.ServletException;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||||
import org.springframework.boot.autoconfigure.domain.EntityScan;
|
import org.springframework.boot.autoconfigure.domain.EntityScan;
|
||||||
import org.springframework.boot.autoconfigure.orm.jpa.EntityManagerFactoryBuilderCustomizer;
|
import org.springframework.boot.autoconfigure.orm.jpa.EntityManagerFactoryBuilderCustomizer;
|
||||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||||
@ -16,9 +17,13 @@ import org.springframework.context.annotation.Import;
|
|||||||
import org.springframework.core.task.SimpleAsyncTaskExecutor;
|
import org.springframework.core.task.SimpleAsyncTaskExecutor;
|
||||||
import org.springframework.orm.jpa.SharedEntityManagerCreator;
|
import org.springframework.orm.jpa.SharedEntityManagerCreator;
|
||||||
import org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter;
|
import org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter;
|
||||||
|
import se.su.dsv.scipro.CoreConfig;
|
||||||
import se.su.dsv.scipro.CurrentUserFromWicketSession;
|
import se.su.dsv.scipro.CurrentUserFromWicketSession;
|
||||||
import se.su.dsv.scipro.FileSystemStore;
|
import se.su.dsv.scipro.FileSystemStore;
|
||||||
|
import se.su.dsv.scipro.RepositoryConfiguration;
|
||||||
import se.su.dsv.scipro.file.FileStore;
|
import se.su.dsv.scipro.file.FileStore;
|
||||||
|
import se.su.dsv.scipro.finalthesis.PublishingConsentService;
|
||||||
|
import se.su.dsv.scipro.finalthesis.PublishingConsentUnavailable;
|
||||||
import se.su.dsv.scipro.profiles.CurrentProfile;
|
import se.su.dsv.scipro.profiles.CurrentProfile;
|
||||||
import se.su.dsv.scipro.system.AggregateUserSearch;
|
import se.su.dsv.scipro.system.AggregateUserSearch;
|
||||||
import se.su.dsv.scipro.system.Lifecycle;
|
import se.su.dsv.scipro.system.Lifecycle;
|
||||||
@ -154,4 +159,10 @@ public class Main extends SpringBootServletInitializer implements ServletContain
|
|||||||
{
|
{
|
||||||
return new AggregateUserSearch(userSearchProviders, userService);
|
return new AggregateUserSearch(userSearchProviders, userService);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
@ConditionalOnMissingBean(PublishingConsentService.class)
|
||||||
|
public PublishingConsentUnavailable publishingConsentService() {
|
||||||
|
return new PublishingConsentUnavailable();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,11 +10,16 @@ import org.springframework.context.annotation.Bean;
|
|||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import se.su.dsv.scipro.SciProApplication;
|
import se.su.dsv.scipro.SciProApplication;
|
||||||
import se.su.dsv.scipro.crosscutting.ForwardPhase2Feedback;
|
import se.su.dsv.scipro.crosscutting.ForwardPhase2Feedback;
|
||||||
|
import se.su.dsv.scipro.crosscutting.ReviewerAssignedNotifications;
|
||||||
|
import se.su.dsv.scipro.crosscutting.ReviewerSupportMailer;
|
||||||
import se.su.dsv.scipro.crosscutting.ReviewingNotifications;
|
import se.su.dsv.scipro.crosscutting.ReviewingNotifications;
|
||||||
import se.su.dsv.scipro.forum.ProjectForumService;
|
import se.su.dsv.scipro.forum.ProjectForumService;
|
||||||
import se.su.dsv.scipro.generalsystemsettings.GeneralSystemSettingsService;
|
import se.su.dsv.scipro.generalsystemsettings.GeneralSystemSettingsService;
|
||||||
|
import se.su.dsv.scipro.mail.MailEventService;
|
||||||
import se.su.dsv.scipro.notifications.NotificationController;
|
import se.su.dsv.scipro.notifications.NotificationController;
|
||||||
import se.su.dsv.scipro.profiles.CurrentProfile;
|
import se.su.dsv.scipro.profiles.CurrentProfile;
|
||||||
|
import se.su.dsv.scipro.reviewing.FinalSeminarApprovalService;
|
||||||
|
import se.su.dsv.scipro.reviewing.RoughDraftApprovalService;
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
public class WicketConfiguration {
|
public class WicketConfiguration {
|
||||||
@ -60,4 +65,26 @@ public class WicketConfiguration {
|
|||||||
{
|
{
|
||||||
return new ForwardPhase2Feedback(webApplication, projectForumService, eventBus);
|
return new ForwardPhase2Feedback(webApplication, projectForumService, eventBus);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Not sure why this dependency lives in the view module
|
||||||
|
@Bean
|
||||||
|
public ReviewerSupportMailer reviewerSupportMailer(
|
||||||
|
EventBus eventBus,
|
||||||
|
GeneralSystemSettingsService generalSystemSettingsService,
|
||||||
|
MailEventService mailEventService)
|
||||||
|
{
|
||||||
|
return new ReviewerSupportMailer(eventBus, mailEventService, generalSystemSettingsService);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Not sure why this dependency lives in the view module
|
||||||
|
@Bean
|
||||||
|
public ReviewerAssignedNotifications reviewerAssignedNotifications(
|
||||||
|
EventBus eventBus,
|
||||||
|
NotificationController notificationController,
|
||||||
|
RoughDraftApprovalService roughDraftApprovalService,
|
||||||
|
FinalSeminarApprovalService finalSeminarApprovalService)
|
||||||
|
{
|
||||||
|
return new ReviewerAssignedNotifications(roughDraftApprovalService,
|
||||||
|
finalSeminarApprovalService, notificationController, eventBus);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,20 +0,0 @@
|
|||||||
package se.su.dsv.scipro.test;
|
|
||||||
|
|
||||||
import java.time.Duration;
|
|
||||||
import java.time.Instant;
|
|
||||||
import java.time.Period;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
public class Dates {
|
|
||||||
public static Date yesterday() {
|
|
||||||
return Date.from(Instant.now().minus(Period.ofDays(1)));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Date tomorrow() {
|
|
||||||
return Date.from(Instant.now().plus(Period.ofDays(1)));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Date oneHourAgo() {
|
|
||||||
return Date.from(Instant.now().minus(Duration.ofHours(1)));
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user