Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
ea7bc51
Prepare next release 5.5.0-SNAPSHOT
juanfeSanahuja Jan 27, 2025
30c341f
Prepare release 6.1.0 XB-3.1.0 #TASK-7456
juanfeSanahuja Apr 14, 2025
355e273
lib: Add async command execution. Allow stdin forwarding. #TASK-7524
j-coll May 9, 2025
64fbb5f
lib: Remove unused constant #TASK-7524
j-coll May 9, 2025
5b94b55
Merge branch 'TASK-7693' into TASK-7693-rel
juanfeSanahuja May 22, 2025
b82af6d
Merge pull request #110 from opencb/TASK-7693-rel
juanfeSanahuja May 28, 2025
c2490e9
Prepare release 5.5.0
juanfeSanahuja Jun 5, 2025
804162d
Prepare next release 5.6.0-SNAPSHOT
juanfeSanahuja Jun 5, 2025
e1b66f8
Merge branch 'release-6.x.x' into TASK-7524
pfurio Jun 13, 2025
b95a575
Merge pull request #109 from opencb/TASK-7524
jtarraga Jun 14, 2025
d993fdd
Prepare release 5.6.0
juanfeSanahuja Jul 30, 2025
995e70f
Prepare next release 5.7.0-SNAPSHOT
juanfeSanahuja Jul 30, 2025
eb02517
pom: Update distributionManagement #TASK-7783
juanfeSanahuja Jul 31, 2025
55a2603
Prepare release 5.6.0
juanfeSanahuja Jul 31, 2025
8b84ae6
Prepare next release 5.7.0-SNAPSHOT
juanfeSanahuja Jul 31, 2025
68138db
pom: Update distributionManagement #TASK-7783
juanfeSanahuja Jul 31, 2025
cc3aef6
cicd: Rewrite the settings.xml for maven #TASK-7783
juanfeSanahuja Aug 1, 2025
c48c284
cicd: delete runner.tool_cache #TASK-7783
juanfeSanahuja Aug 1, 2025
11e8c1f
cicd: fix base64 error #TASK-7783
juanfeSanahuja Aug 1, 2025
51dd144
cicd: Configure GPG for loopback pinentry #TASK-7783
juanfeSanahuja Aug 1, 2025
a02546e
cicd: Rename server id to ossrh #TASK-7783
juanfeSanahuja Aug 1, 2025
5db1c8d
cicd: Update url to server id to ossrh #TASK-7783
juanfeSanahuja Aug 1, 2025
92e5a11
cicd: Deleted org.sonatype.plugins:nexus-staging-maven-plugin and dis…
juanfeSanahuja Aug 1, 2025
521ae4e
cicd: Force the snapshot endpoint and authenticate there #TASK-7783
juanfeSanahuja Aug 1, 2025
9b4ba6c
cicd: the plugin will use distributionManagement when your version en…
juanfeSanahuja Aug 1, 2025
340a1a4
cicd: Unified publishing plugin for Sonatype Central releases and sna…
juanfeSanahuja Aug 1, 2025
f31ebc6
cicd: Unified publishing plugin using distribution management for Son…
juanfeSanahuja Aug 1, 2025
c5d89af
cicd: Delete snapshot url #TASK-7783
juanfeSanahuja Aug 4, 2025
959ab47
cicd: Delete snapshot url #TASK-7783
juanfeSanahuja Aug 4, 2025
8897b73
cicd: Delete snapshot url #TASK-7783
juanfeSanahuja Aug 4, 2025
f96de9c
cicd: Update distributionManagement #TASK-7783
juanfeSanahuja Aug 4, 2025
7d3df08
cicd: Update distributionManagement #TASK-7783
juanfeSanahuja Aug 4, 2025
1d8d71f
cicd: Migrate deploy sonatype maven plugin to central-publishing-mave…
juanfeSanahuja Aug 4, 2025
40d5e34
cicd: Delete space after P to specify profiles #TASK-7783
juanfeSanahuja Aug 4, 2025
3f6b804
cicd: Copy distributionmanagement inside the profile tag #TASK-7783
juanfeSanahuja Aug 4, 2025
821fcf8
Prepare release 5.6.0
juanfeSanahuja Aug 4, 2025
ecef6b6
Prepare next release 5.7.0-SNAPSHOT
juanfeSanahuja Aug 4, 2025
6cdfa9c
cicd: FIX mvn repository profile #TASK-7783
juanfeSanahuja Aug 4, 2025
b46c060
cicd: FIX maven-javadoc-plugin #TASK-7783
juanfeSanahuja Aug 4, 2025
ac6d240
Prepare release 5.6.0
juanfeSanahuja Aug 4, 2025
8e4cb89
Prepare next release 5.7.0-SNAPSHOT
juanfeSanahuja Aug 4, 2025
cffe317
cicd: FIX Project name is missing #TASK-7783
juanfeSanahuja Aug 4, 2025
19a11f4
Prepare release 5.6.0
juanfeSanahuja Aug 4, 2025
92e40df
Preparing port patch from version 5.6.0 to 6.1.0-SNAPSHOT
juanfeSanahuja Aug 11, 2025
957ac3b
Merge branch 'release-6.x.x' into TASK-7843
juanfeSanahuja Aug 11, 2025
12e81e5
Merge pull request #119 from opencb/TASK-7843
juanfeSanahuja Aug 12, 2025
77f2812
datastore: add smart splitter that would consider quotes, #TASK-7881
pfurio Aug 12, 2025
6a637e3
Merge branch 'release-6.x.x' into TASK-7881
pfurio Aug 12, 2025
19e2c23
Delete cellbase references in Xetabase test #TASK-7884
juanfeSanahuja Aug 14, 2025
4b1e90a
Delete cellbase references in Xetabase test #TASK-7883
juanfeSanahuja Aug 14, 2025
a1c16f4
Merge branch 'TASK-7883' of github.com:opencb/java-common-libs into T…
juanfeSanahuja Aug 14, 2025
024ed22
Update test reference to use the current branch workflow #TASK-7883
juanfeSanahuja Aug 14, 2025
4a2a035
Update test reference to use the current branch workflow #TASK-7883
juanfeSanahuja Aug 14, 2025
8f76683
Add sam tolls because it is necessary for test #TASK-7883
juanfeSanahuja Aug 14, 2025
5b05d36
Add sam tolls because it is necessary for test #TASK-7883
juanfeSanahuja Aug 14, 2025
335899c
Merge pull request #120 from opencb/TASK-7881
j-coll Aug 20, 2025
f3ef06b
Merge branch 'release-6.x.x' into TASK-7883
juanfeSanahuja Sep 3, 2025
6c0efb4
Merge pull request #121 from opencb/TASK-7883
juanfeSanahuja Sep 3, 2025
f6992e9
Prepare release 6.1.0
juanfeSanahuja Sep 5, 2025
06b3582
Preparing port patch from version 6.1.0 to 7.0.0-SNAPSHOT
juanfeSanahuja Sep 15, 2025
fb371b3
Merge branch 'develop' into TASK-7786
juanfeSanahuja Sep 15, 2025
1331e2d
Merge branch 'develop' into TASK-7786
juanfeSanahuja Oct 7, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/deploy-maven-repository-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase
- name: Deploy to Maven Central repository
run: mvn clean deploy -DskipTests -P deploy-maven ${{ inputs.maven_opts }} --no-transfer-progress
run: mvn clean deploy -DskipTests -Pdeploy-maven ${{ inputs.maven_opts }} --no-transfer-progress

Check failure

Code scanning / SonarCloud

GitHub Actions should not be vulnerable to script injections High

Change this workflow to not use user-controlled data directly in a run block. See more on SonarQube Cloud
env:
MAVEN_NEXUS_USER: ${{ secrets.MAVEN_USER_TOKEN }}
MAVEN_NEXUS_PASSWORD: ${{ secrets.MAVEN_PASSWORD_TOKEN }}
Expand All @@ -44,6 +44,6 @@
distribution: 'temurin'
java-version: '8'
- name: Deploy to GitHub Packages repository
run: mvn clean deploy -DskipTests -P deploy-github ${{ inputs.maven_opts }} --no-transfer-progress
run: mvn clean deploy -DskipTests -Pdeploy-github ${{ inputs.maven_opts }} --no-transfer-progress

Check failure

Code scanning / SonarCloud

GitHub Actions should not be vulnerable to script injections High

Change this workflow to not use user-controlled data directly in a run block. See more on SonarQube Cloud
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/pull-request-approved.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
test:
name: "Run all tests before merging"
needs: calculate-xetabase-branch
uses: opencb/java-common-libs/.github/workflows/test-xetabase-workflow.yml@develop
uses: ./.github/workflows/test-xetabase-workflow.yml
with:
branch: ${{ needs.calculate-xetabase-branch.outputs.xetabase_branch }}
task: ${{ github.event.pull_request.head.ref }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ jobs:
check_name: "Surefire tests report"
report_paths: './**/surefire-reports/TEST-*.xml'
commit: '${{ github.sha }}'
fail_on_test_failures: true
fail_on_test_failures: true
15 changes: 2 additions & 13 deletions .github/workflows/test-xetabase-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,17 +77,6 @@
with:
mongodb-version: 6.0
mongodb-replica-set: rs-test
- name: K8s Tunnel MongoDB
run: |
wget https://dl.k8s.io/release/v1.28.2/bin/linux/amd64/kubectl
chmod +x ./kubectl
echo "${{ secrets.AZURE_KUBE_CONFIG }}" > admin.conf
./kubectl -n cellbase-db port-forward services/cellbase-rs0-svc 27018:27017 --kubeconfig ./admin.conf &
- name: DockerHub login
uses: docker/login-action@v3
with:
username: ${{ env.DOCKER_HUB_USER }}
password: ${{ env.DOCKER_HUB_PASSWORD }}
- name: Install sshpass
run: sudo apt-get install sshpass
- name: Add SSH Host to known_hosts
Expand All @@ -97,11 +86,11 @@
env:
SSH_HOST: ${{ env.SSH_HOST }}
SSH_PORT: ${{ env.SSH_PORT }}
- name: Run all OpenCB Junit tests, ie. java-common-libs, biodata, cellbase, opencga and opencga-enterprise
- name: Run all OpenCB Junit tests, ie. java-common-libs, biodata, opencga and opencga-enterprise
run: |
cd opencga-enterprise
ln -s ../opencga opencga-home
./build.sh -t -l runShortTests -b -s -T ${{ inputs.task }} -c localhost:27018 -H hdp3.1
./build.sh -t -l runShortTests -b -s -T ${{ inputs.task }}

Check failure

Code scanning / SonarCloud

GitHub Actions should not be vulnerable to script injections High test

Change this workflow to not use user-controlled data directly in a run block. See more on SonarQube Cloud
- name: Upload reports results to Github
uses: actions/upload-artifact@v4
with:
Expand Down
4 changes: 4 additions & 0 deletions commons-datastore/commons-datastore-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
<artifactId>commons-datastore-core</artifactId>
<packaging>jar</packaging>

<name>OpenCB commons-datastore-core project</name>
<description>OpenCB commons project contains several Java libs for Bioinformatics</description>
<url>http://www.opencb.org</url>

<dependencies>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ public class ObjectMap implements Map<String, Object>, Serializable {

private static final Pattern KEY_SPLIT_PATTERN = Pattern.compile("(^[^\\[\\].]+(?:\\[[^\\]]+\\])?)(?:\\.(.*))*");
private static final Pattern LIST_FILTER_PATTERN = Pattern.compile("([^\\[\\]]+)\\[([^=]*?)(?:[=]?)([^=]+)\\]$");
public static final Pattern COMMA_SEPARATED_LIST_SPLIT_PATTERN = Pattern.compile("((?:(?!,\\S).)+)+");

public ObjectMap() {
objectMap = new LinkedHashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,35 +263,4 @@ public void testGetWithFilterFromList() {
assertEquals("CGHI", objectMap.get("nestedList[nested.value=G].nested.list[id=Cghi].name"));
}

@Test
public void testPatternListSplit() {
List<String> originalValues = Arrays.asList("disorder1", "disorder2, blabla", "disorder3");
objectMap.put("key", StringUtils.join(originalValues, ","));
objectMap.put("key1", "");
objectMap.put("key2", "my value");
objectMap.put("key3", Arrays.asList("1", "2"));
objectMap.put("key4", Arrays.asList(1, 2));

List<String> values = objectMap.getAsStringList("key", ObjectMap.COMMA_SEPARATED_LIST_SPLIT_PATTERN);
assertEquals(originalValues.size(), values.size());
assertTrue(originalValues.containsAll(values));

values = objectMap.getAsStringList("key1", ObjectMap.COMMA_SEPARATED_LIST_SPLIT_PATTERN);
assertEquals(1, values.size());
assertEquals("", values.get(0));

values = objectMap.getAsStringList("key2", ObjectMap.COMMA_SEPARATED_LIST_SPLIT_PATTERN);
assertEquals(1, values.size());
assertEquals("my value", values.get(0));

values = objectMap.getAsStringList("key3", ObjectMap.COMMA_SEPARATED_LIST_SPLIT_PATTERN);
assertEquals(2, values.size());
assertEquals("1", values.get(0));
assertEquals("2", values.get(1));

values = objectMap.getAsStringList("key4", ObjectMap.COMMA_SEPARATED_LIST_SPLIT_PATTERN);
assertEquals(2, values.size());
assertEquals("1", values.get(0));
assertEquals("2", values.get(1));
}
}
4 changes: 4 additions & 0 deletions commons-datastore/commons-datastore-mongodb/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
<artifactId>commons-datastore-mongodb</artifactId>
<packaging>jar</packaging>

<name>OpenCB commons-datastore-mongodb project</name>
<description>OpenCB commons project contains several Java libs for Bioinformatics</description>
<url>http://www.opencb.org</url>

<dependencies>
<dependency>
<groupId>org.opencb.commons</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@

import static com.mongodb.client.model.Aggregates.*;
import static com.mongodb.client.model.Projections.*;
import static org.opencb.commons.datastore.mongodb.MongoDBQueryUtils.Accumulator.*;
import static org.opencb.commons.datastore.mongodb.MongoDBQueryUtils.Accumulator.bucket;
import static org.opencb.commons.datastore.mongodb.MongoDBQueryUtils.Accumulator.count;
import static org.opencb.commons.datastore.mongodb.MongoDBQueryUtils.Accumulator.*;

/**
* Created by imedina on 17/01/16.
Expand Down Expand Up @@ -178,6 +178,53 @@ public static Bson createFilter(String mongoDbField, String queryParam, Query qu
return filter;
}

/**
* Splits a string by the given separator, handling quoted values properly.
* Quoted values can contain the separator character without being split.
* Removes surrounding quotes and trims whitespace from each value.
*
* @param input the input string to split
* @param separator the separator to split by ("," or ";")
* @return list of trimmed, unquoted values
*/
public static List<String> smartSplit(String input, String separator) {
List<String> result = new ArrayList<>();
if (input == null || input.isEmpty()) {
return result;
}

boolean inQuotes = false;
StringBuilder currentValue = new StringBuilder();

for (int i = 0; i < input.length(); i++) {
char c = input.charAt(i);

if (c == '"') {
inQuotes = !inQuotes;
} else if (!inQuotes && input.substring(i).startsWith(separator)) {
// Found separator outside quotes
String value = currentValue.toString().trim();
if (value.startsWith("\"") && value.endsWith("\"") && value.length() > 1) {
value = value.substring(1, value.length() - 1);
}
result.add(value.trim());
currentValue = new StringBuilder();
i += separator.length() - 1; // Skip the separator
} else {
currentValue.append(c);
}
}

// Add the last value
String value = currentValue.toString().trim();
if (value.startsWith("\"") && value.endsWith("\"") && value.length() > 1) {
value = value.substring(1, value.length() - 1);
}
result.add(value.trim());

return result;
}

private static String getLogicalSeparator(LogicalOperator operator) {
return (operator != null && operator.equals(LogicalOperator.AND)) ? AND : OR;
}
Expand Down Expand Up @@ -258,8 +305,13 @@ protected static String getOp2(String op, String value) {

public static Bson createAutoFilter(String mongoDbField, String queryParam, Query query, QueryParam.Type type, LogicalOperator operator)
throws NumberFormatException {

List<String> queryParamList = query.getAsStringList(queryParam, getLogicalSeparator(operator));
List<String> queryParamList;
String value = query.getString(queryParam);
if (StringUtils.isNotEmpty(value) && value.contains("\"")) {
queryParamList = smartSplit(value, getLogicalSeparator(operator));
} else {
queryParamList = query.getAsStringList(queryParam, getLogicalSeparator(operator));
}
return createAutoFilter(mongoDbField, queryParam, type, operator, queryParamList);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
package org.opencb.commons.datastore.mongodb;

import org.junit.Test;
import java.util.List;
import static org.junit.Assert.assertEquals;

public class SmartSplitTest {

@Test
public void testSmartSplitWithQuotedCommaValues() {
String input = "\"a \",\" b\",\" c \"";
List<String> result = MongoDBQueryUtils.smartSplit(input, ",");

assertEquals(3, result.size());
assertEquals("a", result.get(0));
assertEquals("b", result.get(1));
assertEquals("c", result.get(2));
}

@Test
public void testSmartSplitWithQuotedSemicolonValues() {
String input = "\"a \";\" b\";\" c \"";
List<String> result = MongoDBQueryUtils.smartSplit(input, ";");

assertEquals(3, result.size());
assertEquals("a", result.get(0));
assertEquals("b", result.get(1));
assertEquals("c", result.get(2));
}

@Test
public void testSmartSplitWithNonQuotedValues() {
String input = "a,b,c";
List<String> result = MongoDBQueryUtils.smartSplit(input, ",");

assertEquals(3, result.size());
assertEquals("a", result.get(0));
assertEquals("b", result.get(1));
assertEquals("c", result.get(2));
}

@Test
public void testSmartSplitWithNonQuotedValuesAndSpaces() {
String input = "a, b,c ";
List<String> result = MongoDBQueryUtils.smartSplit(input, ",");

assertEquals(3, result.size());
assertEquals("a", result.get(0));
assertEquals("b", result.get(1));
assertEquals("c", result.get(2));
}

@Test
public void testSmartSplitWithMixedValues() {
String input = "\"a, with comma\",b,\"c\"";
List<String> result = MongoDBQueryUtils.smartSplit(input, ",");

assertEquals(3, result.size());
assertEquals("a, with comma", result.get(0));
assertEquals("b", result.get(1));
assertEquals("c", result.get(2));
}
}
5 changes: 5 additions & 0 deletions commons-datastore/commons-datastore-solr/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@
<artifactId>commons-datastore-solr</artifactId>
<packaging>jar</packaging>

<name>OpenCB commons-datastore-solr project</name>
<description>OpenCB commons project contains several Java libs for Bioinformatics</description>
<url>http://www.opencb.org</url>


<dependencies>
<dependency>
<groupId>org.opencb.commons</groupId>
Expand Down
5 changes: 5 additions & 0 deletions commons-datastore/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
<artifactId>commons-datastore</artifactId>
<packaging>pom</packaging>

<name>OpenCB commons-datastore project</name>
<description>OpenCB commons project contains several Java libs for Bioinformatics</description>
<url>http://www.opencb.org</url>


<modules>
<module>commons-datastore-core</module>
<module>commons-datastore-mongodb</module>
Expand Down
4 changes: 4 additions & 0 deletions commons-lib/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
<artifactId>commons-lib</artifactId>
<packaging>jar</packaging>

<name>OpenCB commons-lib project</name>
<description>OpenCB commons project contains several Java libs for Bioinformatics</description>
<url>http://www.opencb.org</url>

<dependencies>
<dependency>
<groupId>org.opencb.commons</groupId>
Expand Down
Loading
Loading