diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component
index 65eedd1..40d2245 100644
--- a/.settings/org.eclipse.wst.common.component
+++ b/.settings/org.eclipse.wst.common.component
@@ -1,10 +1,19 @@
+
+
+
+
+
+
+
+
+
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a886008..5930a21 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,8 +9,23 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
Ported to git
+Feature #21008: UserStatistics portlet: Remove number of comments done and got indicator
+
+## [v2.2.0] - 2017-02-20"
+
+Added storage Quota information
+
+## [v2.1.0] - 2016-10-02
+
+Posts related to some statistics are now retrievable on the demand
+
+## [v2.0.0] - 2016-04-02
+
+Ported to Liferay 6.2
+
+Minor bug fix: long vre's name managed properly(Bug #2042)
-## [v1.0.0] - 2015-10-21
+## [v1.0.0] - 2015-12-09
First release
diff --git a/distro/LICENSE b/distro/LICENSE
deleted file mode 100644
index 2d9616a..0000000
--- a/distro/LICENSE
+++ /dev/null
@@ -1 +0,0 @@
-${gcube.license}
\ No newline at end of file
diff --git a/distro/README b/distro/README
deleted file mode 100644
index 38d5603..0000000
--- a/distro/README
+++ /dev/null
@@ -1,62 +0,0 @@
-The gCube System - ${name}
---------------------------------------------------
-
-${description}
-
-
-${gcube.description}
-
-${gcube.funding}
-
-
-Version
---------------------------------------------------
-
-${version} (${buildDate})
-
-Please see the file named "changelog.xml" in this directory for the release notes.
-
-
-Authors
---------------------------------------------------
-
-* Costantino Perciante (costantino.perciante@isti.cnr.it), Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo" - CNR, Pisa (Italy).
-
-Maintainers
------------
-
-* Costantino Perciante (costantino.perciante@isti.cnr.it), Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo" - CNR, Pisa (Italy).
-
-Download information
---------------------------------------------------
-
-Source code is available from SVN:
- ${scm.url}
-
-Binaries can be downloaded from the gCube website:
- ${gcube.website}
-
-
-Installation
---------------------------------------------------
-
-Installation documentation is available on-line in the gCube Wiki:
- ${gcube.wikiRoot}
-
-Documentation
---------------------------------------------------
-
-Documentation is available on-line in the gCube Wiki:
- ${gcube.wikiRoot}
-
-Support
---------------------------------------------------
-
-Bugs and support requests can be reported in the gCube issue tracking tool:
- ${gcube.issueTracking}
-
-
-Licensing
---------------------------------------------------
-
-This software is licensed under the terms you may find in the file named "LICENSE" in this directory.
\ No newline at end of file
diff --git a/distro/changelog.xml b/distro/changelog.xml
deleted file mode 100644
index a790afa..0000000
--- a/distro/changelog.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
- Added storage Quota information
-
-
- Minor fixes
- Removed asl session
- Moved to Liferay logging system
-
-
- Feeds related to some statistics are now retrievable on the
- demand
-
-
- Ported to Liferay 6.2
-
-
- Minor bug fix: long vre's name managed properly(Bug #2042)
-
-
-
- First Release
-
-
\ No newline at end of file
diff --git a/distro/descriptor.xml b/distro/descriptor.xml
deleted file mode 100644
index b3f5628..0000000
--- a/distro/descriptor.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-
- servicearchive
-
- tar.gz
-
- /
-
-
- ${distroDirectory}
- /
- true
-
- README
- LICENSE
- changelog.xml
- profile.xml
-
- 755
- true
-
-
-
-
-
- /${artifactId}
-
-
-
\ No newline at end of file
diff --git a/distro/profile.xml b/distro/profile.xml
deleted file mode 100644
index 51c3b6b..0000000
--- a/distro/profile.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
- Service
-
- ${description}
- PortletUser
- ${artifactId}
- ${version}
-
-
- ${artifactId}
- ${version}
-
- ${groupId}
- ${artifactId}
- ${version}
-
-
- target/${build.finalName}.war
-
-
-
-
-
diff --git a/pom.xml b/pom.xml
index 1036656..8945e32 100644
--- a/pom.xml
+++ b/pom.xml
@@ -13,7 +13,7 @@
org.gcube.portlets.user
user-statistics
war
- 2.3.0-SNAPSHOT
+ 2.3.0
User statistics portlet
User statistics portlet shows main user's statistics.
@@ -48,7 +48,7 @@
org.gcube.distribution
maven-portal-bom
- 3.6.0-SNAPSHOT
+ 3.6.0
pom
import
diff --git a/src/main/java/org/gcube/portlet/user/userstatisticsportlet/client/StatisticsPanel.java b/src/main/java/org/gcube/portlet/user/userstatisticsportlet/client/StatisticsPanel.java
index 764a421..770f739 100644
--- a/src/main/java/org/gcube/portlet/user/userstatisticsportlet/client/StatisticsPanel.java
+++ b/src/main/java/org/gcube/portlet/user/userstatisticsportlet/client/StatisticsPanel.java
@@ -1,10 +1,5 @@
package org.gcube.portlet.user.userstatisticsportlet.client;
-import net.eliasbalasis.tibcopagebus4gwt.client.PageBusAdapter;
-import net.eliasbalasis.tibcopagebus4gwt.client.PageBusAdapterException;
-import net.eliasbalasis.tibcopagebus4gwt.client.PageBusEvent;
-import net.eliasbalasis.tibcopagebus4gwt.client.PageBusListener;
-
import org.gcube.portal.databook.client.GCubeSocialNetworking;
import org.gcube.portal.databook.client.util.Encoder;
import org.gcube.portal.databook.shared.ShowUserStatisticAction;
@@ -37,6 +32,11 @@ import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.Image;
+
+import net.eliasbalasis.tibcopagebus4gwt.client.PageBusAdapter;
+import net.eliasbalasis.tibcopagebus4gwt.client.PageBusAdapterException;
+import net.eliasbalasis.tibcopagebus4gwt.client.PageBusEvent;
+import net.eliasbalasis.tibcopagebus4gwt.client.PageBusListener;
/**
* Panel to show received user's statistics
*
@@ -95,11 +95,6 @@ public class StatisticsPanel extends Composite {
private final static String TOOLTIP_LIKES_GOT_VRE = "Likes got during the last year in this VRE";
private final static String TOOLTIP_LIKES_DONE = "Likes done during the last year";
private final static String TOOLTIP_LIKES_DONE_VRE = "Likes done during the last year in this VRE";
- private final static String TOOLTIP_REPLIES_DONE = "Post replies done during the last year";
- private final static String TOOLTIP_REPLIES_DONE_VRE = "Post replies done during the last year in this VRE";
- private final static String TOOLTIP_REPLIES_GOT = "Post replies got during the last year";
- private final static String TOOLTIP_REPLIES_GOT_VRE = "Post replies got during the last year in this VRE";
-
/**
* improve profile hints
*/
@@ -159,11 +154,6 @@ public class StatisticsPanel extends Composite {
*/
private long numberOfLikesGot;
- /**
- * Number of likes got
- */
- private long numberOfCommentsGot;
-
/**
* Pagebus to listen for events (coming from the news feed portlet)
*/
@@ -535,20 +525,7 @@ public class StatisticsPanel extends Composite {
TOOLTIP_LIKES_DONE_VRE + " (" + postsBean.getLikesMade() + ")",
ShowUserStatisticAction.LIKES_MADE_BY_USER,
information.getCurrentPageLanding());
-
- if(isRoot || isProfilePage)
- activityDone.setComments(
- formattedNumbers(postsBean.getCommentsMade()),
- TOOLTIP_REPLIES_DONE + " (" + postsBean.getCommentsMade() + ")",
- ShowUserStatisticAction.COMMENTS_MADE_BY_USER,
- information.getCurrentPageLanding());
- else
- activityDone.setComments(
- formattedNumbers(postsBean.getCommentsMade()),
- TOOLTIP_REPLIES_DONE_VRE +" (" + postsBean.getCommentsMade() + ")",
- ShowUserStatisticAction.COMMENTS_MADE_BY_USER,
- information.getCurrentPageLanding());
-
+
activityDoneWidgetContainer.appendToPanel(activityDone);
// updates comments and likes got
@@ -572,21 +549,6 @@ public class StatisticsPanel extends Composite {
information.getCurrentPageLanding());
numberOfLikesGot = postsBean.getLikesReceived();
-
- if(isRoot || isProfilePage)
- activityGot.setComments(
- formattedNumbers(postsBean.getCommentsReceived()),
- TOOLTIP_REPLIES_GOT + " (" + postsBean.getCommentsReceived() + ")",
- ShowUserStatisticAction.COMMENTS_GOT_BY_USER,
- information.getCurrentPageLanding());
- else
- activityGot.setComments(
- formattedNumbers(postsBean.getCommentsReceived()),
- TOOLTIP_REPLIES_GOT_VRE + " (" + postsBean.getCommentsReceived() + ")",
- ShowUserStatisticAction.COMMENTS_GOT_BY_USER,
- information.getCurrentPageLanding());
-
- numberOfCommentsGot = postsBean.getCommentsReceived();
activityGotWidgetContainer.appendToPanel(activityGot);
}
@@ -811,83 +773,7 @@ public class StatisticsPanel extends Composite {
}
});
- // increment comments got number
- pageBusAdapter.PageBusSubscribe(PageBusEvents.commentsIncrement, null, null, null, null);
-
- pageBusAdapter.addPageBusSubscriptionCallbackListener(new PageBusListener(){
-
- @Override
- public String getName() {
- return PageBusEvents.commentsIncrement;
- }
-
- @Override
- public void onPageBusSubscriptionCallback(PageBusEvent event) {
-
- if(event.getSubject().equals(this.getName())){
-
- GWT.log("Increment number of comments received");
-
- numberOfCommentsGot ++;
-
-
- if(isRoot)
- activityGot.setComments(
- formattedNumbers(numberOfCommentsGot),
- TOOLTIP_REPLIES_GOT + " (" + numberOfCommentsGot + ")",
- ShowUserStatisticAction.COMMENTS_GOT_BY_USER,
- informationBeanRetrieved.getCurrentPageLanding());
- else
- activityGot.setComments(
- formattedNumbers(numberOfCommentsGot),
- TOOLTIP_REPLIES_GOT_VRE + " (" + numberOfCommentsGot + ")",
- ShowUserStatisticAction.COMMENTS_GOT_BY_USER,
- informationBeanRetrieved.getCurrentPageLanding());
-
- GWT.log("Number of comments got changed to " + numberOfCommentsGot);
- }
- }
- });
-
- // decrement comments got
- pageBusAdapter.PageBusSubscribe(PageBusEvents.commentsDecrement, null, null, null, null);
-
- pageBusAdapter.addPageBusSubscriptionCallbackListener(new PageBusListener(){
-
- @Override
- public String getName() {
- return PageBusEvents.commentsDecrement;
- }
-
- @Override
- public void onPageBusSubscriptionCallback(PageBusEvent event) {
-
- if(event.getSubject().equals(this.getName())){
-
- GWT.log("Decrement number of comments received");
-
- // they can't be less than zero...
- numberOfCommentsGot --;
- numberOfCommentsGot = numberOfCommentsGot < 0 ? 0: numberOfCommentsGot;
- if(isRoot)
- activityGot.setComments(
- formattedNumbers(numberOfCommentsGot),
- TOOLTIP_REPLIES_GOT + " (" + numberOfCommentsGot + ")",
- ShowUserStatisticAction.COMMENTS_GOT_BY_USER,
- informationBeanRetrieved.getCurrentPageLanding());
- else
- activityGot.setComments(
- formattedNumbers(numberOfCommentsGot),
- TOOLTIP_REPLIES_GOT_VRE + " (" + numberOfCommentsGot + ")",
- ShowUserStatisticAction.COMMENTS_GOT_BY_USER,
- informationBeanRetrieved.getCurrentPageLanding());
-
- GWT.log("Number of comments got changed to " + numberOfCommentsGot);
- }
- }
- });
-
- GWT.log("Subscriptions ok");
+
} catch (PageBusAdapterException e) {
GWT.log(e.toString());
diff --git a/src/main/java/org/gcube/portlet/user/userstatisticsportlet/client/ui/ActivityWidget.java b/src/main/java/org/gcube/portlet/user/userstatisticsportlet/client/ui/ActivityWidget.java
index 9bbbc90..cebb42c 100644
--- a/src/main/java/org/gcube/portlet/user/userstatisticsportlet/client/ui/ActivityWidget.java
+++ b/src/main/java/org/gcube/portlet/user/userstatisticsportlet/client/ui/ActivityWidget.java
@@ -25,9 +25,6 @@ public class ActivityWidget extends Composite {
@UiField
Button likesButton;
- @UiField
- Button commentsButton;
-
@UiField
Button postsButton;
@@ -35,44 +32,10 @@ public class ActivityWidget extends Composite {
public ActivityWidget() {
initWidget(uiBinder.createAndBindUi(this));
-
- // set styles
- commentsButton.addStyleName("buttons-statistics-style");
likesButton.addStyleName("buttons-statistics-style");
postsButton.addStyleName("buttons-statistics-style");
}
- /**
- * Set comments information
- * @param value
- * @param tipIcon
- * @param tipValue
- * @param actionToTakeOnClick
- * @param landingPage
- */
- public void setComments(String value, String tipValue, final ShowUserStatisticAction actionToTakeOnClick, final String landingPage){
-
- commentsButton.setText(value);
- commentsButton.setTitle(tipValue);
-
- if(busEvents != null && actionToTakeOnClick != null){
-
- commentsButton.addClickHandler(new ClickHandler() {
-
- @Override
- public void onClick(ClickEvent event) {
-
- busEvents.fireEvent(new ShowFeedsRelatedToUserStatisticsEvent(actionToTakeOnClick, landingPage));
-
- }
- });
-
- }
-
- // set to visible
- commentsButton.setVisible(true);
- }
-
/**
* Set likes information
* @param value
diff --git a/src/main/java/org/gcube/portlet/user/userstatisticsportlet/client/ui/ActivityWidget.ui.xml b/src/main/java/org/gcube/portlet/user/userstatisticsportlet/client/ui/ActivityWidget.ui.xml
index 0a1960d..27ada22 100644
--- a/src/main/java/org/gcube/portlet/user/userstatisticsportlet/client/ui/ActivityWidget.ui.xml
+++ b/src/main/java/org/gcube/portlet/user/userstatisticsportlet/client/ui/ActivityWidget.ui.xml
@@ -15,8 +15,6 @@
visible="false">
-
\ No newline at end of file
diff --git a/src/main/java/org/gcube/portlet/user/userstatisticsportlet/server/UserStatisticsServiceImpl.java b/src/main/java/org/gcube/portlet/user/userstatisticsportlet/server/UserStatisticsServiceImpl.java
index 20bf00f..769a3bf 100644
--- a/src/main/java/org/gcube/portlet/user/userstatisticsportlet/server/UserStatisticsServiceImpl.java
+++ b/src/main/java/org/gcube/portlet/user/userstatisticsportlet/server/UserStatisticsServiceImpl.java
@@ -4,9 +4,7 @@ import java.io.InputStream;
import java.net.URL;
import java.util.ArrayList;
import java.util.Calendar;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
import java.util.Set;
import javax.xml.parsers.DocumentBuilder;
@@ -22,7 +20,6 @@ import org.gcube.common.scope.api.ScopeProvider;
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.Comment;
import org.gcube.portal.databook.shared.Feed;
import org.gcube.portlet.user.userstatisticsportlet.client.UserStatisticsService;
import org.gcube.portlet.user.userstatisticsportlet.server.cache.UserInfrastructureQuotaStorageCache;
@@ -288,10 +285,11 @@ public class UserStatisticsServiceImpl extends RemoteServiceServlet implements U
try {
long userId = userManager.getUserId(statisticsOfUsername);
- List userFeeds = store.getRecentFeedsByUserAndDate(statisticsOfUsername, oneYearAgo.getTimeInMillis());
+ List userPosts = store.getRecentFeedsByUserAndDate(statisticsOfUsername, oneYearAgo.getTimeInMillis());
+ logger.debug("store.getRecentFeedsByUserAndDate");
List recentLikedFeeds = store.getRecentLikedFeedsByUserAndDate(statisticsOfUsername, oneYearAgo.getTimeInMillis());
- List recentComments = store.getRecentCommentsByUserAndDate(statisticsOfUsername, oneYearAgo.getTimeInMillis());
-
+ logger.debug("store.getRecentLikedFeedsByUserAndDate");
+
// Evaluate the contexts to use
List contexts = new ArrayList();
if(isInfrastructure){
@@ -305,12 +303,12 @@ public class UserStatisticsServiceImpl extends RemoteServiceServlet implements U
logger.info("Context(s) that are going to be used " + contexts);
- long feedsMade = 0, likesGot = 0, commentsGot = 0, commentsMade = 0, likesMade = 0;
+ long postCreated = 0, likesGot = 0, commentsGot = 0, commentsMade = 0, likesMade = 0;
- for (Feed feed : userFeeds) {
+ for (Feed feed : userPosts) {
if(contexts.contains(feed.getVreid())){
- feedsMade ++;
+ postCreated ++;
commentsGot += Integer.parseInt(feed.getCommentsNo());
likesGot += Integer.parseInt(feed.getLikesNo());
}
@@ -321,20 +319,7 @@ public class UserStatisticsServiceImpl extends RemoteServiceServlet implements U
likesMade ++;
}
- Map parentFeeds = new HashMap();
-
- for (Comment comment : recentComments) {
- Feed parentFeed = null;
- if(!parentFeeds.containsKey(comment.getFeedid())){
- parentFeed = store.readFeed(comment.getFeedid());
- parentFeeds.put(comment.getFeedid(), parentFeed);
- }else
- parentFeed = parentFeeds.get(comment.getFeedid());
- if((contexts.contains(parentFeed.getVreid())))
- commentsMade ++;
- }
-
- toReturn = new PostsStatsBean(feedsMade, likesGot, commentsGot, commentsMade, likesMade);
+ toReturn = new PostsStatsBean(postCreated, likesGot, commentsGot, commentsMade, likesMade);
}catch(Exception e){
logger.error("Error while retrieving user's statistics", e);
diff --git a/src/main/java/org/gcube/portlet/user/userstatisticsportlet/shared/PostsStatsBean.java b/src/main/java/org/gcube/portlet/user/userstatisticsportlet/shared/PostsStatsBean.java
index a298f49..a579d31 100644
--- a/src/main/java/org/gcube/portlet/user/userstatisticsportlet/shared/PostsStatsBean.java
+++ b/src/main/java/org/gcube/portlet/user/userstatisticsportlet/shared/PostsStatsBean.java
@@ -15,8 +15,6 @@ public class PostsStatsBean implements Serializable{
private static final long serialVersionUID = 2043823499293477290L;
private long feedsNumber;
private long likesReceived;
- private long commentsReceived;
- private long commentsMade;
private long likesMade;
public PostsStatsBean(){
@@ -35,8 +33,6 @@ public class PostsStatsBean implements Serializable{
super();
this.feedsNumber = feeds;
this.likesReceived = likesReceived;
- this.commentsReceived = commentsReceived;
- this.commentsMade = commentsMade;
this.likesMade = likesMade;
}
@@ -56,22 +52,6 @@ public class PostsStatsBean implements Serializable{
this.likesReceived = likesReceived;
}
- public long getCommentsReceived() {
- return commentsReceived;
- }
-
- public void setCommentsReceived(long commentsReceived) {
- this.commentsReceived = commentsReceived;
- }
-
- public long getCommentsMade() {
- return commentsMade;
- }
-
- public void setCommentsMade(long commentsMade) {
- this.commentsMade = commentsMade;
- }
-
public long getLikesMade() {
return likesMade;
}
@@ -82,10 +62,10 @@ public class PostsStatsBean implements Serializable{
@Override
public String toString() {
- return "PostsStatsBean [feeds=" + feedsNumber + ", likesReceived="
- + likesReceived + ", commentsReceived=" + commentsReceived
- + ", commentsMade=" + commentsMade + ", likesMade=" + likesMade
- + "]";
+ return "PostsStatsBean [feedsNumber=" + feedsNumber + ", likesReceived=" + likesReceived + ", likesMade="
+ + likesMade + "]";
}
+
+
}