Skip to content

Commit

Permalink
lib: refactor code by changing the DownloadProperties.URLProperties, …
Browse files Browse the repository at this point in the history
…#TASK-5775, #TASK-5564
  • Loading branch information
jtarraga committed Apr 5, 2024
1 parent df0f1e0 commit d4cba15
Show file tree
Hide file tree
Showing 16 changed files with 387 additions and 1,339 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ private CellBaseBuilder buildConservation() {
}

private CellBaseBuilder buildClinicalVariants() throws CellBaseException {
Path clinicalVariantFolder = downloadFolder.resolve(EtlCommons.CLINICAL_VARIANTS_FOLDER);
Path clinicalVariantFolder = downloadFolder.resolve(EtlCommons.CLINICAL_VARIANTS_FOLDER_NAME);

List<Path> versionFiles = new ArrayList<>();
List<String> versionFilenames = Arrays.asList(CLINVAR_VERSION_FILENAME, COSMIC_VERSION_FILENAME, GWAS_VERSION_FILENAME,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package org.opencb.cellbase.core.config;

import java.util.List;
import java.util.Map;

/**
* Created by imedina on 19/08/16.
Expand Down Expand Up @@ -614,7 +614,7 @@ public static class URLProperties {

private String host;
private String version;
private List<String> files;
private Map<String, String> files;

public String getHost() {
return host;
Expand All @@ -633,11 +633,11 @@ public URLProperties setVersion(String version) {
return this;
}

public List<String> getFiles() {
public Map<String, String> getFiles() {
return files;
}

public URLProperties setFiles(List<String> files) {
public URLProperties setFiles(Map<String, String> files) {
this.files = files;
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,9 @@
public class DataRelease {
private int release;
private String date;
/**
* @deprecated it is maintained to back-compatibility with previous CellBase versions to v5.5
*/
@Deprecated
private boolean active;
private List<String> activeByDefaultIn;
private Map<String, String> collections;
private List<DataReleaseSource> sources;
private List<DataSource> sources;

public DataRelease() {
this.activeByDefaultIn = Collections.emptyList();
Expand All @@ -37,7 +32,7 @@ public DataRelease() {
}

public DataRelease(int release, String date, List<String> activeByDefaultIn, Map<String, String> collections,
List<DataReleaseSource> sources) {
List<DataSource> sources) {
this.release = release;
this.date = date;
this.activeByDefaultIn = activeByDefaultIn;
Expand Down Expand Up @@ -75,15 +70,6 @@ public DataRelease setDate(String date) {
return this;
}

public boolean isActive() {
return active;
}

public DataRelease setActive(boolean active) {
this.active = active;
return this;
}

public List<String> getActiveByDefaultIn() {
return activeByDefaultIn;
}
Expand All @@ -102,11 +88,11 @@ public DataRelease setCollections(Map<String, String> collections) {
return this;
}

public List<DataReleaseSource> getSources() {
public List<DataSource> getSources() {
return sources;
}

public DataRelease setSources(List<DataReleaseSource> sources) {
public DataRelease setSources(List<DataSource> sources) {
this.sources = sources;
return this;
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
/*
* Copyright 2015-2020 OpenCB
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.opencb.cellbase.core.models;

import java.util.ArrayList;
import java.util.List;

public class DataSource {

private String name;
private String category;
private String version;
private String downloadDate;
private List<String> urls;

public DataSource() {
this.urls = new ArrayList<>();
}

public DataSource(String name, String category, String version, String downloadDate, List<String> urls) {
this.name = name;
this.category = category;
this.version = version;
this.downloadDate = downloadDate;
this.urls = urls;
}

@Override
public String toString() {
final StringBuilder sb = new StringBuilder("DataSourceDescr{");
sb.append("name='").append(name).append('\'');
sb.append(", category='").append(category).append('\'');
sb.append(", version='").append(version).append('\'');
sb.append(", downloadDate='").append(downloadDate).append('\'');
sb.append(", urls=").append(urls);
sb.append('}');
return sb.toString();
}

public String getName() {
return name;
}

public DataSource setName(String name) {
this.name = name;
return this;
}

public String getCategory() {
return category;
}

public DataSource setCategory(String category) {
this.category = category;
return this;
}

public String getVersion() {
return version;
}

public DataSource setVersion(String version) {
this.version = version;
return this;
}

public String getDownloadDate() {
return downloadDate;
}

public DataSource setDownloadDate(String downloadedDate) {
this.downloadDate = downloadedDate;
return this;
}

public List<String> getUrls() {
return urls;
}

public DataSource setUrls(List<String> urls) {
this.urls = urls;
return this;
}
}
Loading

0 comments on commit d4cba15

Please sign in to comment.