Compare commits

...

1 Commits

Author SHA1 Message Date
Ahmed Salah Tawfik Ibrahim fe1bc73108 Compatible with social model 2.0.0 2024-01-31 18:08:31 +01:00
7 changed files with 34 additions and 24 deletions

View File

@ -9,6 +9,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
- Removed HomeLibrary
- Updated GWT version to latest
- Removed Social Networking Library dependency #26534
## [v2.3.0] - 2021-02-02

12
pom.xml
View File

@ -112,10 +112,16 @@
<artifactId>gcube-widgets</artifactId>
<scope>compile</scope>
</dependency>
<!-- should be provided -->
<dependency>
<groupId>org.gcube.portal</groupId>
<artifactId>social-networking-library</artifactId>
<scope>provided</scope>
<groupId>org.gcube.social-networking</groupId>
<artifactId>social-service-model</artifactId>
<version>[1.2.0-SNAPSHOT, 2.0.0]</version>
</dependency>
<dependency>
<groupId>org.gcube.social-networking</groupId>
<artifactId>social-service-client</artifactId>
<version>[2.0.0-SNAPSHOT, 3.0.0)</version>
</dependency>
<dependency>
<groupId>org.gcube.common</groupId>

View File

@ -1,8 +1,8 @@
package org.gcube.portlet.user.userstatisticsportlet.client;
import org.gcube.portal.databook.client.GCubeSocialNetworking;
import org.gcube.portal.databook.client.util.Encoder;
import org.gcube.portal.databook.shared.ShowUserStatisticAction;
import org.gcube.social_networking.socialnetworking.model.client.GCubeSocialNetworking;
import org.gcube.social_networking.socialnetworking.model.client.util.Encoder;
import org.gcube.social_networking.socialnetworking.model.shared.ShowUserStatisticAction;
import org.gcube.portlet.user.userstatisticsportlet.client.events.PageBusEvents;
import org.gcube.portlet.user.userstatisticsportlet.client.events.ShowFeedsRelatedToUserStatisticsEvent;
import org.gcube.portlet.user.userstatisticsportlet.client.events.ShowFeedsRelatedToUserStatisticsEventHandler;

View File

@ -1,6 +1,6 @@
package org.gcube.portlet.user.userstatisticsportlet.client.events;
import org.gcube.portal.databook.shared.ShowUserStatisticAction;
import org.gcube.social_networking.socialnetworking.model.shared.ShowUserStatisticAction;
import com.google.gwt.event.shared.GwtEvent;

View File

@ -1,6 +1,6 @@
package org.gcube.portlet.user.userstatisticsportlet.client.ui;
import org.gcube.portal.databook.shared.ShowUserStatisticAction;
import org.gcube.social_networking.socialnetworking.model.shared.ShowUserStatisticAction;
import org.gcube.portlet.user.userstatisticsportlet.client.events.ShowFeedsRelatedToUserStatisticsEvent;
import com.github.gwtbootstrap.client.ui.Button;

View File

@ -17,9 +17,8 @@ import org.gcube.common.portal.PortalContext;
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.common.storagehub.client.dsl.StorageHubClient;
import org.gcube.portal.custom.communitymanager.SiteManagerUtil;
import org.gcube.portal.databook.server.DBCassandraAstyanaxImpl;
import org.gcube.portal.databook.server.DatabookStore;
import org.gcube.portal.databook.shared.Feed;
import org.gcube.social_networking.social_networking_client_library.LibClient;
import org.gcube.social_networking.socialnetworking.model.shared.Post;
import org.gcube.portlet.user.userstatisticsportlet.client.UserStatisticsService;
import org.gcube.portlet.user.userstatisticsportlet.server.cache.UserInfrastructureQuotaStorageCache;
import org.gcube.portlet.user.userstatisticsportlet.server.cache.UserInfrastructureSpaceCache;
@ -50,7 +49,7 @@ public class UserStatisticsServiceImpl extends RemoteServiceServlet implements U
// private static final org.slf4j.Logger logger = LoggerFactory.getLogger(UserStatisticsServiceImpl.class);
private static final Log logger = LogFactoryUtil.getLog(UserStatisticsServiceImpl.class);
private DatabookStore store;
private LibClient libClient;
private String quotaServiceBaseUrl;
private static final String CUSTOM_FIELD_NAME_USER_STATISTICS_VISIBILITY = "show_user_statistics_other_people";
private UserManager userManager = new LiferayUserManager();
@ -59,18 +58,22 @@ public class UserStatisticsServiceImpl extends RemoteServiceServlet implements U
@Override
public void init() {
logger.info("Getting connection to Cassandra..");
store = new DBCassandraAstyanaxImpl();
try {
libClient = new LibClient();
} catch (Exception e) {
throw new RuntimeException(e);
}
ServerUtils.createUserCustomField(CUSTOM_FIELD_NAME_USER_STATISTICS_VISIBILITY, true);
logger.info("Retrieving quota service endpoint");
quotaServiceBaseUrl = DiscoverQuotaServiceEndPoint.discover();
}
@Override
/*@Override
public void destroy(){
logger.info("Closing connection to Cassandra");
store.closeConnection();
}
}*/
@Override
public QuotaInfo getQuotaStorage(String userid) {
@ -284,9 +287,9 @@ public class UserStatisticsServiceImpl extends RemoteServiceServlet implements U
try {
long userId = userManager.getUserId(statisticsOfUsername);
List<Feed> userPosts = store.getRecentFeedsByUserAndDate(statisticsOfUsername, oneYearAgo.getTimeInMillis());
List<Post> userPosts = libClient.getRecentPostsByUserAndDateLib(statisticsOfUsername, oneYearAgo.getTimeInMillis());
logger.debug("store.getRecentFeedsByUserAndDate");
List<Feed> recentLikedFeeds = store.getRecentLikedFeedsByUserAndDate(statisticsOfUsername, oneYearAgo.getTimeInMillis());
List<Post> recentLikedFeeds = libClient.getRecentLikedPostsByUserAndDateLib(statisticsOfUsername, oneYearAgo.getTimeInMillis());
logger.debug("store.getRecentLikedFeedsByUserAndDate");
// Evaluate the contexts to use
@ -304,17 +307,17 @@ public class UserStatisticsServiceImpl extends RemoteServiceServlet implements U
long postCreated = 0, likesGot = 0, commentsGot = 0, commentsMade = 0, likesMade = 0;
for (Feed feed : userPosts) {
for (Post post : userPosts) {
if(contexts.contains(feed.getVreid())){
if(contexts.contains(post.getVreid())){
postCreated ++;
commentsGot += Integer.parseInt(feed.getCommentsNo());
likesGot += Integer.parseInt(feed.getLikesNo());
commentsGot += Integer.parseInt(post.getCommentsNo());
likesGot += Integer.parseInt(post.getLikesNo());
}
}
for (Feed feed : recentLikedFeeds) {
for (Post post : recentLikedFeeds) {
if(contexts.contains(feed.getVreid()))
if(contexts.contains(post.getVreid()))
likesMade ++;
}

View File

@ -5,7 +5,7 @@
<!-- Other module inherits -->
<!-- <inherits name='org.gcube.portlets.widgets.widgettour.WidgetTour' /> -->
<inherits name='org.gcube.portal.databook.GCubeSocialNetworking' />
<inherits name='org.gcube.social_networking.socialnetworking.model.GCubeSocialNetworking' />
<!-- Bootstrap import -->
<inherits name="com.github.gwtbootstrap.Bootstrap" />