Compare commits

...

12 Commits

22 changed files with 101 additions and 89 deletions

View File

@ -1,6 +1,11 @@
# Changelog
## [v3.0.0] - 2023-12-06
## [v3.0.1] - 2023-04-22
- Feature 27286: removed noisy logs
- Bug 27218: advance social networking library version
## [v3.0.0-SNAPSHOT] - 2023-12-06
- Feature #26193, new impl for get users by role in a VRE
- Replace Astyanx Java client for Cassandra 2 with Datastax client for Cassandra 4

View File

@ -6,13 +6,13 @@
<parent>
<groupId>org.gcube.tools</groupId>
<artifactId>maven-parent</artifactId>
<version>1.1.0</version>
<version>1.2.0</version>
</parent>
<groupId>org.gcube.portal</groupId>
<artifactId>social-networking-library-ws</artifactId>
<packaging>war</packaging>
<version>3.0.0</version>
<version>3.0.1</version>
<name>social-networking-library-ws</name>
<description>Rest interface for the social networking library.</description>
<properties>
@ -136,7 +136,7 @@
<dependency>
<groupId>org.gcube.portal</groupId>
<artifactId>social-networking-library</artifactId>
<version>[2.0.0-SNAPSHOT, 3.0.0)</version>
<version>[2.0.0, 3.0.0)</version>
<scope>compile</scope>
</dependency>
<dependency>

View File

@ -16,7 +16,7 @@ public class GroupsCache {
*/
private GroupsCache(){
logger.info("Building cache");
logger.debug("Building cache");
CachesManager.getCache(CachesManager.GROUPS_CACHE);
}

View File

@ -55,7 +55,7 @@ public class SocialNetworkingSiteFinder {
// read fallback properties
try{
logger.info("Trying to read config.properties");
logger.debug("Trying to read config.properties");
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
InputStream input = classLoader.getResourceAsStream("config.properties");
Properties properties = new Properties();
@ -140,7 +140,7 @@ public class SocialNetworkingSiteFinder {
if(gatewayVirtualGroups != null && !gatewayVirtualGroups.isEmpty()){
for (VirtualGroup gatewayVirtualGroup : gatewayVirtualGroups) {
if(virtualGroupsOfGroup.contains(gatewayVirtualGroup)){
logger.info("Matching gateway for scope " + scope + " is " + gateway);
logger.debug("Matching gateway for scope " + scope + " is " + gateway);
matchingGateway = gateway;
break ext_loop;
}

View File

@ -33,7 +33,7 @@ public class UsersCache{
new Thread(){
public void run() {
try{
logger.info("Fetching users and putting them into cache");
logger.debug("Fetching users and putting them into cache");
Ehcache usersCache = CachesManager.getCache(CachesManager.USERS_CACHE);
GroupManager groupManager = GroupManagerWSBuilder.getInstance().getGroupManager();
UserManager userManager = UserManagerWSBuilder.getInstance().getUserManager();

View File

@ -17,7 +17,7 @@ public class GroupManagerWSBuilder {
private GroupManagerWSBuilder(){
logger.info("Building GroupManager please wait");
logger.debug("Building GroupManager please wait");
try{
groupManagerWs = new LiferayWSGroupManager(
@ -31,7 +31,7 @@ public class GroupManagerWSBuilder {
return;
}
logger.info("GroupManager instance built");
logger.debug("GroupManager instance built");
}

View File

@ -43,10 +43,10 @@ public class KeycloakAPICredentials {
* Private constructor
*/
private KeycloakAPICredentials() {
logger.info("Building KeycloakAPICredentials object");
logger.debug("Building KeycloakAPICredentials object");
lookupPropertiesFromIs();
logger.info("KeycloakAPICredentials object built");
logger.debug("KeycloakAPICredentials object built");
}
/**
@ -54,12 +54,12 @@ public class KeycloakAPICredentials {
*/
private void lookupPropertiesFromIs() {
logger.info("Starting creating KeycloakAPICredentials");
logger.debug("Starting creating KeycloakAPICredentials");
String oldContext = ScopeProvider.instance.get();
ApplicationContext ctx = ContextProvider.get(); // get this info from SmartGears
ScopeProvider.instance.set("/"+ctx.container().configuration().infrastructure());
logger.info("Discovering liferay user's credentials in context " + ctx.container().configuration().infrastructure());
logger.debug("Discovering liferay user's credentials in context " + ctx.container().configuration().infrastructure());
try{
List<ServiceEndpoint> resources = getConfigurationFromIS();
@ -92,7 +92,7 @@ public class KeycloakAPICredentials {
ScopeProvider.instance.set(oldContext);
}
logger.info("Bean built " + toString());
logger.debug("Bean built " + toString());
}
/**

View File

@ -52,10 +52,10 @@ public class LiferayJSONWsCredentials {
* Private constructor
*/
private LiferayJSONWsCredentials() {
logger.info("Building LiferayJSONWsCredentials object");
logger.debug("Building LiferayJSONWsCredentials object");
loadNotifierToken();
lookupPropertiesFromIs();
logger.info("LiferayJSONWsCredentials object built");
logger.debug("LiferayJSONWsCredentials object built");
}
/**
@ -75,7 +75,7 @@ public class LiferayJSONWsCredentials {
*/
private void lookupPropertiesFromIs() {
logger.info("Starting creating LiferayJSONWsCredentials");
logger.debug("Starting creating LiferayJSONWsCredentials");
String oldContext = ScopeProvider.instance.get();
ApplicationContext ctx = ContextProvider.get(); // get this info from SmartGears
@ -118,7 +118,7 @@ public class LiferayJSONWsCredentials {
ScopeProvider.instance.set(oldContext);
}
logger.info("Bean built " + toString());
logger.debug("Bean built " + toString());
}
/**

View File

@ -17,7 +17,7 @@ public class RoleManagerWSBuilder {
private RoleManagerWSBuilder(){
logger.info("Building UserManager please wait");
logger.debug("Building UserManager please wait");
try{
roleManagerWs = new LiferayWSRoleManager(
@ -31,7 +31,7 @@ public class RoleManagerWSBuilder {
return;
}
logger.info("UserManager instance built");
logger.debug("UserManager instance built");
}

View File

@ -17,7 +17,7 @@ public class UserManagerWSBuilder {
private UserManagerWSBuilder(){
logger.info("Building UserManager please wait");
logger.debug("Building UserManager please wait");
try{
userManagerWs = new LiferayWSUserManager(
@ -31,7 +31,7 @@ public class UserManagerWSBuilder {
return;
}
logger.info("UserManager instance built");
logger.debug("UserManager instance built");
}

View File

@ -84,7 +84,7 @@ public class Comments {
List<Comment> comments = null;
try{
logger.info("Retrieving comments for user id " + username);
logger.debug("Retrieving comments for user id " + username);
comments = CassandraConnection.getInstance().getDatabookStore().getAllCommentByPost(key);
Filters.filterCommentsPerContext(comments, context);
responseBean.setResult(comments);
@ -119,7 +119,7 @@ public class Comments {
List<Comment> comments = null;
try{
logger.info("Retrieving comments for user id " + username);
logger.debug("Retrieving comments for user id " + username);
comments = CassandraConnection.getInstance().getDatabookStore().getRecentCommentsByUserAndDate(username, 0);
Filters.filterCommentsPerContext(comments, context);
responseBean.setResult(comments);
@ -154,7 +154,7 @@ public class Comments {
List<Comment> comments = null;
try{
logger.info("Retrieving comments for user id " + username);
logger.debug("Retrieving comments for user id " + username);
comments = CassandraConnection.getInstance().getDatabookStore().getRecentCommentsByUserAndDate(username, timeInMillis);
Filters.filterCommentsPerContext(comments, context);
responseBean.setResult(comments);
@ -203,7 +203,7 @@ public class Comments {
String postOwnerId = CassandraConnection.getInstance().getDatabookStore().readPost(postId).getEntityId();
Comment theComment = SocialUtils.commentPost(userid, time, postId, commentText, postOwnerId, context);
if (theComment != null)
logger.info("Added comment " + theComment.toString());
logger.debug("Added comment " + theComment.toString());
else {
logger.error("Unable to write comment");
responseBean.setMessage("Unable to write comment, something went wrong please see server log");

View File

@ -60,7 +60,7 @@ public class HashTags {
ResponseBean responseBean = new ResponseBean();
Status status = Status.OK;
logger.info("User " + username + " has requested hashtags of context " + context);
logger.debug("User " + username + " has requested hashtags of context " + context);
try{
DatabookStore datastore = CassandraConnection.getInstance().getDatabookStore();

View File

@ -50,7 +50,7 @@ public class Lib {
ResponseBean responseBean = new ResponseBean();
Status status = Status.OK;
try {
logger.info("Writing comment with commentid " + comment.getKey());
logger.debug("Writing comment with commentid " + comment.getKey());
boolean result = CassandraConnection.getInstance().getDatabookStore().addComment(comment);
responseBean.setResult(result);
responseBean.setMessage("");
@ -72,7 +72,7 @@ public class Lib {
ResponseBean responseBean = new ResponseBean();
Status status = Status.OK;
try{
logger.info("Getting comment with commentid " + commentid);
logger.debug("Getting comment with commentid " + commentid);
Comment result = CassandraConnection.getInstance().getDatabookStore().readCommentById(commentid);
responseBean.setResult(result);
responseBean.setMessage("");
@ -103,7 +103,7 @@ public class Lib {
List<Comment> comments = null;
try{
logger.info("Retrieving comments for postid " + postid);
logger.debug("Retrieving comments for postid " + postid);
comments = CassandraConnection.getInstance().getDatabookStore().getAllCommentByPost(postid);
responseBean.setResult(comments);
responseBean.setSuccess(true);
@ -133,7 +133,7 @@ public class Lib {
List<Comment> comments = null;
try{
logger.info("Retrieving comments for user id " + username);
logger.debug("Retrieving comments for user id " + username);
comments = CassandraConnection.getInstance().getDatabookStore().getRecentCommentsByUserAndDate(username, timeInMillis);
responseBean.setResult(comments);
responseBean.setMessage("");
@ -160,7 +160,7 @@ public class Lib {
ResponseBean responseBean = new ResponseBean();
Status status = Status.OK;
try{
logger.info("Writing comment with commentid " + comment.getKey());
logger.debug("Writing comment with commentid " + comment.getKey());
boolean result = CassandraConnection.getInstance().getDatabookStore().editComment(comment);
responseBean.setResult(result);
responseBean.setMessage("");
@ -187,7 +187,7 @@ public class Lib {
ResponseBean responseBean = new ResponseBean();
Status status = Status.OK;
try{
logger.info("deleting comment with commentid " + commentid);
logger.debug("deleting comment with commentid " + commentid);
boolean result = CassandraConnection.getInstance().getDatabookStore().deleteComment(commentid, postid);
responseBean.setResult(result);
responseBean.setMessage("");
@ -218,7 +218,7 @@ public class Lib {
ResponseBean responseBean = new ResponseBean();
Status status = Status.OK;
try{
logger.info("Saving hashtags " );
logger.debug("Saving hashtags " );
boolean result = CassandraConnection.getInstance().getDatabookStore().saveHashTags(feedid,vreid,hashtags);
responseBean.setResult(result);
responseBean.setMessage("");
@ -249,7 +249,7 @@ public class Lib {
ResponseBean responseBean = new ResponseBean();
Status status = Status.OK;
try{
logger.info("deleting hashtags " );
logger.debug("deleting hashtags " );
boolean result = CassandraConnection.getInstance().getDatabookStore().deleteHashTags(feedid,vreid,hashtags);
responseBean.setResult(result);
responseBean.setMessage("");
@ -280,7 +280,7 @@ public class Lib {
ResponseBean responseBean = new ResponseBean();
Status status = Status.OK;
try{
logger.info("Saving hashtags comments " );
logger.debug("Saving hashtags comments " );
boolean result = CassandraConnection.getInstance().getDatabookStore().saveHashTagsComment(commentid,vreid,hashtags);
responseBean.setResult(result);
responseBean.setMessage("");
@ -310,7 +310,7 @@ public class Lib {
ResponseBean responseBean = new ResponseBean();
Status status = Status.OK;
try{
logger.info("deleting hashtags " );
logger.debug("deleting hashtags " );
boolean result = CassandraConnection.getInstance().getDatabookStore().deleteHashTagsComment(commentid,vreid,hashtags);
responseBean.setResult(result);
responseBean.setMessage("");
@ -338,7 +338,7 @@ public class Lib {
Map<String, Integer> hashtags = null;
try{
logger.info("getting vre hashtags occurrences " + vreid);
logger.debug("getting vre hashtags occurrences " + vreid);
hashtags = CassandraConnection.getInstance().getDatabookStore().getVREHashtagsWithOccurrence(vreid);
responseBean.setResult(hashtags);
responseBean.setMessage("");
@ -369,7 +369,7 @@ public class Lib {
Map<String, Integer> hashtags = null;
try{
logger.info("getting vre hashtags occurrences " + vreid);
logger.debug("getting vre hashtags occurrences " + vreid);
hashtags = CassandraConnection.getInstance().getDatabookStore().getVREHashtagsWithOccurrenceFilteredByTime(vreid, timestamp);
responseBean.setResult(hashtags);
responseBean.setMessage("");
@ -399,7 +399,7 @@ public class Lib {
List<Post> posts = null;
try{
logger.info("getting vre hashtags occurrences " + vreid);
logger.debug("getting vre hashtags occurrences " + vreid);
posts = CassandraConnection.getInstance().getDatabookStore().getVREPostsByHashtag(vreid, hashtag);
responseBean.setResult(posts);
responseBean.setMessage("");
@ -428,7 +428,7 @@ public class Lib {
String inv = null;
try{
logger.info("Retrieving invite for vre " + vreid);
logger.debug("Retrieving invite for vre " + vreid);
inv = CassandraConnection.getInstance().getDatabookStore().isExistingInvite(vreid, email);
responseBean.setResult(inv);
responseBean.setMessage("");
@ -481,7 +481,7 @@ public class Lib {
Invite inv = null;
try{
logger.info("Retrieving invite for id " + inviteid);
logger.debug("Retrieving invite for id " + inviteid);
inv = CassandraConnection.getInstance().getDatabookStore().readInvite(inviteid);
responseBean.setResult(inv);
responseBean.setMessage("");
@ -570,7 +570,7 @@ public class Lib {
ResponseBean responseBean = new ResponseBean();
Status status = Status.OK;
try{
logger.info("Writing like with likeid " + like.getKey());
logger.debug("Writing like with likeid " + like.getKey());
boolean result = CassandraConnection.getInstance().getDatabookStore().like(like);
responseBean.setResult(result);
responseBean.setMessage("");
@ -599,7 +599,7 @@ public class Lib {
ResponseBean responseBean = new ResponseBean();
Status status = Status.OK;
try{
logger.info("Writing unlike with likeid " + likeid);
logger.debug("Writing unlike with likeid " + likeid);
boolean result = CassandraConnection.getInstance().getDatabookStore().unlike(userid,likeid,feedid);
responseBean.setResult(result);
responseBean.setMessage("");
@ -627,7 +627,7 @@ public class Lib {
List<String> likes = null;
try{
logger.info("Retrieving likes for user id " + userid);
logger.debug("Retrieving likes for user id " + userid);
likes = CassandraConnection.getInstance().getDatabookStore().getAllLikedPostIdsByUser(userid);
responseBean.setResult(likes);
responseBean.setMessage("");
@ -655,7 +655,7 @@ public class Lib {
List<Like> likes = null;
try{
logger.info("Retrieving likes for post id " + postid);
logger.debug("Retrieving likes for post id " + postid);
likes = CassandraConnection.getInstance().getDatabookStore().getAllLikesByPost(postid);
responseBean.setResult(likes);
responseBean.setMessage("");
@ -928,9 +928,9 @@ public class Lib {
) throws ValidationException{
ResponseBean responseBean = new ResponseBean();
for(NotificationType notificationType: enabledChannels.keySet()){
logger.info("Type: " + notificationType.toString());
logger.debug("Type: " + notificationType.toString());
for(NotificationChannelType channelType: enabledChannels.get(notificationType)){
logger.info(channelType.toString());
logger.debug(channelType.toString());
}
}
Status status = Status.OK;
@ -1017,8 +1017,8 @@ public class Lib {
responseBean.setMessage("");
responseBean.setSuccess(result);
}catch(Exception e){
logger.info("Unable to write attachment.", e);
logger.info(e.getMessage());
logger.error("Unable to write attachment.", e);
logger.error(e.getMessage());
responseBean.setMessage(e.getMessage());
responseBean.setSuccess(false);
status = Status.INTERNAL_SERVER_ERROR;

View File

@ -73,7 +73,7 @@ public class Likes {
List<Like> likes = null;
try{
logger.info("Retrieving likes for user id " + username);
logger.debug("Retrieving likes for user id " + username);
likes = CassandraConnection.getInstance().getDatabookStore().getAllLikesByPost(key);
responseBean.setResult(likes);
responseBean.setSuccess(true);
@ -113,7 +113,7 @@ public class Likes {
Status status = Status.OK;
boolean likeResultOperation = SocialUtils.like(username, post.getPostId(), context);
if (likeResultOperation)
logger.info("Added like OK to postId " + post.getPostId());
logger.debug("Added like OK to postId " + post.getPostId());
else {
logger.error("Unable to like this post"+ post.getPostId());
responseBean.setMessage("Unable to like, something went wrong please see server log");
@ -152,7 +152,7 @@ public class Likes {
Status status = Status.OK;
boolean likeResultOperation = SocialUtils.unlike(username, likeInputBean.getLikeid(), likeInputBean.getPostid());
if (likeResultOperation)
logger.info("Unlike OK to postId " + likeInputBean.getPostid());
logger.debug("Unlike OK to postId " + likeInputBean.getPostid());
else {
logger.error("Unable to unlike this post"+ likeInputBean.getPostid());
responseBean.setMessage("Unable to unlike, something went wrong please see server log");

View File

@ -122,7 +122,7 @@ public class Messages {
String body = input.getBody();
String subject = input.getSubject();
List<Recipient> recipientsIds = input.getRecipients(); // "recipients":[{"recipient":"id recipient"}, ......]
logger.info("Sender is going to be [" + fullName + "]");
logger.debug("Sender is going to be [" + fullName + "]");
// get the recipients ids (simple check, trim)
List<String> recipientsListFiltered = new ArrayList<String>();
@ -195,7 +195,7 @@ public class Messages {
ResponseBean responseBean = new ResponseBean();
Status status = Status.OK;
logger.info("Request for retrieving sent messages by " + username);
logger.debug("Request for retrieving sent messages by " + username);
try{
MessageManagerClient client = AbstractPlugin.messages().build();
@ -231,7 +231,7 @@ public class Messages {
ResponseBean responseBean = new ResponseBean();
Status status = Status.OK;
logger.info("Request for retrieving received messages by " + username);
logger.debug("Request for retrieving received messages by " + username);
try{
MessageManagerClient client = AbstractPlugin.messages().build();
List<Message> getMessages =client.getReceivedMessages();
@ -277,7 +277,7 @@ public class Messages {
MessageManagerClient client = AbstractPlugin.messages().build();
client.setRead(messageId, read);
String toReturn = "set Message id:" + messageId + (read ? " read" : " unread");
logger.info("set Message id:" + messageId + " read?" + read + " for " + opExecutor);
logger.debug("set Message id:" + messageId + " read?" + read + " for " + opExecutor);
responseBean.setSuccess(true);
responseBean.setResult(toReturn);

View File

@ -292,7 +292,7 @@ public class Notifications {
Status status = Status.OK;
String appQualifier = caller.getClient().getId();
logger.info("Received request from app " + appQualifier + " to notify job status described by bean " + job);
logger.debug("Received request from app " + appQualifier + " to notify job status described by bean " + job);
try{
@ -370,9 +370,11 @@ public class Notifications {
Status status = Status.OK;
boolean deliveryResult = false;
try {
logger.debug("catalogue notifications type is " + event.getType());
//logger.debug("catalogue notifications type is " + event.getType());
SocialNetworkingSite site = SocialNetworkingSiteFinder.getSocialNetworkingSiteFromScope(context);
//logger.debug("social networking site is " + site.getName());
//logger.debug("context is " + context);
//logger.debug("user is " + user.getUsername());
NotificationsManager nm = new ApplicationNotificationsManager(UserManagerWSBuilder.getInstance().getUserManager(), site, context, user);
@ -392,7 +394,12 @@ public class Notifications {
responseBean.setMessage("Username not found, got: " + userIdToNotify);
return Response.status(status).entity(responseBean).build();
}
//logger.debug("username2notify " + username2Notify);
//logger.debug("type is " + CatalogueEventTypeMapper.getType(event.getType()));
//logger.debug("item id is " + event.getItemId());
//logger.debug("item text is " + event.getNotifyText());
//logger.debug("item url is " + event.getItemURL());
deliveryResult =
nm.notifyCatalogueEvent(
CatalogueEventTypeMapper.getType(event.getType()),

View File

@ -83,7 +83,7 @@ public class Posts {
List<Post> posts = null;
try{
logger.info("Retrieving post for user id " + username + " and reference time " + timeInMillis);
logger.debug("Retrieving post for user id " + username + " and reference time " + timeInMillis);
posts = CassandraConnection.getInstance().getDatabookStore().getRecentPostsByUserAndDate(username, timeInMillis);
Filters.filterPostsPerContext(posts, context);
Filters.hideSensitiveInformation(posts, caller.getClient().getId());
@ -277,9 +277,9 @@ public class Posts {
// convert enablenotification parameter
if(enableNotification)
logger.info("Enable notification for this user post.");
logger.debug("Enable notification for this user post.");
else
logger.info("Disable notification for this user post.");
logger.debug("Disable notification for this user post.");
// try to share
@ -544,7 +544,7 @@ public class Posts {
String context = ScopeProvider.instance.get();
ResponseBean responseBean = new ResponseBean();
Status status = Status.OK;
logger.info("User " + username + " has requested posts containing hashtag " + hashtag + " in context " + context);
logger.debug("User " + username + " has requested posts containing hashtag " + hashtag + " in context " + context);
try{
DatabookStore datastore = CassandraConnection.getInstance().getDatabookStore();
List<Post> posts = datastore.getVREPostsByHashtag(context, hashtag);
@ -656,9 +656,9 @@ public class Posts {
Status status = Status.OK;
try{
Post post = postWithAttachment.getPost();
logger.info("Post is " + post);
logger.debug("Post is " + post);
List<Attachment> attachments = postWithAttachment.getAttachments();
logger.info("Attachments are " + attachments);
logger.debug("Attachments are " + attachments);
boolean result = CassandraConnection.getInstance().getDatabookStore().saveUserPost(post,attachments);
responseBean.setResult(result);
responseBean.setMessage("");

View File

@ -70,7 +70,7 @@ public class Tokens {
status = Status.FORBIDDEN;
return Response.status(status).entity(responseBean).build();
}
logger.info("Generating token for the application with id " + appId);
logger.debug("Generating token for the application with id " + appId);
// each token is related to an identifier and the context
String appToken = authorizationService().generateExternalServiceToken(appId);
responseBean.setSuccess(true);

View File

@ -141,7 +141,7 @@ public class Users {
GCubeUser user = userManager.getUserByUsername(username);
fullName = user.getFullname();
logger.info("Found fullname " + fullName + " for user " + username);
logger.debug("Found fullname " + fullName + " for user " + username);
responseBean.setResult(fullName);
responseBean.setSuccess(true);
@ -182,7 +182,7 @@ public class Users {
UserManager userManager = UserManagerWSBuilder.getInstance().getUserManager();
GCubeUser user = userManager.getUserByUsername(username);
email = user.getEmail();
logger.info("Found email " + email + " for user " + username);
logger.debug("Found email " + email + " for user " + username);
responseBean.setResult(email);
responseBean.setSuccess(true);
@ -532,7 +532,7 @@ public class Users {
}
private static List<UserRepresentation> searchByRole(Keycloak keycloak, String realmName, String context, String roleName) {
logger.info("Searching by role: {}", roleName);
logger.debug("Searching by role: {}", roleName);
String clientIdContext = context.replace("/", "%2F") ;
@ -541,8 +541,8 @@ public class Users {
String id = "";
for (ClientRepresentation client : clients) {
logger.info("found client ="+client.getClientId());
logger.info("found client id="+client.getId());
logger.debug("found client ="+client.getClientId());
logger.debug("found client id="+client.getId());
id =client.getId();
}

View File

@ -22,9 +22,9 @@ public class CassandraConnection {
private CassandraConnection(){
ApplicationContext ctx = ContextProvider.get(); // get this info from SmartGears
logger.info("Getting connection to cassandra");
logger.debug("Getting connection to cassandra");
store = new DBCassandraAstyanaxImpl(ctx.container().configuration().infrastructure());
logger.info("Connection to cassandra created");
logger.debug("Connection to cassandra created");
}
/**

View File

@ -24,9 +24,9 @@ public class ElasticSearchConnection {
private ElasticSearchConnection(){
try {
ApplicationContext ctx = ContextProvider.get(); // get this info from SmartGears
logger.info("Creating connection to Elasticsearch");
logger.debug("Creating connection to Elasticsearch");
es = new ElasticSearchClientImpl(ctx.container().configuration().infrastructure());
logger.info("Elasticsearch connection created");
logger.debug("Elasticsearch connection created");
} catch (Exception e) {
logger.error("Failed to connect to elasticsearch", e);
}

View File

@ -135,7 +135,7 @@ public class SocialUtils {
SocialNetworkingSite site = SocialNetworkingSiteFinder.getSocialNetworkingSiteFromScope(ScopeProvider.instance.get());
escapedPostText = Utils.convertMentionUsernamesAnchorHTML(escapedPostText, mentionedUsersToConvertInHTML, site.getSiteURL(), site.getSiteLandingPagePath());
logger.info("*** Escaped post text is " + escapedPostText);
logger.debug("*** Escaped post text is " + escapedPostText);
String scope = ScopeProvider.instance.get();
String appId = caller.getClient().getId();
@ -154,7 +154,7 @@ public class SocialUtils {
boolean res = CassandraConnection.getInstance().getDatabookStore().saveAppPost(toWrite);
if(res){
logger.info("Feed correctly written by application " + appId);
logger.debug("Feed correctly written by application " + appId);
// wait a bit before saving hashtags
if(hashtags != null && !hashtags.isEmpty())
@ -439,7 +439,7 @@ public class SocialUtils {
Post toShare = new Post(UUID.randomUUID().toString(), PostType.PUBLISH, userId, new Date(),
vreId, url, urlThumbnail, textToPost, PrivacyLevel.SINGLE_VRE, fullName, email, thumbnailURL, linkTitle, linkDesc, host);
logger.info("Attempting to save Post with text: " + textToPost + " Level = " + PrivacyLevel.SINGLE_VRE + " Timeline = " + vreId);
logger.debug("Attempting to save Post with text: " + textToPost + " Level = " + PrivacyLevel.SINGLE_VRE + " Timeline = " + vreId);
boolean result = CassandraConnection.getInstance().getDatabookStore().saveUserPost(toShare);
@ -450,7 +450,7 @@ public class SocialUtils {
try {
try{
logger.info("Sleeping waiting for cassandra's update");
logger.debug("Sleeping waiting for cassandra's update");
Thread.sleep(1000);
}catch(Exception e){
@ -547,10 +547,10 @@ public class SocialUtils {
String thumbnailURL = user.getUserAvatarURL();
Comment theComment = new Comment(commentKey, userid, time, postId, escapedCommentText, fullName, thumbnailURL);
logger.info("Attempting to save Comment with text: " + commentText + " postid="+postId);
logger.debug("Attempting to save Comment with text: " + commentText + " postid="+postId);
boolean result = CassandraConnection.getInstance().getDatabookStore().addComment(theComment);
logger.info("Added comment? " + theComment.toString() + " Result is " +result);
logger.debug("Added comment? " + theComment.toString() + " Result is " +result);
if (!result)
return null;
@ -561,10 +561,10 @@ public class SocialUtils {
NotificationsManager nm = new ApplicationNotificationsManager(uManager, site, context, socialUser, NEWS_FEED_PORTLET_CLASSNAME);
//if the user who commented this post is not the user who posted it notify the poster user (Post owner)
logger.info("The post creator is " + postOwnerId);
logger.debug("The post creator is " + postOwnerId);
if (! user.getUsername().equals(postOwnerId)) {
boolean resultNotifyOwnComment = nm.notifyOwnCommentReply(postOwnerId, postId, escapedCommentText, theComment.getKey());
logger.info("Comment Notification to post creator added? " + resultNotifyOwnComment);
logger.debug("Comment Notification to post creator added? " + resultNotifyOwnComment);
}
//if there are users who liked this post they get notified, asynchronously with this thread
ArrayList<Like> likes = getAllLikesByPost(postId);
@ -669,7 +669,7 @@ public class SocialUtils {
new Date(), postid, user.getFullname(), user.getUserAvatarURL());
Post thePost = null;
try {
logger.info("Attempting to read post with id: " +postid);
logger.debug("Attempting to read post with id: " +postid);
thePost = CassandraConnection.getInstance().getDatabookStore().readPost(postid);
likeCommitResult = CassandraConnection.getInstance().getDatabookStore().like(toLike);
} catch (Exception e) {
@ -689,10 +689,10 @@ public class SocialUtils {
String escapedPostText = messageParser.getParsedMessage();
//if the user who liked this post is not the user who posted it notify the poster user (Post owner)
logger.info("The post creator is " + postOwnerId);
logger.debug("The post creator is " + postOwnerId);
if (! user.getUsername().equals(postOwnerId)) {
resultNotifyLike = nm.notifyLikedPost(postOwnerId, postid, escapedPostText);
logger.info("Like Notification to post creator added? " + resultNotifyLike);
logger.debug("Like Notification to post creator added? " + resultNotifyLike);
}
}
return likeCommitResult && resultNotifyLike;