Compare commits
No commits in common. "master" and "main" have entirely different histories.
|
@ -4,11 +4,6 @@
|
|||
All notable changes to this project will be documented in this file.
|
||||
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [v1.0.1] - 2024-04-16
|
||||
|
||||
- Null pointer exception bug fixed
|
||||
- Removed unnecessary logs
|
||||
|
||||
## [v1.0.0] - 2023-11-15
|
||||
|
||||
- First release
|
||||
|
|
4
pom.xml
4
pom.xml
|
@ -5,13 +5,13 @@
|
|||
<parent>
|
||||
<artifactId>maven-parent</artifactId>
|
||||
<groupId>org.gcube.tools</groupId>
|
||||
<version>1.2.0</version>
|
||||
<version>1.1.0</version>
|
||||
<relativePath />
|
||||
</parent>
|
||||
|
||||
<groupId>org.gcube.portal</groupId>
|
||||
<artifactId>social-library-stubs</artifactId>
|
||||
<version>1.0.1</version>
|
||||
<version>1.0.0</version>
|
||||
<name>gCube Social Library stubs</name>
|
||||
<description>
|
||||
The gCube Social Networking Library stubs exploits the social networking facilities using the social-service-client to interface with the NoSQL data store for their storage. Specifically an Apache Cassandra data store.
|
||||
|
|
|
@ -273,18 +273,15 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
|||
@Deprecated
|
||||
public List<Feed> getRecentFeedsByUserAndDate(String userid, long timeInMillis) throws IllegalArgumentException {
|
||||
Date now = new Date();
|
||||
List<Feed> feeds = new ArrayList<>();
|
||||
if (timeInMillis > now.getTime())
|
||||
throw new IllegalArgumentException("the timeInMillis must be before today");
|
||||
List<Post> posts = getRecentPostsByUserAndDate(userid, timeInMillis);
|
||||
if(posts!=null){
|
||||
_log.debug("Length of posts is " + posts.size());
|
||||
for(Post post: posts){
|
||||
_log.debug(post.toString());
|
||||
feeds.add(post2feed(post));
|
||||
}
|
||||
_log.info("Length of posts is " + posts.size());
|
||||
List<Feed> feeds = new ArrayList<>();
|
||||
for(Post post: posts){
|
||||
_log.info(post.toString());
|
||||
feeds.add(post2feed(post));
|
||||
}
|
||||
|
||||
return feeds;
|
||||
}
|
||||
/**
|
||||
|
@ -321,10 +318,8 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
|||
public List<Feed> getAllFeedsByUser(String userid) throws PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, ColumnNameNotFoundException, FeedIDNotFoundException {
|
||||
List<Post> posts = getAllPostsByUser(userid);
|
||||
List<Feed> feeds = new ArrayList<>();
|
||||
if(posts!=null){
|
||||
for(Post post: posts){
|
||||
feeds.add(post2feed(post));
|
||||
}
|
||||
for(Post post: posts){
|
||||
feeds.add(post2feed(post));
|
||||
}
|
||||
return feeds;
|
||||
}
|
||||
|
@ -342,12 +337,9 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
|||
public List<Feed> getAllFeedsByApp(String appid) throws PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, ColumnNameNotFoundException, FeedIDNotFoundException {
|
||||
List<Post> posts = getAllPostsByApp(appid);
|
||||
List<Feed> feeds = new ArrayList<>();
|
||||
if(posts!=null){
|
||||
for(Post post: posts){
|
||||
feeds.add(post2feed(post));
|
||||
}
|
||||
for(Post post: posts){
|
||||
feeds.add(post2feed(post));
|
||||
}
|
||||
|
||||
return feeds;
|
||||
}
|
||||
/**
|
||||
|
@ -367,10 +359,8 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
|||
long timeInMillis) throws Exception {
|
||||
List<Post> posts = getRecentCommentedPostsByUserAndDate(userid, timeInMillis);
|
||||
List<Feed> feeds = new ArrayList<>();
|
||||
if(posts!=null){
|
||||
for(Post post: posts){
|
||||
feeds.add(post2feed(post));
|
||||
}
|
||||
for(Post post: posts){
|
||||
feeds.add(post2feed(post));
|
||||
}
|
||||
return feeds;
|
||||
}
|
||||
|
@ -391,10 +381,8 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
|||
public List<Feed> getAllPortalPrivacyLevelFeeds() throws FeedTypeNotFoundException, ColumnNameNotFoundException, PrivacyLevelTypeNotFoundException {
|
||||
List<Post> posts = getAllPortalPrivacyLevelPosts();
|
||||
List<Feed> feeds = new ArrayList<>();
|
||||
if (posts!=null){
|
||||
for(Post post: posts){
|
||||
feeds.add(post2feed(post));
|
||||
}
|
||||
for(Post post: posts){
|
||||
feeds.add(post2feed(post));
|
||||
}
|
||||
return feeds;
|
||||
}
|
||||
|
@ -410,10 +398,8 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
|||
public List<Feed> getRecentFeedsByUser(String userid, int quantity) throws PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, ColumnNameNotFoundException, FeedIDNotFoundException {
|
||||
List<Post> posts = getRecentPostsByUser(userid, quantity);
|
||||
List<Feed> feeds = new ArrayList<>();
|
||||
if(posts!=null){
|
||||
for(Post post: posts){
|
||||
feeds.add(post2feed(post));
|
||||
}
|
||||
for(Post post: posts){
|
||||
feeds.add(post2feed(post));
|
||||
}
|
||||
return feeds;
|
||||
}
|
||||
|
@ -429,10 +415,8 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
|||
public List<Feed> getAllFeedsByVRE(String vreid) throws PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, ColumnNameNotFoundException, FeedIDNotFoundException {
|
||||
List<Post> posts = getAllPostsByVRE(vreid);
|
||||
List<Feed> feeds = new ArrayList<>();
|
||||
if(posts!=null){
|
||||
for(Post post: posts){
|
||||
feeds.add(post2feed(post));
|
||||
}
|
||||
for(Post post: posts){
|
||||
feeds.add(post2feed(post));
|
||||
}
|
||||
return feeds;
|
||||
}
|
||||
|
@ -449,21 +433,19 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
|||
@Deprecated
|
||||
@Override
|
||||
public List<Feed> getRecentFeedsByVRE(String vreid, int quantity) throws PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, ColumnNameNotFoundException, FeedIDNotFoundException {
|
||||
_log.debug("\n\n in getRecentFeedsByVRE");
|
||||
_log.info("\n\n in getRecentFeedsByVRE");
|
||||
List<Post> posts = getRecentPostsByVRE(vreid, quantity);
|
||||
_log.info("length of vre posts = " + posts.size());
|
||||
List<Feed> feeds = new ArrayList<>();
|
||||
if(posts!=null){
|
||||
_log.debug("length of vre posts = " + posts.size());
|
||||
for(Post post: posts){
|
||||
feeds.add(post2feed(post));
|
||||
}
|
||||
for(Post post: posts){
|
||||
feeds.add(post2feed(post));
|
||||
}
|
||||
_log.debug("length of vre feeds = " + feeds.size());
|
||||
_log.info("length of vre feeds = " + feeds.size());
|
||||
return feeds;
|
||||
}
|
||||
@Override
|
||||
public List<Post> getRecentPostsByVRE(String vreid, int quantity) throws PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, ColumnNameNotFoundException, FeedIDNotFoundException {
|
||||
_log.debug("\n\n in getRecentPostsByVRE");
|
||||
_log.info("\n\n in getRecentPostsByVRE");
|
||||
return libClient.getRecentPostsByVRELib(vreid, quantity);
|
||||
}
|
||||
/**
|
||||
|
@ -473,18 +455,12 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
|||
public RangeFeeds getRecentFeedsByVREAndRange(String vreid, int from, int quantity) throws IllegalArgumentException, PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, ColumnNameNotFoundException, FeedIDNotFoundException {
|
||||
RangePosts rangePosts = getRecentPostsByVREAndRange(vreid, from, quantity);
|
||||
List<Post> posts = rangePosts.getPosts();
|
||||
if(posts!=null){
|
||||
ArrayList<Feed> feeds = new ArrayList<>();
|
||||
for(Post post: posts){
|
||||
feeds.add(post2feed(post));
|
||||
}
|
||||
RangeFeeds rangeFeeds = new RangeFeeds(rangePosts.getLastReturnedPostTimelineIndex(), feeds);
|
||||
return rangeFeeds;
|
||||
ArrayList<Feed> feeds = new ArrayList<>();
|
||||
for(Post post: posts){
|
||||
feeds.add(post2feed(post));
|
||||
}
|
||||
else{
|
||||
return new RangeFeeds();
|
||||
}
|
||||
|
||||
RangeFeeds rangeFeeds = new RangeFeeds(rangePosts.getLastReturnedPostTimelineIndex(), feeds);
|
||||
return rangeFeeds;
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
|
@ -583,12 +559,10 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
|||
*/
|
||||
@Override
|
||||
public boolean setUserNotificationPreferences(String userid, Map<NotificationType, NotificationChannelType[]> enabledChannels) {
|
||||
if(enabledChannels!=null){
|
||||
for(NotificationType notificationType: enabledChannels.keySet()){
|
||||
_log.debug("Type: " + notificationType.toString());
|
||||
for(NotificationChannelType channelType: enabledChannels.get(notificationType)){
|
||||
_log.debug(channelType.toString());
|
||||
}
|
||||
for(NotificationType notificationType: enabledChannels.keySet()){
|
||||
_log.info("Type: " + notificationType.toString());
|
||||
for(NotificationChannelType channelType: enabledChannels.get(notificationType)){
|
||||
_log.info(channelType.toString());
|
||||
}
|
||||
}
|
||||
return libClient.setUserNotificationPreferencesLib(userid, enabledChannels);
|
||||
|
@ -700,26 +674,22 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
|||
ArrayList<Feed> toReturn = new ArrayList<>();
|
||||
List<String> likedPostIDs = getAllLikedPostIdsByUser(userid);
|
||||
|
||||
if(likedPostIDs!=null){
|
||||
//check if quantity is greater than user feeds
|
||||
limit = (limit > likedPostIDs.size()) ? likedPostIDs.size() : limit;
|
||||
//check if quantity is greater than user feeds
|
||||
limit = (limit > likedPostIDs.size()) ? likedPostIDs.size() : limit;
|
||||
|
||||
//need them in reverse order
|
||||
for (int i = likedPostIDs.size()-1; i >= (likedPostIDs.size()-limit); i--) {
|
||||
Feed toAdd = readFeed(likedPostIDs.get(i));
|
||||
if (toAdd.getType() == FeedType.TWEET || toAdd.getType() == FeedType.SHARE || toAdd.getType() == FeedType.PUBLISH) {
|
||||
toReturn.add(toAdd);
|
||||
_log.trace("Read recent post: " + likedPostIDs.get(i));
|
||||
} else {
|
||||
_log.trace("Read and skipped post: " + likedPostIDs.get(i) + " (Removed post)");
|
||||
limit += 1; //increase the quantity in case of removed feed
|
||||
//check if quantity is greater than user feeds
|
||||
limit = (limit > likedPostIDs.size()) ? likedPostIDs.size() : limit;
|
||||
}
|
||||
//need them in reverse order
|
||||
for (int i = likedPostIDs.size()-1; i >= (likedPostIDs.size()-limit); i--) {
|
||||
Feed toAdd = readFeed(likedPostIDs.get(i));
|
||||
if (toAdd.getType() == FeedType.TWEET || toAdd.getType() == FeedType.SHARE || toAdd.getType() == FeedType.PUBLISH) {
|
||||
toReturn.add(toAdd);
|
||||
_log.trace("Read recent post: " + likedPostIDs.get(i));
|
||||
} else {
|
||||
_log.trace("Read and skipped post: " + likedPostIDs.get(i) + " (Removed post)");
|
||||
limit += 1; //increase the quantity in case of removed feed
|
||||
//check if quantity is greater than user feeds
|
||||
limit = (limit > likedPostIDs.size()) ? likedPostIDs.size() : limit;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return toReturn;
|
||||
}
|
||||
/**
|
||||
|
@ -730,25 +700,22 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
|||
ArrayList<Post> toReturn = new ArrayList<Post>();
|
||||
List<String> likedPostIDs = getAllLikedPostIdsByUser(userid);
|
||||
|
||||
if(likedPostIDs!=null){
|
||||
//check if quantity is greater than user feeds
|
||||
limit = (limit > likedPostIDs.size()) ? likedPostIDs.size() : limit;
|
||||
//check if quantity is greater than user feeds
|
||||
limit = (limit > likedPostIDs.size()) ? likedPostIDs.size() : limit;
|
||||
|
||||
//need them in reverse order
|
||||
for (int i = likedPostIDs.size()-1; i >= (likedPostIDs.size()-limit); i--) {
|
||||
Post toAdd = readPost(likedPostIDs.get(i));
|
||||
if (toAdd.getType() == PostType.TWEET || toAdd.getType() == PostType.SHARE || toAdd.getType() == PostType.PUBLISH) {
|
||||
toReturn.add(toAdd);
|
||||
_log.trace("Read recent post: " + likedPostIDs.get(i));
|
||||
} else {
|
||||
_log.trace("Read and skipped post: " + likedPostIDs.get(i) + " (Removed post)");
|
||||
limit += 1; //increase the quantity in case of removed feed
|
||||
//check if quantity is greater than user feeds
|
||||
limit = (limit > likedPostIDs.size()) ? likedPostIDs.size() : limit;
|
||||
}
|
||||
//need them in reverse order
|
||||
for (int i = likedPostIDs.size()-1; i >= (likedPostIDs.size()-limit); i--) {
|
||||
Post toAdd = readPost(likedPostIDs.get(i));
|
||||
if (toAdd.getType() == PostType.TWEET || toAdd.getType() == PostType.SHARE || toAdd.getType() == PostType.PUBLISH) {
|
||||
toReturn.add(toAdd);
|
||||
_log.trace("Read recent post: " + likedPostIDs.get(i));
|
||||
} else {
|
||||
_log.trace("Read and skipped post: " + likedPostIDs.get(i) + " (Removed post)");
|
||||
limit += 1; //increase the quantity in case of removed feed
|
||||
//check if quantity is greater than user feeds
|
||||
limit = (limit > likedPostIDs.size()) ? likedPostIDs.size() : limit;
|
||||
}
|
||||
}
|
||||
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
|
@ -923,12 +890,9 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
|||
public List<Feed> getVREFeedsByHashtag(String vreid, String hashtag) throws PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, FeedIDNotFoundException, ColumnNameNotFoundException {
|
||||
List<Post>posts = getVREPostsByHashtag(vreid,hashtag);
|
||||
List<Feed>feeds = new ArrayList<>();
|
||||
if(posts!=null){
|
||||
for(Post post: posts){
|
||||
feeds.add(post2feed(post));
|
||||
}
|
||||
for(Post post: posts){
|
||||
feeds.add(post2feed(post));
|
||||
}
|
||||
|
||||
return feeds;
|
||||
}
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue