Skip to content

Commit d4cba15

Browse files
committed
lib: refactor code by changing the DownloadProperties.URLProperties, #TASK-5775, #TASK-5564
1 parent df0f1e0 commit d4cba15

File tree

16 files changed

+387
-1339
lines changed

16 files changed

+387
-1339
lines changed

cellbase-app/src/main/java/org/opencb/cellbase/app/cli/admin/executors/BuildCommandExecutor.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ private CellBaseBuilder buildConservation() {
349349
}
350350

351351
private CellBaseBuilder buildClinicalVariants() throws CellBaseException {
352-
Path clinicalVariantFolder = downloadFolder.resolve(EtlCommons.CLINICAL_VARIANTS_FOLDER);
352+
Path clinicalVariantFolder = downloadFolder.resolve(EtlCommons.CLINICAL_VARIANTS_FOLDER_NAME);
353353

354354
List<Path> versionFiles = new ArrayList<>();
355355
List<String> versionFilenames = Arrays.asList(CLINVAR_VERSION_FILENAME, COSMIC_VERSION_FILENAME, GWAS_VERSION_FILENAME,

cellbase-core/src/main/java/org/opencb/cellbase/core/config/DownloadProperties.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
package org.opencb.cellbase.core.config;
1818

19-
import java.util.List;
19+
import java.util.Map;
2020

2121
/**
2222
* Created by imedina on 19/08/16.
@@ -614,7 +614,7 @@ public static class URLProperties {
614614

615615
private String host;
616616
private String version;
617-
private List<String> files;
617+
private Map<String, String> files;
618618

619619
public String getHost() {
620620
return host;
@@ -633,11 +633,11 @@ public URLProperties setVersion(String version) {
633633
return this;
634634
}
635635

636-
public List<String> getFiles() {
636+
public Map<String, String> getFiles() {
637637
return files;
638638
}
639639

640-
public URLProperties setFiles(List<String> files) {
640+
public URLProperties setFiles(Map<String, String> files) {
641641
this.files = files;
642642
return this;
643643
}

cellbase-core/src/main/java/org/opencb/cellbase/core/models/DataRelease.java

+4-18
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,9 @@
2121
public class DataRelease {
2222
private int release;
2323
private String date;
24-
/**
25-
* @deprecated it is maintained to back-compatibility with previous CellBase versions to v5.5
26-
*/
27-
@Deprecated
28-
private boolean active;
2924
private List<String> activeByDefaultIn;
3025
private Map<String, String> collections;
31-
private List<DataReleaseSource> sources;
26+
private List<DataSource> sources;
3227

3328
public DataRelease() {
3429
this.activeByDefaultIn = Collections.emptyList();
@@ -37,7 +32,7 @@ public DataRelease() {
3732
}
3833

3934
public DataRelease(int release, String date, List<String> activeByDefaultIn, Map<String, String> collections,
40-
List<DataReleaseSource> sources) {
35+
List<DataSource> sources) {
4136
this.release = release;
4237
this.date = date;
4338
this.activeByDefaultIn = activeByDefaultIn;
@@ -75,15 +70,6 @@ public DataRelease setDate(String date) {
7570
return this;
7671
}
7772

78-
public boolean isActive() {
79-
return active;
80-
}
81-
82-
public DataRelease setActive(boolean active) {
83-
this.active = active;
84-
return this;
85-
}
86-
8773
public List<String> getActiveByDefaultIn() {
8874
return activeByDefaultIn;
8975
}
@@ -102,11 +88,11 @@ public DataRelease setCollections(Map<String, String> collections) {
10288
return this;
10389
}
10490

105-
public List<DataReleaseSource> getSources() {
91+
public List<DataSource> getSources() {
10692
return sources;
10793
}
10894

109-
public DataRelease setSources(List<DataReleaseSource> sources) {
95+
public DataRelease setSources(List<DataSource> sources) {
11096
this.sources = sources;
11197
return this;
11298
}

cellbase-core/src/main/java/org/opencb/cellbase/core/models/DataReleaseSource.java

-117
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
/*
2+
* Copyright 2015-2020 OpenCB
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.opencb.cellbase.core.models;
18+
19+
import java.util.ArrayList;
20+
import java.util.List;
21+
22+
public class DataSource {
23+
24+
private String name;
25+
private String category;
26+
private String version;
27+
private String downloadDate;
28+
private List<String> urls;
29+
30+
public DataSource() {
31+
this.urls = new ArrayList<>();
32+
}
33+
34+
public DataSource(String name, String category, String version, String downloadDate, List<String> urls) {
35+
this.name = name;
36+
this.category = category;
37+
this.version = version;
38+
this.downloadDate = downloadDate;
39+
this.urls = urls;
40+
}
41+
42+
@Override
43+
public String toString() {
44+
final StringBuilder sb = new StringBuilder("DataSourceDescr{");
45+
sb.append("name='").append(name).append('\'');
46+
sb.append(", category='").append(category).append('\'');
47+
sb.append(", version='").append(version).append('\'');
48+
sb.append(", downloadDate='").append(downloadDate).append('\'');
49+
sb.append(", urls=").append(urls);
50+
sb.append('}');
51+
return sb.toString();
52+
}
53+
54+
public String getName() {
55+
return name;
56+
}
57+
58+
public DataSource setName(String name) {
59+
this.name = name;
60+
return this;
61+
}
62+
63+
public String getCategory() {
64+
return category;
65+
}
66+
67+
public DataSource setCategory(String category) {
68+
this.category = category;
69+
return this;
70+
}
71+
72+
public String getVersion() {
73+
return version;
74+
}
75+
76+
public DataSource setVersion(String version) {
77+
this.version = version;
78+
return this;
79+
}
80+
81+
public String getDownloadDate() {
82+
return downloadDate;
83+
}
84+
85+
public DataSource setDownloadDate(String downloadedDate) {
86+
this.downloadDate = downloadedDate;
87+
return this;
88+
}
89+
90+
public List<String> getUrls() {
91+
return urls;
92+
}
93+
94+
public DataSource setUrls(List<String> urls) {
95+
this.urls = urls;
96+
return this;
97+
}
98+
}

0 commit comments

Comments
 (0)