Skip to content

Commit

Permalink
changes
Browse files Browse the repository at this point in the history
  • Loading branch information
surabhi-mahawar committed Nov 10, 2021
1 parent 7329304 commit d3835b6
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 20 deletions.
38 changes: 19 additions & 19 deletions src/main/java/com/uci/dao/Application.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,24 +39,24 @@ public static void main(String[] args) {

@Override
public void run(String... args) throws Exception {
for(int i=0; i<1000; i++){
log.info(UUIDs.timeBased().toString());
}
xMessageRepository.insert(new XMessageDAO(UUIDs.timeBased(), "HHBJ", "hkkh", "efef", "grdgrdg", LocalDateTime.now(),
"HHBJ", "hkkh", "efef", "grdgrdg", "HHBJ", "hkkh", "efef")).log().subscribe();
xMessageRepository.insert(new XMessageDAO(UUIDs.timeBased(), "HHB", "hkkh", "efef", "grdgrdg", LocalDateTime.now(),
"HHBJ", "hkkh", "efef", "grdgrdg", "HHBJ", "hkkh", "efef")).log().subscribe();
LocalDateTime yesterday = LocalDateTime.now().minusDays(1L);
xMessageRepository.findAllByUserId("7837833100").subscribe(new Consumer<List<XMessageDAO>>() {
@Override
public void accept(List<XMessageDAO> xMessageDAO) {
log.info("XMessage List Item All :>> " + counter + " " + xMessageDAO.get(counter).getApp());
counter += 1;
}
});
xMessageRepository.findAllByFromIdAndTimestampAfter("hkkh",yesterday).subscribe(xMessageDAO -> {
log.info("XMessage List Item :>> " + counter + " " + xMessageDAO.getFromId() + " " + xMessageDAO.getTimestamp());
counter += 1;
});
// for(int i=0; i<1000; i++){
// log.info(UUIDs.timeBased().toString());
// }
// xMessageRepository.insert(new XMessageDAO(UUIDs.timeBased(), "HHBJ", "hkkh", "efef", "grdgrdg", LocalDateTime.now(),
// "HHBJ", "hkkh", "efef", "grdgrdg", "HHBJ", "hkkh", "efef")).log().subscribe();
// xMessageRepository.insert(new XMessageDAO(UUIDs.timeBased(), "HHB", "hkkh", "efef", "grdgrdg", LocalDateTime.now(),
// "HHBJ", "hkkh", "efef", "grdgrdg", "HHBJ", "hkkh", "efef")).log().subscribe();
// LocalDateTime yesterday = LocalDateTime.now().minusDays(1L);
// xMessageRepository.findAllByUserId("7837833100").subscribe(new Consumer<List<XMessageDAO>>() {
// @Override
// public void accept(List<XMessageDAO> xMessageDAO) {
// log.info("XMessage List Item All :>> " + counter + " " + xMessageDAO.get(counter).getApp());
// counter += 1;
// }
// });
// xMessageRepository.findAllByFromIdAndTimestampAfter("hkkh",yesterday).subscribe(xMessageDAO -> {
// log.info("XMessage List Item :>> " + counter + " " + xMessageDAO.getFromId() + " " + xMessageDAO.getTimestamp());
// counter += 1;
// });
}
}
7 changes: 6 additions & 1 deletion src/main/java/com/uci/dao/repository/XMessageRepository.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.uci.dao.models.XMessageDAO;
import org.springframework.data.cassandra.repository.AllowFiltering;
import org.springframework.data.cassandra.repository.Query;
import org.springframework.data.cassandra.repository.ReactiveCassandraRepository;
import org.springframework.stereotype.Repository;
import reactor.core.publisher.Flux;
Expand All @@ -10,6 +11,7 @@
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
import java.util.UUID;

@Repository
public interface XMessageRepository extends ReactiveCassandraRepository<XMessageDAO, Long> {
Expand All @@ -24,7 +26,7 @@ public interface XMessageRepository extends ReactiveCassandraRepository<XMessage
Flux<XMessageDAO> findFirstByAppOrderByTimestampDesc(String appName);

@AllowFiltering
Flux<List<XMessageDAO>> findAllByUserId(String userID);
Flux<XMessageDAO> findAllByUserId(String userID);

Flux<XMessageDAO> findByMessageId(String messageID);

Expand All @@ -46,6 +48,9 @@ public interface XMessageRepository extends ReactiveCassandraRepository<XMessage

@AllowFiltering
Flux<XMessageDAO> findAllByFromIdAndTimestampAfter(String userID, LocalDateTime timestamp);

@AllowFiltering
Flux<XMessageDAO> findById(UUID uuid);
}


0 comments on commit d3835b6

Please sign in to comment.