Events sent to user-statistics have been disabled for now.
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/news-feed@122580 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
de744ed951
commit
2aa721710f
|
@ -4,9 +4,6 @@
|
|||
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-sources/gwt"/>
|
||||
<dependent-module archiveName="image-previewer-widget-1.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/image-previewer-widget/image-previewer-widget">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<property name="java-output-path" value="/${module}/target/www/WEB-INF/classes"/>
|
||||
<property name="context-root" value="news-feed"/>
|
||||
</wb-module>
|
||||
|
|
|
@ -8,9 +8,9 @@ import net.eliasbalasis.tibcopagebus4gwt.client.PageBusListener;
|
|||
import org.gcube.portal.databook.shared.ClientFeed;
|
||||
import org.gcube.portal.databook.shared.ClientFeed.ClientFeedJsonizer;
|
||||
import org.gcube.portlets.user.gcubewidgets.client.ClientScopeHelper;
|
||||
import org.gcube.portlets.user.newsfeed.client.event.PageBusEvents;
|
||||
import org.gcube.portlets.user.newsfeed.client.panels.NewsFeedPanel;
|
||||
import org.jsonmaker.gwt.client.Jsonizer;
|
||||
import org.jsonmaker.gwt.client.base.Defaults;
|
||||
|
||||
import com.google.gwt.core.client.EntryPoint;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
|
@ -50,28 +50,34 @@ public class NewsFeed implements EntryPoint {
|
|||
ClientFeed notification = new ClientFeed();
|
||||
//Subscribe to message and associate subsequent receptions with custom subscriber data
|
||||
try {
|
||||
pageBusAdapter.PageBusSubscribe("org.gcube.portal.databook.shared", null, null, notification, (Jsonizer)GWT.create(ClientFeedJsonizer.class));
|
||||
pageBusAdapter.PageBusSubscribe(PageBusEvents.newPostCreated, null, null, notification, (Jsonizer)GWT.create(ClientFeedJsonizer.class));
|
||||
}
|
||||
catch (PageBusAdapterException e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
|
||||
pageBusAdapter.addPageBusSubscriptionCallbackListener(new PageBusListener() {
|
||||
@Override
|
||||
public void onPageBusSubscriptionCallback(PageBusEvent event) {
|
||||
// translate JavaScript message contents and subscriber data to their Java equivalents
|
||||
try {
|
||||
ClientFeed feed = (ClientFeed)event.getMessage((Jsonizer)GWT.create(ClientFeedJsonizer.class));
|
||||
mainPanel.addJustAddedFeed(feed);
|
||||
|
||||
// alert the User statistics portlet to increment the number of user's posts
|
||||
pageBusAdapter.PageBusPublish("org.gcube.portal.incrementPostCount", "", Defaults.STRING_JSONIZER);
|
||||
if(event.getSubject().equals(this.getName())){
|
||||
// translate JavaScript message contents and subscriber data to their Java equivalents
|
||||
try {
|
||||
ClientFeed feed = (ClientFeed)event.getMessage((Jsonizer)GWT.create(ClientFeedJsonizer.class));
|
||||
mainPanel.addJustAddedFeed(feed);
|
||||
|
||||
} catch (PageBusAdapterException e) {
|
||||
e.printStackTrace();
|
||||
// alert the User statistics portlet to increment the number of user's posts
|
||||
// TODO
|
||||
// pageBusAdapter.PageBusPublish(PageBusEvents.postIncrement, "", Defaults.STRING_JSONIZER);
|
||||
|
||||
} catch (PageBusAdapterException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public String getName() {
|
||||
return null;
|
||||
return PageBusEvents.newPostCreated;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
package org.gcube.portlets.user.newsfeed.client.event;
|
||||
|
||||
/**
|
||||
* This class contains the events (in a package like format) to which this portlet listens at.
|
||||
* NOTE: these events are the same in the User-Statistics portlet and the share-updates one.
|
||||
* @author Costantino Perciante at ISTI-CNR
|
||||
* (costantino.perciante@isti.cnr.it)
|
||||
*/
|
||||
public class PageBusEvents {
|
||||
|
||||
// events in this portlet and user-statistics
|
||||
public static final String postIncrement = "org.gcube.portal.incrementPostCount";
|
||||
public static final String postDecrement = "org.gcube.portal.decrementPostCount";
|
||||
public static final String likesIncrement = "org.gcube.portal.incrementLikesGot";
|
||||
public static final String likesDecrement = "org.gcube.portal.decrementLikesGot";
|
||||
public static final String commentsIncrement = "org.gcube.portal.incrementCommentsGot";
|
||||
public static final String commentsDecrement = "org.gcube.portal.decrementCommentsGot";
|
||||
|
||||
// events in this portlet and the share-updates one
|
||||
public static final String newPostCreated = "org.gcube.portal.databook.shared";
|
||||
}
|
|
@ -4,7 +4,6 @@ import java.util.ArrayList;
|
|||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
|
||||
import net.eliasbalasis.tibcopagebus4gwt.client.PageBusAdapterException;
|
||||
|
||||
import org.gcube.portal.databook.client.GCubeSocialNetworking;
|
||||
import org.gcube.portal.databook.client.util.Encoder;
|
||||
|
@ -17,7 +16,6 @@ import org.gcube.portal.databook.shared.Like;
|
|||
import org.gcube.portal.databook.shared.PrivacyLevel;
|
||||
import org.gcube.portal.databook.shared.UserInfo;
|
||||
import org.gcube.portlets.user.newsfeed.client.FilterType;
|
||||
import org.gcube.portlets.user.newsfeed.client.NewsFeed;
|
||||
import org.gcube.portlets.user.newsfeed.client.NewsService;
|
||||
import org.gcube.portlets.user.newsfeed.client.NewsServiceAsync;
|
||||
import org.gcube.portlets.user.newsfeed.client.event.AddCommentEvent;
|
||||
|
@ -60,7 +58,6 @@ import org.gcube.portlets.widgets.userselection.client.events.SelectedUserEvent;
|
|||
import org.gcube.portlets.widgets.userselection.client.events.SelectedUserEventHandler;
|
||||
import org.gcube.portlets.widgets.userselection.client.events.UsersFetchedEvent;
|
||||
import org.gcube.portlets.widgets.userselection.shared.ItemSelectableBean;
|
||||
import org.jsonmaker.gwt.client.base.Defaults;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.core.client.RunAsyncCallback;
|
||||
|
@ -973,14 +970,15 @@ public class NewsFeedPanel extends Composite {
|
|||
owner.updateCommentsNumberCount();
|
||||
owner.showAddCommentForm(false);
|
||||
|
||||
if(owner.isUser()){
|
||||
/*if(owner.isUser()){
|
||||
* TODO
|
||||
// alert the User statistics portlet to increment the number of comments got
|
||||
try {
|
||||
NewsFeed.pageBusAdapter.PageBusPublish("org.gcube.portal.incrementCommentsGot", "", Defaults.STRING_JSONIZER);
|
||||
NewsFeed.pageBusAdapter.PageBusPublish(PageBusEvents.commentsIncrement, "", Defaults.STRING_JSONIZER);
|
||||
} catch (PageBusAdapterException e) {
|
||||
GWT.log(e.toString());
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -1056,14 +1054,14 @@ public class NewsFeedPanel extends Composite {
|
|||
doShowComments(owner, false);
|
||||
owner.updateCommentsNumberCount();
|
||||
|
||||
if(owner.isUser()){
|
||||
/*if(owner.isUser()){ TODO
|
||||
// alert the User statistics portlet to decrement the number of comments got
|
||||
try {
|
||||
NewsFeed.pageBusAdapter.PageBusPublish("org.gcube.portal.decrementCommentsGot", "", Defaults.STRING_JSONIZER);
|
||||
NewsFeed.pageBusAdapter.PageBusPublish(PageBusEvents.commentsDecrement, "", Defaults.STRING_JSONIZER);
|
||||
} catch (PageBusAdapterException ex) {
|
||||
GWT.log(ex.toString());
|
||||
}
|
||||
}
|
||||
}*/
|
||||
} else
|
||||
Window.alert("Comment could not be deleted, please try again in a short while.");
|
||||
}
|
||||
|
@ -1084,6 +1082,17 @@ public class NewsFeedPanel extends Composite {
|
|||
public void onSuccess(Boolean result) {
|
||||
if (result) {
|
||||
toDelete.removeFromParent();
|
||||
|
||||
// alert the user-statistics portlet to reduce the number of likes and replies
|
||||
// there were
|
||||
/*if(toDelete.isUser()){
|
||||
int numComments = toDelete.get
|
||||
try {
|
||||
NewsFeed.pageBusAdapter.PageBusPublish(PageBusEvents.commentsDecrement, "", Defaults.STRING_JSONIZER);
|
||||
} catch (PageBusAdapterException ex) {
|
||||
GWT.log(ex.toString());
|
||||
}
|
||||
}*/
|
||||
} else
|
||||
Window.alert("Feed could not be deleted, please try again in a short while.");
|
||||
}
|
||||
|
|
|
@ -7,15 +7,12 @@ import java.util.ArrayList;
|
|||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import net.eliasbalasis.tibcopagebus4gwt.client.PageBusAdapterException;
|
||||
|
||||
import org.gcube.portal.databook.client.GCubeSocialNetworking;
|
||||
import org.gcube.portal.databook.client.util.Encoder;
|
||||
import org.gcube.portal.databook.shared.Attachment;
|
||||
import org.gcube.portal.databook.shared.Comment;
|
||||
import org.gcube.portal.databook.shared.Feed;
|
||||
import org.gcube.portal.databook.shared.UserInfo;
|
||||
import org.gcube.portlets.user.newsfeed.client.NewsFeed;
|
||||
import org.gcube.portlets.user.newsfeed.client.event.AddLikeEvent;
|
||||
import org.gcube.portlets.user.newsfeed.client.event.DeleteFeedEvent;
|
||||
import org.gcube.portlets.user.newsfeed.client.event.OpenFeedEvent;
|
||||
|
@ -26,7 +23,6 @@ import org.gcube.portlets.user.newsfeed.client.panels.NewsFeedPanel;
|
|||
import org.gcube.portlets.user.newsfeed.shared.EnhancedFeed;
|
||||
import org.gcube.portlets.widgets.imagepreviewerwidget.client.EnhancedImage;
|
||||
import org.gcube.portlets.widgets.imagepreviewerwidget.client.ui.Carousel;
|
||||
import org.jsonmaker.gwt.client.base.Defaults;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.core.client.RunAsyncCallback;
|
||||
|
@ -410,17 +406,17 @@ public class TweetTemplate extends Composite {
|
|||
if (isUsers || myUserInfo.isAdmin()){
|
||||
eventBus.fireEvent(new DeleteFeedEvent(this));
|
||||
|
||||
if(isUsers){
|
||||
try {
|
||||
/*if(isUsers){
|
||||
try { TODO
|
||||
|
||||
// alert the User statistics portlet to decrement the number of user's posts
|
||||
NewsFeed.pageBusAdapter.PageBusPublish("org.gcube.portal.decrementPostCount", "", Defaults.STRING_JSONIZER);
|
||||
NewsFeed.pageBusAdapter.PageBusPublish(PageBusEvents.postDecrement, "", Defaults.STRING_JSONIZER);
|
||||
|
||||
} catch (PageBusAdapterException e1) {
|
||||
GWT.log("Unable to send this notification " + e1.toString());
|
||||
}
|
||||
|
||||
}
|
||||
}*/
|
||||
}
|
||||
else {
|
||||
GWT.log("not belong to user");
|
||||
|
@ -480,17 +476,17 @@ public class TweetTemplate extends Composite {
|
|||
eventBus.fireEvent(new AddLikeEvent(this, myFeed.getFeed().getKey()));
|
||||
setFavoritedUI(true);
|
||||
|
||||
// alert the User statistics portlet to increment the number of likes got
|
||||
if(isUsers){
|
||||
// alert the User statistics portlet to increment the number of likes got TODO
|
||||
/*if(isUsers){
|
||||
try {
|
||||
NewsFeed.pageBusAdapter.PageBusPublish(
|
||||
"org.gcube.portal.incrementLikesGot"
|
||||
PageBusEvents.likesIncrement
|
||||
, ""
|
||||
, Defaults.STRING_JSONIZER);
|
||||
} catch (PageBusAdapterException ex) {
|
||||
GWT.log(e.toString());
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
catch (NumberFormatException ex) {
|
||||
likeArea.setHTML("Error on the server");
|
||||
|
@ -512,16 +508,16 @@ public class TweetTemplate extends Composite {
|
|||
setFavoritedUI(false);
|
||||
|
||||
// alert the User statistics portlet to decrement the number of likes got
|
||||
if(isUsers){
|
||||
/*if(isUsers){ TODO
|
||||
try {
|
||||
NewsFeed.pageBusAdapter.PageBusPublish(
|
||||
"org.gcube.portal.decrementLikesGot"
|
||||
PageBusEvents.likesDecrement
|
||||
, ""
|
||||
, Defaults.STRING_JSONIZER);
|
||||
} catch (PageBusAdapterException ex) {
|
||||
GWT.log(e.toString());
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue