Compare commits

..

No commits in common. "Feature/26534" and "master" have entirely different histories.

7 changed files with 24 additions and 34 deletions

View File

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

12
pom.xml
View File

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

View File

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

View File

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

View File

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

View File

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

View File

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