removed logs

This commit is contained in:
Ahmed Salah Tawfik Ibrahim 2024-04-22 11:19:17 +02:00
parent 8509f8cc91
commit 88d35fce91
16 changed files with 66 additions and 66 deletions

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

@ -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{
@ -349,7 +349,7 @@ public class Notifications {
// check if the token belongs to an application token. In this case use J.A.R.V.I.S (the username used to communicate with Liferay)
String username = null;
String fullName = "";
logger.info("Catalogue Notification called by " + caller.getClient().getId() + " isUser?"+TokensUtils.isUserToken(caller));
logger.debug("Catalogue Notification called by " + caller.getClient().getId() + " isUser?"+TokensUtils.isUserToken(caller));
if(!TokensUtils.isUserToken(caller)){
GCubeUser jarvis = UserManagerWSBuilder.getInstance().getUserManager().getUserByEmail(LiferayJSONWsCredentials.getSingleton().getUser());
SecurityTokenProvider.instance.set(LiferayJSONWsCredentials.getSingleton().getNotifierUserToken());
@ -365,16 +365,16 @@ public class Notifications {
String context = ScopeProvider.instance.get();
logger.info("catalogue notifications from user = " + username);
logger.debug("catalogue notifications from user = " + username);
ResponseBean responseBean = new ResponseBean();
Status status = Status.OK;
boolean deliveryResult = false;
try {
//logger.info("catalogue notifications type is " + event.getType());
//logger.debug("catalogue notifications type is " + event.getType());
SocialNetworkingSite site = SocialNetworkingSiteFinder.getSocialNetworkingSiteFromScope(context);
//logger.info("social networking site is " + site.getName());
//logger.info("context is " + context);
//logger.info("user is " + user.getUsername());
//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);
@ -394,11 +394,11 @@ public class Notifications {
responseBean.setMessage("Username not found, got: " + userIdToNotify);
return Response.status(status).entity(responseBean).build();
}
//logger.info("username2notify " + username2Notify);
//logger.info("type is " + CatalogueEventTypeMapper.getType(event.getType()));
//logger.info("item id is " + event.getItemId());
//logger.info("item text is " + event.getNotifyText());
//logger.info("item url is " + event.getItemURL());
//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(

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;