removed noisy logs
This commit is contained in:
parent
8509015a18
commit
572c7b8199
|
@ -4,9 +4,10 @@
|
||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
## [v2.0.1] - 2023-12-04
|
## [v2.0.1-SNAPSHOT] - 2024-04-22
|
||||||
|
|
||||||
- Bug 27218 - Null pointer exception getting notifications preferences fixed
|
- Bug 27218 - Null pointer exception getting notifications preferences fixed
|
||||||
|
- Feature 27286 - Removed noisy logs
|
||||||
|
|
||||||
## [v2.0.0] - 2023-12-04
|
## [v2.0.0] - 2023-12-04
|
||||||
|
|
||||||
|
|
2
pom.xml
2
pom.xml
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
<groupId>org.gcube.portal</groupId>
|
<groupId>org.gcube.portal</groupId>
|
||||||
<artifactId>social-networking-library</artifactId>
|
<artifactId>social-networking-library</artifactId>
|
||||||
<version>2.0.1</version>
|
<version>2.0.1-SNAPSHOT</version>
|
||||||
<name>gCube Social Networking Library</name>
|
<name>gCube Social Networking Library</name>
|
||||||
<description>
|
<description>
|
||||||
The gCube Social Networking Library is the 'bridge' between your gCube Applications and the social networking facilities.
|
The gCube Social Networking Library is the 'bridge' between your gCube Applications and the social networking facilities.
|
||||||
|
|
|
@ -748,7 +748,7 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
|
|
||||||
Boolean result = session.execute(writeBatch).wasApplied();
|
Boolean result = session.execute(writeBatch).wasApplied();
|
||||||
if (result){
|
if (result){
|
||||||
_log.info("Wrote user post with id " + post.getKey());
|
_log.debug("Wrote user post with id " + post.getKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -796,7 +796,7 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
|
|
||||||
Boolean result = session.execute(writeBatch).wasApplied();
|
Boolean result = session.execute(writeBatch).wasApplied();
|
||||||
if (result){
|
if (result){
|
||||||
_log.info("Wrote user post with id " + post.getKey());
|
_log.debug("Wrote user post with id " + post.getKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -831,7 +831,7 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
post.setMultiFileUpload(true);
|
post.setMultiFileUpload(true);
|
||||||
boolean savePostResult = saveUserPost(post);
|
boolean savePostResult = saveUserPost(post);
|
||||||
if (savePostResult) {
|
if (savePostResult) {
|
||||||
_log.info("Post has been saved");
|
_log.debug("Post has been saved");
|
||||||
String postkey = post.getKey();
|
String postkey = post.getKey();
|
||||||
for (Attachment attachment : attachments) {
|
for (Attachment attachment : attachments) {
|
||||||
boolean attachSaveResult = saveAttachmentEntry(postkey, attachment);
|
boolean attachSaveResult = saveAttachmentEntry(postkey, attachment);
|
||||||
|
@ -888,7 +888,7 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
|
|
||||||
boolean result = session.execute(writeBatch).wasApplied();
|
boolean result = session.execute(writeBatch).wasApplied();
|
||||||
if (result)
|
if (result)
|
||||||
_log.info("Wrote app post with id " + post.getKey());
|
_log.debug("Wrote app post with id " + post.getKey());
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -936,7 +936,7 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
|
|
||||||
boolean result = session.execute(writeBatch).wasApplied();
|
boolean result = session.execute(writeBatch).wasApplied();
|
||||||
if (result)
|
if (result)
|
||||||
_log.info("Wrote app post with id " + post.getKey());
|
_log.debug("Wrote app post with id " + post.getKey());
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -1169,7 +1169,7 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
_log.info("Delete Post OK");
|
_log.debug("Delete Post OK");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -1189,7 +1189,7 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
_log.info("Delete Post OK");
|
_log.debug("Delete Post OK");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -2188,24 +2188,24 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<NotificationChannelType> getUserNotificationChannels(String userid, NotificationType notificationType) throws NotificationChannelTypeNotFoundException, NotificationTypeNotFoundException {
|
public List<NotificationChannelType> getUserNotificationChannels(String userid, NotificationType notificationType) throws NotificationChannelTypeNotFoundException, NotificationTypeNotFoundException {
|
||||||
_log.info("Asking for Single Notification preference of " + userid + " Type: " + notificationType);
|
_log.debug("Asking for Single Notification preference of " + userid + " Type: " + notificationType);
|
||||||
List<NotificationChannelType> toReturn = new ArrayList<NotificationChannelType>();
|
List<NotificationChannelType> toReturn = new ArrayList<NotificationChannelType>();
|
||||||
Map<NotificationType, NotificationChannelType[]> userNotPref = getUserNotificationPreferences(userid);
|
Map<NotificationType, NotificationChannelType[]> userNotPref = getUserNotificationPreferences(userid);
|
||||||
if(userNotPref!=null){
|
if(userNotPref!=null){
|
||||||
if(userNotPref.containsKey(notificationType)){
|
if(userNotPref.containsKey(notificationType)){
|
||||||
NotificationChannelType[] toProcess = userNotPref.get(notificationType);
|
NotificationChannelType[] toProcess = userNotPref.get(notificationType);
|
||||||
//_log.info("size of user notification preferences" + toProcess.length);
|
//_log.debug("size of user notification preferences" + toProcess.length);
|
||||||
if (toProcess == null) {
|
if (toProcess == null) {
|
||||||
_log.info("Single Notification preference of " + userid + " Type: " + notificationType + " not existing ... creating default");
|
_log.debug("Single Notification preference of " + userid + " Type: " + notificationType + " not existing ... creating default");
|
||||||
return createNewNotificationType(userid, notificationType);
|
return createNewNotificationType(userid, notificationType);
|
||||||
}
|
}
|
||||||
else if (toProcess.length == 0){
|
else if (toProcess.length == 0){
|
||||||
_log.info("size of user notification preferences " + 0);
|
_log.debug("size of user notification preferences " + 0);
|
||||||
return toReturn;
|
return toReturn;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_log.info("size of user notification preferences " + toProcess.length);
|
_log.debug("size of user notification preferences " + toProcess.length);
|
||||||
for (int i = 0; i < toProcess.length; i++) {
|
for (int i = 0; i < toProcess.length; i++) {
|
||||||
toReturn.add(toProcess[i]);
|
toReturn.add(toProcess[i]);
|
||||||
}
|
}
|
||||||
|
@ -2223,7 +2223,7 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
*/
|
*/
|
||||||
private List<NotificationChannelType> createNewNotificationType(String userid, NotificationType notificationType) {
|
private List<NotificationChannelType> createNewNotificationType(String userid, NotificationType notificationType) {
|
||||||
List<NotificationChannelType> toReturn = new ArrayList<NotificationChannelType>();
|
List<NotificationChannelType> toReturn = new ArrayList<NotificationChannelType>();
|
||||||
_log.info("Create new notification type");
|
_log.debug("Create new notification type");
|
||||||
CqlSession session = conn.getKeyspaceSession();
|
CqlSession session = conn.getKeyspaceSession();
|
||||||
|
|
||||||
String valueToInsert = "";
|
String valueToInsert = "";
|
||||||
|
@ -2249,11 +2249,11 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
_log.info("Set New Notification Setting for " + userid + " OK");
|
_log.debug("Set New Notification Setting for " + userid + " OK");
|
||||||
_log.info("toreturn:" + toReturn.toString());
|
_log.debug("toreturn:" + toReturn.toString());
|
||||||
return toReturn;
|
return toReturn;
|
||||||
}
|
}
|
||||||
_log.info("empty list");
|
_log.debug("empty list");
|
||||||
return new ArrayList<NotificationChannelType>(); //no notification if sth fails
|
return new ArrayList<NotificationChannelType>(); //no notification if sth fails
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -2266,10 +2266,10 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
|
|
||||||
for (NotificationType nType : enabledChannels.keySet()) {
|
for (NotificationType nType : enabledChannels.keySet()) {
|
||||||
String valueToInsert = "";
|
String valueToInsert = "";
|
||||||
_log.info("Type: " + nType.toString());
|
_log.debug("Type: " + nType.toString());
|
||||||
int channelsNo = (enabledChannels.get(nType) != null) ? enabledChannels.get(nType).length : 0;
|
int channelsNo = (enabledChannels.get(nType) != null) ? enabledChannels.get(nType).length : 0;
|
||||||
for (int i = 0; i < channelsNo; i++) {
|
for (int i = 0; i < channelsNo; i++) {
|
||||||
_log.info(enabledChannels.get(nType)[i].toString());
|
_log.debug(enabledChannels.get(nType)[i].toString());
|
||||||
valueToInsert += NotificationChannelType.valueOf(enabledChannels.get(nType)[i].toString());
|
valueToInsert += NotificationChannelType.valueOf(enabledChannels.get(nType)[i].toString());
|
||||||
if (i < channelsNo-1)
|
if (i < channelsNo-1)
|
||||||
valueToInsert += ",";
|
valueToInsert += ",";
|
||||||
|
@ -2285,9 +2285,9 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
BatchStatement writeBatch = getBatch().addAll(boundStatements);
|
BatchStatement writeBatch = getBatch().addAll(boundStatements);
|
||||||
boolean overAllresult = session.execute(writeBatch).wasApplied();
|
boolean overAllresult = session.execute(writeBatch).wasApplied();
|
||||||
if (overAllresult)
|
if (overAllresult)
|
||||||
_log.info("Set Notification Map for " + userid + " OK");
|
_log.debug("Set Notification Map for " + userid + " OK");
|
||||||
else
|
else
|
||||||
_log.info("Set Notification Map for " + userid + " FAILED");
|
_log.debug("Set Notification Map for " + userid + " FAILED");
|
||||||
return overAllresult;
|
return overAllresult;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -2297,7 +2297,7 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Map<NotificationType, NotificationChannelType[]> getUserNotificationPreferences(String userid) throws NotificationTypeNotFoundException, NotificationChannelTypeNotFoundException {
|
public Map<NotificationType, NotificationChannelType[]> getUserNotificationPreferences(String userid) throws NotificationTypeNotFoundException, NotificationChannelTypeNotFoundException {
|
||||||
_log.info("Asking for Notification preferences of " + userid);
|
_log.debug("Asking for Notification preferences of " + userid);
|
||||||
Map<NotificationType, NotificationChannelType[]> toReturn = new HashMap<NotificationType, NotificationChannelType[]>();
|
Map<NotificationType, NotificationChannelType[]> toReturn = new HashMap<NotificationType, NotificationChannelType[]>();
|
||||||
|
|
||||||
ResultSet result = null;
|
ResultSet result = null;
|
||||||
|
@ -2318,9 +2318,9 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
//if there are no settings for this user create an entry and put all of them at true
|
//if there are no settings for this user create an entry and put all of them at true
|
||||||
List<Row> results = new ArrayList<>();
|
List<Row> results = new ArrayList<>();
|
||||||
if(result!=null) results = result.all();
|
if(result!=null) results = result.all();
|
||||||
//_log.info("Result set empty? " + results.isEmpty());
|
//_log.debug("Result set empty? " + results.isEmpty());
|
||||||
if (results.isEmpty()) {
|
if (results.isEmpty()) {
|
||||||
_log.info("Userid " + userid + " settings not found, initiating its preferences...");
|
_log.debug("Userid " + userid + " settings not found, initiating its preferences...");
|
||||||
HashMap<NotificationType, NotificationChannelType[]> toCreate = new HashMap<NotificationType, NotificationChannelType[]>();
|
HashMap<NotificationType, NotificationChannelType[]> toCreate = new HashMap<NotificationType, NotificationChannelType[]>();
|
||||||
|
|
||||||
for (int i = 0; i < NotificationType.values().length; i++) {
|
for (int i = 0; i < NotificationType.values().length; i++) {
|
||||||
|
@ -2338,12 +2338,12 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
return toCreate;
|
return toCreate;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
_log.info("Notification preferences Found for " + userid + " : " + results.size()) ;
|
_log.debug("Notification preferences Found for " + userid + " : " + results.size()) ;
|
||||||
for (Row row: results){
|
for (Row row: results){
|
||||||
String[] channels = row.getString(PREFERENCE).split(",");
|
String[] channels = row.getString(PREFERENCE).split(",");
|
||||||
//_log.info("Row : " + row.getString(PREFERENCE));
|
//_log.debug("Row : " + row.getString(PREFERENCE));
|
||||||
if (channels != null && channels.length == 1 && channels[0].toString().equals("") ) { //it is empty, preference is set to no notification at all
|
if (channels != null && channels.length == 1 && channels[0].toString().equals("") ) { //it is empty, preference is set to no notification at all
|
||||||
//_log.info("adding CHANNELS NULL: " + getNotificationType(row.getString(TYPE)) + ", " + new NotificationChannelType[0]);
|
//_log.debug("adding CHANNELS NULL: " + getNotificationType(row.getString(TYPE)) + ", " + new NotificationChannelType[0]);
|
||||||
toReturn.put(getNotificationType(row.getString(TYPE)), new NotificationChannelType[0]);
|
toReturn.put(getNotificationType(row.getString(TYPE)), new NotificationChannelType[0]);
|
||||||
} else {
|
} else {
|
||||||
NotificationChannelType[] toAdd = new NotificationChannelType[channels.length];
|
NotificationChannelType[] toAdd = new NotificationChannelType[channels.length];
|
||||||
|
@ -2352,12 +2352,12 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
toAdd[i] = (getChannelType(channels[i]));
|
toAdd[i] = (getChannelType(channels[i]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//_log.info("adding channels not null: " + getNotificationType(row.getString(TYPE)) + ", " + toAdd.toString());
|
//_log.debug("adding channels not null: " + getNotificationType(row.getString(TYPE)) + ", " + toAdd.toString());
|
||||||
toReturn.put(getNotificationType(row.getString(TYPE)), toAdd);
|
toReturn.put(getNotificationType(row.getString(TYPE)), toAdd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_log.info("Returning:"+toReturn.size());
|
_log.debug("Returning:"+toReturn.size());
|
||||||
return toReturn;
|
return toReturn;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
@ -2432,7 +2432,7 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
_log.info("Writing comment : {}", comment.toString());
|
_log.debug("Writing comment : {}", comment.toString());
|
||||||
CqlSession session = conn.getKeyspaceSession();
|
CqlSession session = conn.getKeyspaceSession();
|
||||||
|
|
||||||
List<BoundStatement> boundStatements = insertIntoComments(session, comment);
|
List<BoundStatement> boundStatements = insertIntoComments(session, comment);
|
||||||
|
@ -2443,10 +2443,10 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
try {
|
try {
|
||||||
ResultSet res = session.execute(writeBatch);
|
ResultSet res = session.execute(writeBatch);
|
||||||
for (ExecutionInfo ex: res.getExecutionInfos()){
|
for (ExecutionInfo ex: res.getExecutionInfos()){
|
||||||
_log.info("Writing comment result errors: {}", ex.getErrors());
|
_log.debug("Writing comment result errors: {}", ex.getErrors());
|
||||||
_log.info("Writing comment result payload: {}", ex.getIncomingPayload());
|
_log.debug("Writing comment result payload: {}", ex.getIncomingPayload());
|
||||||
}
|
}
|
||||||
_log.info("Writing comment result executed?: {}", res.wasApplied());
|
_log.debug("Writing comment result executed?: {}", res.wasApplied());
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -2605,7 +2605,7 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
try {
|
try {
|
||||||
boolean res = session.execute(writeBatch).wasApplied();
|
boolean res = session.execute(writeBatch).wasApplied();
|
||||||
|
|
||||||
_log.info("Comments update OK to: " + comment2Edit.getText());
|
_log.debug("Comments update OK to: " + comment2Edit.getText());
|
||||||
return res;
|
return res;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
||||||
|
@ -2706,7 +2706,7 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (isPostLiked(like.getUserid(), feedId)) {
|
if (isPostLiked(like.getUserid(), feedId)) {
|
||||||
_log.info("User " + like.getUserid() + " already liked Feed " + feedId);
|
_log.debug("User " + like.getUserid() + " already liked Feed " + feedId);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -3158,7 +3158,7 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
|
|
||||||
if(feeds.isEmpty()){
|
if(feeds.isEmpty()){
|
||||||
|
|
||||||
_log.info("There are no feeds containing hashtag " + row.getString(HASHTAG) + " in vre " + vreid);
|
_log.debug("There are no feeds containing hashtag " + row.getString(HASHTAG) + " in vre " + vreid);
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3639,8 +3639,8 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
BatchStatement writeBatch = getBatch().addAll(boundStatements);
|
BatchStatement writeBatch = getBatch().addAll(boundStatements);
|
||||||
//boundStatements.forEach(stmt->writeBatch.add(stmt));
|
//boundStatements.forEach(stmt->writeBatch.add(stmt));
|
||||||
ResultSet res = session.execute(writeBatch);
|
ResultSet res = session.execute(writeBatch);
|
||||||
_log.info(res.getExecutionInfos().toString());
|
_log.debug(res.getExecutionInfos().toString());
|
||||||
_log.info(""+res.wasApplied());
|
_log.debug(""+res.wasApplied());
|
||||||
/*
|
/*
|
||||||
session.execute(createNewaAttachEntry(session).bind(
|
session.execute(createNewaAttachEntry(session).bind(
|
||||||
UUID.fromString(toSave.getId()),
|
UUID.fromString(toSave.getId()),
|
||||||
|
@ -3952,7 +3952,7 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
_log.info("CommentsNo update OK to: " + newCount);
|
_log.debug("CommentsNo update OK to: " + newCount);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3981,7 +3981,7 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
_log.info("LikesNo update OK to: " + newCount);
|
_log.debug("LikesNo update OK to: " + newCount);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue