Skip to content

Commit 06c7a8f

Browse files
Release 1.1.4 #247 from qbicsoftware/development
Fixed loading time and filtered project samples
2 parents 1c91fc0 + 5f924c6 commit 06c7a8f

File tree

134 files changed

+2580
-5464
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

134 files changed

+2580
-5464
lines changed

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<maven.compiler.source>1.8</maven.compiler.source>
2222
<maven.compiler.target>1.8</maven.compiler.target>
2323

24-
<groovy.version>3.0.8</groovy.version>
24+
<groovy.version>3.0.12</groovy.version>
2525

2626
<log4j.version>2.17.1</log4j.version>
2727

@@ -133,7 +133,7 @@
133133
<dependency>
134134
<groupId>life.qbic</groupId>
135135
<artifactId>data-model-lib</artifactId>
136-
<version>2.15.0</version>
136+
<version>2.20.0</version>
137137
</dependency>
138138
<dependency>
139139
<groupId>org.apache.logging.log4j</groupId>

sample-tracking-status-overview-app/pom.xml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@
3232
<dependency>
3333
<groupId>mysql</groupId>
3434
<artifactId>mysql-connector-java</artifactId>
35-
<version>8.0.28</version>
35+
<version>8.0.30</version>
3636
</dependency>
37+
3738
<!-- https://mvnrepository.com/artifact/com.liferay.portal/portal-service -->
3839
<dependency>
3940
<groupId>com.liferay.portal</groupId>
@@ -52,8 +53,11 @@
5253
<artifactId>jackson-databind</artifactId>
5354
<version>2.13.3</version>
5455
</dependency>
55-
56-
56+
<dependency>
57+
<groupId>com.fasterxml.jackson.datatype</groupId>
58+
<artifactId>jackson-datatype-jsr310</artifactId>
59+
<version>2.13.3</version>
60+
</dependency>
5761
<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-api -->
5862
<dependency>
5963
<groupId>org.slf4j</groupId>
@@ -103,9 +107,15 @@
103107
<dependency>
104108
<groupId>org.apache.maven.plugins</groupId>
105109
<artifactId>maven-resources-plugin</artifactId>
106-
<version>3.2.0</version>
110+
<version>3.3.0</version>
107111
<type>maven-plugin</type>
108112
</dependency>
113+
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents.client5/httpclient5 -->
114+
<dependency>
115+
<groupId>org.apache.httpcomponents.client5</groupId>
116+
<artifactId>httpclient5</artifactId>
117+
<version>5.1.3</version>
118+
</dependency>
109119
<dependency>
110120
<groupId>life.qbic</groupId>
111121
<artifactId>openbis-api</artifactId>

sample-tracking-status-overview-app/src/main/groovy/life/qbic/portal/sampletracking/Constants.groovy

Lines changed: 0 additions & 12 deletions
This file was deleted.
Lines changed: 107 additions & 152 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,25 @@
11
package life.qbic.portal.sampletracking
22

33
import com.vaadin.ui.VerticalLayout
4-
import life.qbic.business.project.Project
5-
import life.qbic.business.project.load.*
6-
import life.qbic.business.project.subscribe.SubscribeProject
7-
import life.qbic.business.project.subscribe.SubscribeProjectOutput
8-
import life.qbic.business.project.subscribe.Subscriber
9-
import life.qbic.business.project.subscribe.SubscriptionDataSource
10-
import life.qbic.business.samples.count.CountSamples
11-
import life.qbic.business.samples.count.CountSamplesDataSource
12-
import life.qbic.business.samples.count.CountSamplesOutput
13-
import life.qbic.business.samples.count.StatusCount
14-
import life.qbic.business.samples.download.DownloadSamples
15-
import life.qbic.business.samples.download.DownloadSamplesDataSource
16-
import life.qbic.business.samples.download.DownloadSamplesOutput
17-
import life.qbic.business.samples.info.GetSamplesInfo
18-
import life.qbic.business.samples.info.GetSamplesInfoDataSource
19-
import life.qbic.business.samples.info.GetSamplesInfoOutput
20-
import life.qbic.business.samples.info.SampleStatusDataSource
4+
import groovy.transform.CompileStatic
5+
import life.qbic.business.subscribe.Subscriber
216
import life.qbic.datamodel.dtos.portal.PortalUser
22-
import life.qbic.portal.sampletracking.communication.notification.MessageBroker
23-
import life.qbic.portal.sampletracking.communication.notification.NotificationService
24-
import life.qbic.portal.sampletracking.components.MainPage
25-
import life.qbic.portal.sampletracking.components.NotificationHandler
26-
import life.qbic.portal.sampletracking.components.ViewModel
27-
import life.qbic.portal.sampletracking.components.projectoverview.CountSamplesPresenter
28-
import life.qbic.portal.sampletracking.components.projectoverview.LoadProjectsPresenter
29-
import life.qbic.portal.sampletracking.components.projectoverview.ProjectView
30-
import life.qbic.portal.sampletracking.components.projectoverview.download.DownloadProjectController
31-
import life.qbic.portal.sampletracking.components.projectoverview.download.ManifestPresenter
32-
import life.qbic.portal.sampletracking.components.projectoverview.subscribe.SubscribeProjectController
33-
import life.qbic.portal.sampletracking.components.projectoverview.subscribe.SubscribeProjectPresenter
34-
import life.qbic.portal.sampletracking.components.sampleoverview.SampleOverviewController
35-
import life.qbic.portal.sampletracking.components.sampleoverview.SampleView
36-
import life.qbic.portal.sampletracking.datasources.Credentials
37-
import life.qbic.portal.sampletracking.datasources.OpenBisConnector
38-
import life.qbic.portal.sampletracking.datasources.database.DatabaseSession
39-
import life.qbic.portal.sampletracking.datasources.samples.SamplesDbConnector
40-
import life.qbic.portal.sampletracking.datasources.subscriptions.SubscriptionsDbConnector
41-
import life.qbic.portal.sampletracking.resource.ResourceService
42-
import life.qbic.portal.sampletracking.resource.project.ProjectResourceService
43-
import life.qbic.portal.sampletracking.resource.status.StatusCountResourceService
44-
import life.qbic.portal.sampletracking.services.sample.SampleTracking
45-
import life.qbic.portal.sampletracking.services.sample.SampleTrackingService
7+
import life.qbic.portal.sampletracking.data.*
8+
import life.qbic.portal.sampletracking.data.database.DatabaseSession
9+
import life.qbic.portal.sampletracking.view.MainView
10+
import life.qbic.portal.sampletracking.view.notifications.NotificationCenter
11+
import life.qbic.portal.sampletracking.view.notifications.NotificationHandler
12+
import life.qbic.portal.sampletracking.view.projects.ProjectStatusComponentProvider
13+
import life.qbic.portal.sampletracking.view.projects.ProjectView
14+
import life.qbic.portal.sampletracking.view.projects.SubscriptionCheckboxProvider
15+
import life.qbic.portal.sampletracking.view.samples.SampleStatusComponentProvider
16+
import life.qbic.portal.sampletracking.view.samples.SampleView
4617
import life.qbic.portal.utils.ConfigurationManager
4718
import life.qbic.portal.utils.ConfigurationManagerFactory
4819

20+
import java.util.concurrent.ExecutorService
21+
import java.util.concurrent.Executors
22+
4923
import static java.util.Objects.requireNonNull
5024

5125
/**
@@ -58,38 +32,34 @@ import static java.util.Objects.requireNonNull
5832
* @since 1.0.0
5933
*
6034
*/
35+
@CompileStatic
6136
class DependencyManager {
62-
private VerticalLayout portletView
6337
private ConfigurationManager configurationManager
6438
private final PortalUser portalUser
65-
private final NotificationHandler notificationHandler
66-
67-
private LoadProjectsDataSource loadProjectsDataSource
68-
private LastChangedDateDataSource lastChangedDateDataSource
69-
private CountSamplesDataSource countSamplesDataSource
70-
private GetSamplesInfoDataSource getSamplesInfoDataSource
71-
private DownloadSamplesDataSource downloadSamplesDataSource
72-
private SubscriptionDataSource subscriptionDataSource
73-
private SubscribedProjectsDataSource subscribedProjectsDataSource
74-
private SampleStatusDataSource sampleStatusDataSource
75-
76-
private ResourceService<Project> projectResourceService
77-
private ResourceService<StatusCount> statusCountService
78-
private NotificationService notificationService
39+
7940
private Subscriber subscriptionUser
8041

81-
DependencyManager(PortalUser user) {
42+
private static final int PROJECT_LOADING_THREAD_COUNT = 2
43+
private static final int SAMPLE_LOADING_THREAD_COUNT = 2
44+
private final ExecutorService projectLoadingExecutor = Executors.newFixedThreadPool(PROJECT_LOADING_THREAD_COUNT)
45+
private final ExecutorService sampleLoadingExecutor = Executors.newFixedThreadPool(SAMPLE_LOADING_THREAD_COUNT)
46+
47+
48+
private OpenBisConnector openBisConnector
49+
private ProjectStatusComponentProvider projectStatusComponentProvider
50+
private SampleStatusComponentProvider sampleStatusComponentProvider
51+
private SubscriptionCheckboxProvider subscriptionCheckboxProvider
52+
private SampleTrackingConnector sampleTrackingConnector
53+
private SubscriptionDatabaseConnector subscriptionDatabaseConnector
54+
private NotificationCenter notificationCenter
55+
56+
DependencyManager(PortalUser user) {
8257
portalUser = user
8358
subscriptionUser = subscriberFor(portalUser)
8459
// Load the app environment configuration
8560
configurationManager = ConfigurationManagerFactory.getInstance()
8661

8762
initializeDependencies()
88-
notificationHandler = new NotificationHandler(notificationService)
89-
90-
populateProjectService()
91-
portletView = setupPortletView()
92-
populateStatusCountService()
9363
}
9464

9565
private static Subscriber subscriberFor(PortalUser portalUser) {
@@ -101,15 +71,11 @@ class DependencyManager {
10171

10272

10373
private void initializeDependencies() {
104-
setupDatabaseConnections()
105-
setupServices()
74+
setupDatabaseConnections()
75+
setupOpenBisConnection()
76+
setupSampleTracking()
10677
}
10778

108-
private void setupServices() {
109-
projectResourceService = new ProjectResourceService()
110-
statusCountService = new StatusCountResourceService()
111-
notificationService = new MessageBroker()
112-
}
11379

11480
private void setupDatabaseConnections() {
11581
String user = requireNonNull(configurationManager.getMysqlUser(), "Mysql user missing.")
@@ -119,108 +85,97 @@ class DependencyManager {
11985
String sqlDatabase = requireNonNull(configurationManager.getMysqlDB(), "Mysql database name missing.")
12086

12187
DatabaseSession.init(user, password, host, port, sqlDatabase)
122-
SampleTrackingService service = setUpTrackingService()
123-
SamplesDbConnector samplesDbConnector = new SamplesDbConnector(DatabaseSession.getInstance(),service)
124-
countSamplesDataSource = samplesDbConnector
125-
downloadSamplesDataSource = samplesDbConnector
126-
lastChangedDateDataSource = samplesDbConnector
127-
sampleStatusDataSource = samplesDbConnector
128-
129-
Credentials openBisCredentials = new Credentials(
130-
user: configurationManager.getDataSourceUser(),
131-
password: configurationManager.getDataSourcePassword()
132-
)
133-
OpenBisConnector openBisConnector = new OpenBisConnector(openBisCredentials, portalUser, configurationManager.getDataSourceUrl() + "/openbis/openbis")
134-
loadProjectsDataSource = openBisConnector
135-
lastChangedDateDataSource = samplesDbConnector
136-
137-
subscriptionDataSource = new SubscriptionsDbConnector(DatabaseSession.getInstance())
138-
getSamplesInfoDataSource = openBisConnector
139-
140-
141-
SubscriptionsDbConnector subscriptionsDbConnector = new SubscriptionsDbConnector(DatabaseSession.getInstance())
142-
subscriptionDataSource = subscriptionsDbConnector
143-
subscribedProjectsDataSource = subscriptionsDbConnector
144-
}
145-
146-
private SampleTrackingService setUpTrackingService(){
147-
String serviceURL = requireNonNull(configurationManager.getSampleTrackingServiceUrl())
148-
def user = requireNonNull(configurationManager.getServiceUser())
88+
subscriptionDatabaseConnector= new SubscriptionDatabaseConnector(DatabaseSession.getInstance(), subscriptionUser)
14989

150-
Credentials credentials = new Credentials(
151-
user: user.name,
152-
password: user.password
153-
)
90+
}
15491

155-
return new SampleTracking(serviceURL, credentials)
92+
private void setupOpenBisConnection() {
93+
Credentials openBisCredentials = new Credentials(
94+
user: configurationManager.getDataSourceUser(),
95+
password: configurationManager.getDataSourcePassword()
96+
)
97+
this.openBisConnector = new OpenBisConnector(openBisCredentials, portalUser, configurationManager.getDataSourceUrl() + "/openbis/openbis")
98+
}
99+
100+
private void setupSampleTracking() {
101+
if (Objects.nonNull(sampleTrackingConnector)) {
102+
return
156103
}
104+
def credentials = new Credentials(configurationManager.getServiceUser().name,
105+
configurationManager.getServiceUser().password)
106+
sampleTrackingConnector = new SampleTrackingConnector(configurationManager.getSampleTrackingServiceUrl(),
107+
"/v2/samples",
108+
"/status",
109+
"/v2/projects",
110+
credentials, getNgsSampleRepository())
111+
}
157112

158113
/**
159114
* @return the main view of the application
160115
* @since 1.0.0
161116
*/
162117
VerticalLayout getPortletView() {
163-
return portletView
118+
def projectView = new ProjectView(getProjectRepository(), getSubscriptionRepository(), getSampleStatusSummaryProvider(), getSubscriptionCheckboxProvider(), getDownloadManifestProvider())
119+
def sampleView = new SampleView(getSampleRepository(), getSampleStatusComponentProvider())
120+
return new MainView(projectView, sampleView, notificationCenter)
164121
}
165122

166-
private VerticalLayout setupPortletView() {
167-
ViewModel viewModel = new ViewModel(projectResourceService, statusCountService)
168-
SampleView sampleView = new SampleView(viewModel, notificationService)
169-
ProjectView projectView = new ProjectView(viewModel, setupSubscribeProjectUseCase(), notificationService, subscriptionUser, setupDownloadProjectUseCase(viewModel))
170-
SampleOverviewController sampleOverviewController = setupProjectSamplesUseCase(sampleView.getPresenter())
171-
172-
MainPage mainPage = new MainPage(projectView, sampleView, viewModel, sampleOverviewController)
123+
ProjectRepository getProjectRepository() {
124+
return openBisConnector
125+
}
173126

174-
return mainPage
175-
}
127+
SampleRepository getSampleRepository() {
128+
return openBisConnector
129+
}
176130

177-
private SampleOverviewController setupProjectSamplesUseCase(GetSamplesInfoOutput output) {
178-
GetSamplesInfo getSamplesInfo = new GetSamplesInfo(sampleStatusDataSource, downloadSamplesDataSource, getSamplesInfoDataSource, output)
179-
return new SampleOverviewController(getSamplesInfo)
131+
SampleStatusComponentProvider getSampleStatusComponentProvider() {
132+
if (Objects.nonNull(sampleStatusComponentProvider)) {
133+
return sampleStatusComponentProvider
180134
}
135+
sampleStatusComponentProvider = new SampleStatusComponentProvider(sampleLoadingExecutor, getSampleStatusProvider())
136+
return sampleStatusComponentProvider
137+
}
181138

182-
private DownloadProjectController setupDownloadProjectUseCase(ViewModel viewModel) {
183-
DownloadSamplesOutput output = new ManifestPresenter(notificationService, viewModel)
184-
DownloadSamples downloadSamples = new DownloadSamples(downloadSamplesDataSource, output)
185-
186-
return new DownloadProjectController(downloadSamples)
139+
ProjectStatusComponentProvider getSampleStatusSummaryProvider() {
140+
if (Objects.nonNull(projectStatusComponentProvider)) {
141+
return projectStatusComponentProvider
187142
}
188-
189-
private SubscribeProjectController setupSubscribeProjectUseCase() {
190-
SubscribeProjectOutput output = new SubscribeProjectPresenter(projectResourceService, notificationService)
191-
SubscribeProject subscribeProject = new SubscribeProject(subscriptionDataSource, output)
192-
return new SubscribeProjectController(subscribeProject)
143+
projectStatusComponentProvider = new ProjectStatusComponentProvider(projectLoadingExecutor, getProjectStatusProvider())
144+
return projectStatusComponentProvider
145+
}
146+
SampleStatusProvider getSampleStatusProvider() {
147+
return sampleTrackingConnector
148+
}
149+
150+
ProjectStatusProvider getProjectStatusProvider() {
151+
return sampleTrackingConnector
152+
}
153+
154+
SubscriptionRepository getSubscriptionRepository() {
155+
return subscriptionDatabaseConnector
156+
}
157+
158+
SubscriptionCheckboxProvider getSubscriptionCheckboxProvider() {
159+
if (Objects.nonNull(subscriptionCheckboxProvider)) {
160+
return subscriptionCheckboxProvider
193161
}
162+
subscriptionCheckboxProvider = new SubscriptionCheckboxProvider(getSubscriptionRepository(), getNotificationHandler())
163+
return subscriptionCheckboxProvider
164+
}
194165

195-
/**
196-
* Triggers the project loading initially to have data in the service
197-
* This is to be called after the view was initialized
198-
*/
199-
private void populateProjectService() {
200-
LoadProjectsOutput output = new LoadProjectsPresenter(projectResourceService, notificationService)
201-
LoadProjectsInput loadProjects = new LoadProjects(loadProjectsDataSource, output, lastChangedDateDataSource, subscribedProjectsDataSource)
202-
loadProjects.withSubscriptions(subscriptionUser)
166+
NotificationHandler getNotificationHandler() {
167+
if (Objects.nonNull(notificationCenter)) {
168+
return notificationCenter
203169
}
170+
notificationCenter = new NotificationCenter()
171+
return notificationCenter
172+
}
204173

205-
/**
206-
* Triggers the project status count loading initially to have data in the service
207-
*/
208-
private void populateStatusCountService() {
209-
CountSamplesOutput output = new CountSamplesPresenter(notificationService, statusCountService)
210-
CountSamples countSamples = new CountSamples(countSamplesDataSource, output)
211-
List<String> projectCodes = projectResourceService.iterator().collect {
212-
return it.code
213-
}
214-
projectCodes.each {
215-
countSamples.countSamplesPerStatus(it)
216-
}
217-
}
174+
DownloadManifestProvider getDownloadManifestProvider() {
175+
return sampleTrackingConnector
176+
}
218177

219-
/**
220-
* Returns the global notification center
221-
* @return a notification center that handles app notifications
222-
*/
223-
NotificationHandler getNotificationCenter() {
224-
return notificationHandler
225-
}
178+
NgsSampleRepository getNgsSampleRepository() {
179+
return openBisConnector
180+
}
226181
}

0 commit comments

Comments
 (0)