Skip to content

Commit

Permalink
merged - release-v2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
SM4991 committed Mar 17, 2023
2 parents ab41480 + 76fbcb4 commit 338c835
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 10 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ on:
tags:
- 'v*.*.*'
branches:
["release-4.*.*", "release-5.*.*"]
["release-4.*.*", "release-5.*.*", "release-v2.*.*"]
pull_request:
branches:
["release-4.*.*", "release-5.*.*"]
["release-4.*.*", "release-5.*.*", "release-v2.*.*"]


jobs:
Expand Down Expand Up @@ -59,7 +59,7 @@ jobs:
- name: Delete package specific version
uses: smartsquaregmbh/[email protected]
with:
version: 5.1.0 # This should be same as in the pom.xml file,
version: 2.1.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
Expand All @@ -69,4 +69,4 @@ jobs:
env:
GITHUB_USERNAME: ${{ secrets.USERNAME }}
GITHUB_TOKEN: ${{ secrets.TOKEN }}
run: mvn -s $GITHUB_WORKSPACE/settings.xml clean install -Pgithub deploy -DskipTests
run: mvn -s $GITHUB_WORKSPACE/settings.xml clean install -Pgithub deploy -DskipTests
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ name: Maven Build
on:
push:
branches:
["release-4.*.*", "release-5.*.*"]
["release-4.*.*", "release-5.*.*", "release-v2.*.*"]
pull_request:
branches:
["release-4.*.*", "release-5.*.*"]
["release-4.*.*", "release-5.*.*", "release-v2.*.*"]

jobs:
build:
Expand Down Expand Up @@ -52,4 +52,4 @@ jobs:
env:
GITHUB_USERNAME: ${{ secrets.USERNAME }}
GITHUB_TOKEN: ${{ secrets.TOKEN }}
run: mvn -s $GITHUB_WORKSPACE/settings.xml clean install -DskipTests
run: mvn -s $GITHUB_WORKSPACE/settings.xml clean install -DskipTests
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<name>dao</name>
<description>dao</description>
<packaging>jar</packaging>
<version>5.1.0</version>
<version>2.1.0</version>
<!-- On changing, Set version in deploy.xml to delete the previous packages if exists and deploy new package for the specified version -->

<parent>
Expand Down Expand Up @@ -99,13 +99,13 @@
<dependency>
<groupId>com.uci</groupId>
<artifactId>message-rosa</artifactId>
<version>5.1.0</version>
<version>5.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.uci</groupId>
<artifactId>utils</artifactId>
<version>5.1.0</version>
<version>5.0.0</version>
<scope>compile</scope>
</dependency>

Expand Down
21 changes: 21 additions & 0 deletions src/main/java/com/uci/dao/config/CassandraConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -73,6 +78,17 @@ protected List<CreateKeyspaceSpecification> 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
Expand All @@ -85,6 +101,10 @@ protected List<String> 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){
Expand Down Expand Up @@ -125,6 +145,7 @@ protected List<String> 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<text>;");

// allScripts.add("CREATE INDEX IF NOT EXISTS message_state_index\n" +
// "ON "+keyspace
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/com/uci/dao/models/XMessageDAO.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -69,4 +70,7 @@ public class XMessageDAO implements Serializable {

@Column
private UUID botUuid;

@Column
private List<String> tags;
}
6 changes: 6 additions & 0 deletions src/main/java/com/uci/dao/repository/XMessageRepository.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ public interface XMessageRepository extends ReactiveCassandraRepository<XMessage
@AllowFiltering
Mono<Slice<XMessageDAO>> findAllByUserIdInAndFromIdInAndTimestampAfterAndTimestampBeforeAndProvider(Pageable paging, List<String> listUserId, List<String> listFromId, Timestamp startDate, Timestamp endDate, String provider);

@AllowFiltering
Mono<Slice<XMessageDAO>> findAllByAppAndTimestampAfterAndTimestampBeforeAndProviderAndTagsContains(Pageable paging, String name, Timestamp startDate, Timestamp endDate, String provider, String tag);

@AllowFiltering
Mono<Slice<XMessageDAO>> findAllByUserIdInAndFromIdInAndTimestampAfterAndTimestampBeforeAndProviderAndTagsContains(Pageable paging, List<String> listUserId, List<String> listFromId, Timestamp startDate, Timestamp endDate, String provider, String tag);

@AllowFiltering
Flux<XMessageDAO> findAllByMessageIdAndUserIdInAndFromIdIn(String messageId, List<String> listUserId, List<String> listFromId);

Expand Down
1 change: 1 addition & 0 deletions src/main/java/com/uci/dao/utils/XMessageDAOUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -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()),
Expand Down

0 comments on commit 338c835

Please sign in to comment.