modified hashtags search for being non case sensitive
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/news-feed@100732 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
61c31fd6d4
commit
9d781c080c
|
@ -303,8 +303,7 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
_log.info("****** retrieving feeds for user: " + userName);
|
String lowerCaseHashtag = hashtag.toLowerCase();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* this handles the case where the portlet is deployed outside of VREs (regular)
|
* this handles the case where the portlet is deployed outside of VREs (regular)
|
||||||
*/
|
*/
|
||||||
|
@ -314,11 +313,9 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService
|
||||||
for (Organization org : currUser.getOrganizations()) {
|
for (Organization org : currUser.getOrganizations()) {
|
||||||
GroupManager gm = new LiferayGroupManager();
|
GroupManager gm = new LiferayGroupManager();
|
||||||
if (gm.isVRE(org.getOrganizationId()+"")) {
|
if (gm.isVRE(org.getOrganizationId()+"")) {
|
||||||
String vreid = gm.getScope(""+org.getOrganizationId()); //get the scope
|
String vreid = gm.getScope(""+org.getOrganizationId()); //get the scope
|
||||||
_log.debug("Reading hastagged feeds for VRE: " + vreid + " hashtag=" + hashtag);
|
ArrayList<Feed> feeds = (ArrayList<Feed>) store.getVREFeedsByHashtag(vreid, lowerCaseHashtag);
|
||||||
|
for (Feed feed : feeds) {
|
||||||
ArrayList<Feed> OrganizationFeeds = (ArrayList<Feed>) store.getVREFeedsByHashtag(vreid, hashtag);
|
|
||||||
for (Feed feed : OrganizationFeeds) {
|
|
||||||
feedsMap.put(feed.getKey(), feed);
|
feedsMap.put(feed.getKey(), feed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -327,9 +324,8 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService
|
||||||
//else must be in a VRE scope
|
//else must be in a VRE scope
|
||||||
else {
|
else {
|
||||||
String vreid = session.getScopeName();
|
String vreid = session.getScopeName();
|
||||||
_log.trace("News Feed in VRE, Reading feeds for VRE: " + vreid);
|
ArrayList<Feed> feeds = (ArrayList<Feed>) store.getVREFeedsByHashtag(vreid, lowerCaseHashtag);
|
||||||
ArrayList<Feed> OrganizationFeeds = (ArrayList<Feed>) store.getVREFeedsByHashtag(vreid, hashtag);
|
for (Feed feed : feeds) {
|
||||||
for (Feed feed : OrganizationFeeds) {
|
|
||||||
feedsMap.put(feed.getKey(), feed);
|
feedsMap.put(feed.getKey(), feed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -364,6 +360,8 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* return only the user connection feeds
|
* return only the user connection feeds
|
||||||
*/
|
*/
|
||||||
|
@ -809,7 +807,7 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService
|
||||||
}
|
}
|
||||||
_log.trace("Attempting to delete feed " + feedid);
|
_log.trace("Attempting to delete feed " + feedid);
|
||||||
return store.deleteFeed(feedid);
|
return store.deleteFeed(feedid);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -180,4 +180,43 @@ public class Utils {
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
// *
|
||||||
|
// * @param vreid
|
||||||
|
// * @param hashtag
|
||||||
|
// * @return the feed map for the client containing occurrences of the hashtag
|
||||||
|
// * @throws PrivacyLevelTypeNotFoundException
|
||||||
|
// * @throws FeedTypeNotFoundException
|
||||||
|
// * @throws FeedIDNotFoundException
|
||||||
|
// * @throws ColumnNameNotFoundException
|
||||||
|
// */
|
||||||
|
// private HashMap<String, Feed> getFeedsMap(String vreid, String hashtag) throws PrivacyLevelTypeNotFoundException, FeedTypeNotFoundException, FeedIDNotFoundException, ColumnNameNotFoundException {
|
||||||
|
// if (hashtag.length() < 2)
|
||||||
|
// throw new IllegalArgumentException("Hashtag length myst be greater than 1");
|
||||||
|
// else {
|
||||||
|
// HashMap<String, Feed> feedsMap = new HashMap<String, Feed>();
|
||||||
|
// String upperCase = hashtag;
|
||||||
|
// String lowerCase = hashtag;
|
||||||
|
//
|
||||||
|
// char afterHashtag = hashtag.charAt(1);
|
||||||
|
// if (Character.isUpperCase(afterHashtag)) {
|
||||||
|
// upperCase = hashtag;
|
||||||
|
// lowerCase =hashtag.substring(0,1)+Character.toLowerCase(afterHashtag)+hashtag.substring(2);
|
||||||
|
// } else {
|
||||||
|
// upperCase =hashtag.substring(0,1)+Character.toUpperCase(afterHashtag)+hashtag.substring(2);
|
||||||
|
// lowerCase = hashtag;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// ArrayList<Feed> lowerCaseFeeds = (ArrayList<Feed>) store.getVREFeedsByHashtag(vreid, lowerCase);
|
||||||
|
// for (Feed feed : lowerCaseFeeds) {
|
||||||
|
// feedsMap.put(feed.getKey(), feed);
|
||||||
|
// }
|
||||||
|
// ArrayList<Feed> upperCaseFeeds = (ArrayList<Feed>) store.getVREFeedsByHashtag(vreid, upperCase);
|
||||||
|
// for (Feed feed : upperCaseFeeds) {
|
||||||
|
// feedsMap.put(feed.getKey(), feed);
|
||||||
|
// }
|
||||||
|
// return feedsMap;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue