Enable creating an API using Spring Web #5
@ -0,0 +1,4 @@
|
|||||||
|
package se.su.dsv.scipro.war;
|
||||||
tozh4728 marked this conversation as resolved
|
|||||||
|
|
||||||
|
public interface PluginConfiguration {
|
||||||
|
}
|
@ -16,6 +16,10 @@
|
|||||||
<groupId>se.su.dsv.scipro</groupId>
|
<groupId>se.su.dsv.scipro</groupId>
|
||||||
<artifactId>core</artifactId>
|
<artifactId>core</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-context</artifactId>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.inject.extensions</groupId>
|
<groupId>com.google.inject.extensions</groupId>
|
||||||
<artifactId>guice-servlet</artifactId>
|
<artifactId>guice-servlet</artifactId>
|
||||||
|
@ -0,0 +1,182 @@
|
|||||||
|
package se.su.dsv.scipro.integration.daisy;
|
||||||
|
|
||||||
|
import com.google.common.eventbus.EventBus;
|
||||||
|
import jakarta.inject.Provider;
|
||||||
|
import jakarta.persistence.EntityManager;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import se.su.dsv.scipro.daisyExternal.ExternalImporter;
|
||||||
|
import se.su.dsv.scipro.daisyExternal.ImporterTransactions;
|
||||||
|
import se.su.dsv.scipro.daisyExternal.http.DaisyAPI;
|
||||||
|
import se.su.dsv.scipro.daisyExternal.impl.ExternalImporterDaisyImpl;
|
||||||
|
import se.su.dsv.scipro.daisyExternal.impl.ImporterTransactionsImpl;
|
||||||
|
import se.su.dsv.scipro.finalseminar.FinalSeminarService;
|
||||||
|
import se.su.dsv.scipro.finalthesis.FinalThesisService;
|
||||||
|
import se.su.dsv.scipro.forum.ProjectForumService;
|
||||||
|
import se.su.dsv.scipro.grading.NationalSubjectCategoryService;
|
||||||
|
import se.su.dsv.scipro.grading.ThesisApprovedHistoryService;
|
||||||
|
import se.su.dsv.scipro.grading.ThesisRejectionHistoryService;
|
||||||
|
import se.su.dsv.scipro.integration.daisy.workers.GradingCompletedMilestoneActivator;
|
||||||
|
import se.su.dsv.scipro.integration.daisy.workers.ImportNationalCategories;
|
||||||
|
import se.su.dsv.scipro.integration.daisy.workers.ProjectExporter;
|
||||||
|
import se.su.dsv.scipro.integration.daisy.workers.ProjectFinalizer;
|
||||||
|
import se.su.dsv.scipro.integration.daisy.workers.RejectedThesisWorker;
|
||||||
|
import se.su.dsv.scipro.integration.daisy.workers.UserImportWorker;
|
||||||
|
import se.su.dsv.scipro.io.ExternalExporter;
|
||||||
|
import se.su.dsv.scipro.io.facade.ExporterFacade;
|
||||||
|
import se.su.dsv.scipro.io.impl.ExternalExporterDaisyImpl;
|
||||||
|
import se.su.dsv.scipro.match.ProgramService;
|
||||||
|
import se.su.dsv.scipro.project.ProjectRepo;
|
||||||
|
import se.su.dsv.scipro.project.ProjectService;
|
||||||
|
import se.su.dsv.scipro.report.GradingReportService;
|
||||||
|
import se.su.dsv.scipro.springdata.services.UnitService;
|
||||||
|
import se.su.dsv.scipro.system.MergeService;
|
||||||
|
import se.su.dsv.scipro.system.MergeServiceImpl;
|
||||||
|
import se.su.dsv.scipro.system.ResearchAreaService;
|
||||||
|
import se.su.dsv.scipro.system.UserNameService;
|
||||||
|
import se.su.dsv.scipro.system.UserService;
|
||||||
|
import se.su.dsv.scipro.war.PluginConfiguration;
|
||||||
|
import se.su.dsv.scipro.workerthreads.Scheduler;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class DaisyIntegrationConfiguration implements PluginConfiguration {
|
||||||
|
@Bean
|
||||||
|
public Daisy daisy(ExporterFacade exporterFacade, ExternalExporter externalExporter) {
|
||||||
|
return new Daisy(exporterFacade, externalExporter);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public ExporterFacade exporterFacade(ExternalExporter externalExporter) {
|
||||||
|
return new ExporterFacade(externalExporter);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public ExternalExporterDaisyImpl externalExporter(DaisyAPI daisyApi) {
|
||||||
|
return new ExternalExporterDaisyImpl(daisyApi);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public DaisyWorkerInitialization daisyWorkerInitialization(
|
||||||
|
Scheduler scheduler,
|
||||||
|
Provider<ProjectExporter> projectExporter,
|
||||||
|
Provider<UserImportWorker> userImportWorker,
|
||||||
|
Provider<ProjectFinalizer> projectFinalizer,
|
||||||
|
Provider<RejectedThesisWorker> rejectedThesisWorkerProvider,
|
||||||
|
Provider<GradingCompletedMilestoneActivator> gradingFinalizer,
|
||||||
|
Provider<ImportNationalCategories> importNationalCategories)
|
||||||
|
{
|
||||||
|
return new DaisyWorkerInitialization(scheduler, projectExporter, userImportWorker, projectFinalizer,
|
||||||
|
rejectedThesisWorkerProvider, gradingFinalizer, importNationalCategories);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public ProjectExporter projectExporter(
|
||||||
|
ExporterFacade exporterFacade,
|
||||||
|
ProjectRepo projectRepo,
|
||||||
|
DaisyAPI daisyApi,
|
||||||
|
ExternalExporter externalExporter,
|
||||||
|
FinalSeminarService finalSeminarService,
|
||||||
|
FinalThesisService finalThesisService)
|
||||||
|
{
|
||||||
|
return new ProjectExporter(projectRepo, exporterFacade, daisyApi, externalExporter, finalSeminarService,
|
||||||
|
finalThesisService);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public UserImportWorker userImportWorker(
|
||||||
|
DaisyAPI daisyApi,
|
||||||
|
ImporterTransactions importerTransactions,
|
||||||
|
ExternalImporter externalImporter,
|
||||||
|
MergeService mergeService,
|
||||||
|
UserService userService,
|
||||||
|
ProgramService programService,
|
||||||
|
Provider<EntityManager> entityManager,
|
||||||
|
ResearchAreaService researchAreaService)
|
||||||
|
{
|
||||||
|
return new UserImportWorker(daisyApi, importerTransactions, externalImporter, mergeService, userService,
|
||||||
|
programService, entityManager, researchAreaService);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public ProjectFinalizer projectFinalizer(
|
||||||
|
ProjectService projectService,
|
||||||
|
DaisyAPI daisyApi,
|
||||||
|
ThesisApprovedHistoryService thesisApprovedHistoryService)
|
||||||
|
{
|
||||||
|
return new ProjectFinalizer(projectService, daisyApi, thesisApprovedHistoryService);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public RejectedThesisWorker rejectedThesisWorker(
|
||||||
|
GradingReportService gradingReportService,
|
||||||
|
ProjectService projectService,
|
||||||
|
FinalThesisService finalThesisService,
|
||||||
|
ProjectForumService projectForumService,
|
||||||
|
ThesisRejectionHistoryService thesisRejectionHistoryService,
|
||||||
|
DaisyAPI daisyApi)
|
||||||
|
{
|
||||||
|
return new RejectedThesisWorker(gradingReportService, projectService, finalThesisService, projectForumService,
|
||||||
|
thesisRejectionHistoryService, daisyApi);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public GradingCompletedMilestoneActivator gradingFinalizer(
|
||||||
|
ProjectService projectService,
|
||||||
|
DaisyAPI daisyApi,
|
||||||
|
EventBus eventBus,
|
||||||
|
UserService userService)
|
||||||
|
{
|
||||||
|
return new GradingCompletedMilestoneActivator(projectService, daisyApi, eventBus, userService);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public ImportNationalCategories importNationalCategories(
|
||||||
|
DaisyAPI daisyApi,
|
||||||
|
NationalSubjectCategoryService nationalSubjectCategoryService)
|
||||||
|
{
|
||||||
|
return new ImportNationalCategories(daisyApi, nationalSubjectCategoryService);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public ImporterTransactionsImpl importerTransactions(
|
||||||
|
UserService userService,
|
||||||
|
ResearchAreaService researchAreaService,
|
||||||
|
ProjectService projectService,
|
||||||
|
UserNameService userNameService,
|
||||||
|
DaisyAPI daisyApi,
|
||||||
|
ProgramService programService)
|
||||||
|
{
|
||||||
|
return new ImporterTransactionsImpl(userService, researchAreaService, projectService, userNameService,
|
||||||
|
daisyApi, programService);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public ExternalImporterDaisyImpl externalImporter(
|
||||||
|
DaisyAPI daisyApi,
|
||||||
|
ImporterTransactions importerTransactions,
|
||||||
|
UserService userService,
|
||||||
|
UnitService unitService)
|
||||||
|
{
|
||||||
|
return new ExternalImporterDaisyImpl(userService, unitService, daisyApi, importerTransactions);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public MergeServiceImpl mergeService(UserService userService, UserNameService userNameService) {
|
||||||
|
return new MergeServiceImpl(userNameService, userService);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
SyncReviewerWithDaisy syncReviewerWithDaisy(DaisyAPI daisyApi, EventBus eventBus) {
|
||||||
|
return new SyncReviewerWithDaisy(daisyApi, eventBus);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public DaisyUserSearchService daisyUserSearchService(DaisyAPI daisyApi, UserService userService) {
|
||||||
|
return new DaisyUserSearchService(daisyApi, userService);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
DaisyConsentService daisyConsentService(DaisyAPI daisyApi) {
|
||||||
|
return new DaisyConsentService(daisyApi);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1 @@
|
|||||||
|
se.su.dsv.scipro.integration.daisy.DaisyIntegrationConfiguration
|
@ -34,6 +34,7 @@ import se.su.dsv.scipro.system.UserService;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
import java.util.ServiceLoader;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@SpringBootApplication(proxyBeanMethods = false)
|
@SpringBootApplication(proxyBeanMethods = false)
|
||||||
@ -47,6 +48,9 @@ public class Main extends SpringBootServletInitializer implements ServletContain
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
|
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
|
||||||
|
for (PluginConfiguration pluginConfiguration : ServiceLoader.load(PluginConfiguration.class)) {
|
||||||
|
builder.sources(pluginConfiguration.getClass());
|
||||||
|
}
|
||||||
return builder.sources(Main.class);
|
return builder.sources(Main.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user
What's the purpose of this marker interface?