diff --git a/src/main/java/com/uci/dao/Application.java b/src/main/java/com/uci/dao/Application.java index 3a4c222..e9e6c9c 100644 --- a/src/main/java/com/uci/dao/Application.java +++ b/src/main/java/com/uci/dao/Application.java @@ -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>() { - @Override - public void accept(List 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>() { +// @Override +// public void accept(List 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; +// }); } } \ No newline at end of file diff --git a/src/main/java/com/uci/dao/repository/XMessageRepository.java b/src/main/java/com/uci/dao/repository/XMessageRepository.java index 7228ffa..27f24bc 100644 --- a/src/main/java/com/uci/dao/repository/XMessageRepository.java +++ b/src/main/java/com/uci/dao/repository/XMessageRepository.java @@ -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; @@ -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 { @@ -24,7 +26,7 @@ public interface XMessageRepository extends ReactiveCassandraRepository findFirstByAppOrderByTimestampDesc(String appName); @AllowFiltering - Flux> findAllByUserId(String userID); + Flux findAllByUserId(String userID); Flux findByMessageId(String messageID); @@ -46,6 +48,9 @@ public interface XMessageRepository extends ReactiveCassandraRepository findAllByFromIdAndTimestampAfter(String userID, LocalDateTime timestamp); + + @AllowFiltering + Flux findById(UUID uuid); }