From 604b6b18159dadfde8ff0ad0cc6e2957ae61780b Mon Sep 17 00:00:00 2001 From: Surabhi Date: Fri, 8 Jul 2022 17:02:08 +0530 Subject: [PATCH 1/3] version change - 2.0.0 --- .github/workflows/build-deploy.yml | 6 +++--- .github/workflows/build.yml | 4 ++-- pom.xml | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build-deploy.yml b/.github/workflows/build-deploy.yml index a5066d6..a39809a 100644 --- a/.github/workflows/build-deploy.yml +++ b/.github/workflows/build-deploy.yml @@ -4,10 +4,10 @@ on: tags: - 'v*.*.*' branches: - ["release-4.9.0", "release-4.10.0", "merged"] + ["release-4.9.0", "release-4.10.0", "v2-integration"] pull_request: branches: - ["release-4.9.0", "release-4.10.0", "merged"] + ["release-4.9.0", "release-4.10.0", "v2-integration"] jobs: @@ -58,7 +58,7 @@ jobs: - name: Delete package specific version uses: smartsquaregmbh/delete-old-packages@v0.4.0 with: - version: 4.9.0 # This should be same as in the pom.xml file, + version: 2.0.0 # This should be same as in the pom.xml file, # to delete only the pom specified version, not the other older versions names: | com.uci.dao diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8cd0ed7..0178c07 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,10 +2,10 @@ name: Build on Push & Pull Request on: push: branches: - ["release-4.9.0", "release-4.10.0", "merged"] + ["release-4.9.0", "release-4.10.0", "v2-integration"] pull_request: branches: - ["release-4.9.0", "release-4.10.0", "merged"] + ["release-4.9.0", "release-4.10.0", "v2-integration"] jobs: build: diff --git a/pom.xml b/pom.xml index d03bbb4..66a1641 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ dao dao jar - 4.9.0 + 2.0.0 @@ -99,13 +99,13 @@ com.uci message-rosa - 4.9.0 + 2.0.0 compile com.uci utils - 4.9.0 + 2.0.0 compile From 67952addf649edc09d80fdabe26cebc1298e8ad5 Mon Sep 17 00:00:00 2001 From: Surabhi Date: Wed, 24 Aug 2022 10:42:51 +0530 Subject: [PATCH 2/3] cassandra config minor fix --- .../com/uci/dao/config/CassandraConfig.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/main/java/com/uci/dao/config/CassandraConfig.java b/src/main/java/com/uci/dao/config/CassandraConfig.java index fb96a2d..b62f73d 100644 --- a/src/main/java/com/uci/dao/config/CassandraConfig.java +++ b/src/main/java/com/uci/dao/config/CassandraConfig.java @@ -2,16 +2,21 @@ import com.datastax.driver.core.Cluster; import com.datastax.driver.core.QueryLogger; +import com.datastax.oss.driver.api.core.CqlSessionBuilder; +import com.datastax.oss.driver.api.core.config.DefaultDriverOption; +import com.datastax.oss.driver.api.core.config.DriverConfigLoader; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.data.cassandra.config.AbstractReactiveCassandraConfiguration; import org.springframework.data.cassandra.config.SchemaAction; +import org.springframework.data.cassandra.config.SessionBuilderConfigurer; import org.springframework.data.cassandra.core.cql.keyspace.CreateKeyspaceSpecification; import org.springframework.data.cassandra.core.cql.keyspace.DropKeyspaceSpecification; import org.springframework.data.cassandra.core.cql.keyspace.KeyspaceOption; import org.springframework.data.cassandra.repository.config.EnableReactiveCassandraRepositories; +import java.time.Duration; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -73,6 +78,17 @@ protected List getKeyspaceCreations() { return Collections.singletonList(specification); } +// @Override +// protected SessionBuilderConfigurer getSessionBuilderConfigurer() { +// return new SessionBuilderConfigurer() { +// @Override +// public CqlSessionBuilder configure(CqlSessionBuilder cqlSessionBuilder) { +// return cqlSessionBuilder +// .withConfigLoader(DriverConfigLoader.programmaticBuilder().withDuration(DefaultDriverOption.REQUEST_TIMEOUT, Duration.ofMillis(15000)).build()); +// } +// }; +// } + /** * Get list of scripts run on startup * @return @@ -85,6 +101,10 @@ protected List getStartupScripts() { if (migrationCount > 0) { count = migrationCount; } + if(migrationCount > all.size()) { + count = all.size(); + } + System.out.println("Count: "+count+", migrationCount: "+migrationCount); } catch(NumberFormatException ex){ System.out.println("NumberFormatException: " + ex.getMessage()); } catch(Exception ex){ @@ -126,6 +146,7 @@ protected List getMigrationScripts() { allScripts.add("ALTER TABLE " + keyspace + ".XMessage ADD ownerId text;"); allScripts.add("ALTER TABLE " + keyspace + ".XMessage ADD botUuid uuid;"); + // allScripts.add("CREATE INDEX IF NOT EXISTS message_state_index\n" + // "ON "+keyspace // +".XMessage ( KEYS ( messageState ) ) "); From 76fbcb40c22b1a54e668d352a758eeedfe97237c Mon Sep 17 00:00:00 2001 From: Surabhi Date: Tue, 30 Aug 2022 11:05:03 +0530 Subject: [PATCH 3/3] tags in xMessageDao & cassandra config --- src/main/java/com/uci/dao/config/CassandraConfig.java | 2 +- src/main/java/com/uci/dao/models/XMessageDAO.java | 4 ++++ .../java/com/uci/dao/repository/XMessageRepository.java | 6 ++++++ src/main/java/com/uci/dao/utils/XMessageDAOUtils.java | 1 + 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/uci/dao/config/CassandraConfig.java b/src/main/java/com/uci/dao/config/CassandraConfig.java index b62f73d..21b33ff 100644 --- a/src/main/java/com/uci/dao/config/CassandraConfig.java +++ b/src/main/java/com/uci/dao/config/CassandraConfig.java @@ -145,7 +145,7 @@ protected List getMigrationScripts() { allScripts.add("ALTER TABLE " + keyspace + ".XMessage ADD ownerOrgId text;"); allScripts.add("ALTER TABLE " + keyspace + ".XMessage ADD ownerId text;"); allScripts.add("ALTER TABLE " + keyspace + ".XMessage ADD botUuid uuid;"); - + allScripts.add("ALTER TABLE " + keyspace + ".XMessage ADD tags list;"); // allScripts.add("CREATE INDEX IF NOT EXISTS message_state_index\n" + // "ON "+keyspace diff --git a/src/main/java/com/uci/dao/models/XMessageDAO.java b/src/main/java/com/uci/dao/models/XMessageDAO.java index 67e5f8e..6cf6073 100644 --- a/src/main/java/com/uci/dao/models/XMessageDAO.java +++ b/src/main/java/com/uci/dao/models/XMessageDAO.java @@ -15,6 +15,7 @@ import java.io.Serializable; import java.time.LocalDateTime; +import java.util.List; import java.util.UUID; import static org.springframework.data.cassandra.core.cql.PrimaryKeyType.CLUSTERED; @@ -69,4 +70,7 @@ public class XMessageDAO implements Serializable { @Column private UUID botUuid; + + @Column + private List tags; } diff --git a/src/main/java/com/uci/dao/repository/XMessageRepository.java b/src/main/java/com/uci/dao/repository/XMessageRepository.java index 7584262..f0bde73 100644 --- a/src/main/java/com/uci/dao/repository/XMessageRepository.java +++ b/src/main/java/com/uci/dao/repository/XMessageRepository.java @@ -50,6 +50,12 @@ public interface XMessageRepository extends ReactiveCassandraRepository> findAllByUserIdInAndFromIdInAndTimestampAfterAndTimestampBeforeAndProvider(Pageable paging, List listUserId, List listFromId, Timestamp startDate, Timestamp endDate, String provider); + @AllowFiltering + Mono> findAllByAppAndTimestampAfterAndTimestampBeforeAndProviderAndTagsContains(Pageable paging, String name, Timestamp startDate, Timestamp endDate, String provider, String tag); + + @AllowFiltering + Mono> findAllByUserIdInAndFromIdInAndTimestampAfterAndTimestampBeforeAndProviderAndTagsContains(Pageable paging, List listUserId, List listFromId, Timestamp startDate, Timestamp endDate, String provider, String tag); + @AllowFiltering Flux findAllByMessageIdAndUserIdInAndFromIdIn(String messageId, List listUserId, List listFromId); } diff --git a/src/main/java/com/uci/dao/utils/XMessageDAOUtils.java b/src/main/java/com/uci/dao/utils/XMessageDAOUtils.java index 14f05f1..187718a 100644 --- a/src/main/java/com/uci/dao/utils/XMessageDAOUtils.java +++ b/src/main/java/com/uci/dao/utils/XMessageDAOUtils.java @@ -52,6 +52,7 @@ public static XMessageDAO convertXMessageToDAO(XMessage xmsg) { xmsgDao.setOwnerOrgId(xmsg.getOwnerOrgId()); xmsgDao.setOwnerId(xmsg.getOwnerId()); xmsgDao.setBotUuid(xmsg.getBotId()); + xmsgDao.setTags(xmsg.getTags()); LocalDateTime triggerTime = LocalDateTime.ofInstant(Instant.ofEpochMilli(xmsg.getTimestamp()),