From e0cc7d99184583802b766bece4bd740c26f68886 Mon Sep 17 00:00:00 2001
From: alaskowski <alaskowski@ethz.ch>
Date: Thu, 20 Jul 2023 16:18:34 +0200
Subject: [PATCH] SSDM-55: more debug logs

---
 .../property/UpdateEntityPropertyExecutor.java    | 15 ---------------
 .../dataaccess/EntityPropertiesConverter.java     | 10 +++++++++-
 2 files changed, 9 insertions(+), 16 deletions(-)

diff --git a/server-application-server/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/property/UpdateEntityPropertyExecutor.java b/server-application-server/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/property/UpdateEntityPropertyExecutor.java
index 4aa72fdd478..8f0ca454644 100644
--- a/server-application-server/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/property/UpdateEntityPropertyExecutor.java
+++ b/server-application-server/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/property/UpdateEntityPropertyExecutor.java
@@ -20,9 +20,6 @@ import java.util.*;
 import java.util.Map.Entry;
 import java.util.stream.Collectors;
 
-import ch.systemsx.cisd.common.logging.LogCategory;
-import ch.systemsx.cisd.common.logging.LogFactory;
-import org.apache.log4j.Logger;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
@@ -66,8 +63,6 @@ import ch.systemsx.cisd.openbis.generic.shared.util.EntityHelper;
 public class UpdateEntityPropertyExecutor implements IUpdateEntityPropertyExecutor
 {
 
-    private static final Logger operationLog = LogFactory.getLogger(LogCategory.OPERATION,
-            UpdateEntityPropertyExecutor.class);
 
     @Autowired
     private IDAOFactory daoFactory;
@@ -133,7 +128,6 @@ public class UpdateEntityPropertyExecutor implements IUpdateEntityPropertyExecut
                                     entityInformationProvider, managedPropertyEvaluatorFactory);
                     converters.put(entityKind, converter);
                 }
-                operationLog.info(String.format("||> UPDATING PROPERTIES OF SAMPLE:%s", propertiesHolder.toString()));
                 update(context, propertiesHolder, properties, converters.get(entityKind));
             }
 
@@ -464,15 +458,11 @@ public class UpdateEntityPropertyExecutor implements IUpdateEntityPropertyExecut
             Map<String, Serializable> properties,
             EntityPropertiesConverter converter)
     {
-        operationLog.info("||> properties:");
-        properties.forEach((key, value) -> operationLog.info("||> " +key + ":" + value));
         List<IEntityProperty> entityProperties = new LinkedList<IEntityProperty>();
         for (Map.Entry<String, Serializable> entry : properties.entrySet())
         {
             entityProperties.add(EntityHelper.createNewProperty(entry.getKey(), entry.getValue()));
         }
-        operationLog.info("||> entityProperties:");
-        entityProperties.forEach(ent -> operationLog.info(ent));
         Set<? extends EntityPropertyPE> existingProperties = propertiesHolder.getProperties();
         Map<String, List<Object>> existingPropertyValuesByCode =
                 new HashMap<String, List<Object>>();
@@ -483,16 +473,11 @@ public class UpdateEntityPropertyExecutor implements IUpdateEntityPropertyExecut
             existingPropertyValuesByCode.computeIfAbsent(propertyCode, s -> new ArrayList<>());
             existingPropertyValuesByCode.get(propertyCode).add(getValue(existingProperty));
         }
-        operationLog.info("||> existingPropertyValuesByCode:");
-        existingPropertyValuesByCode.forEach((key, value) -> operationLog.info("||> " +key + ":" + value));
         Set<? extends EntityPropertyPE> convertedProperties =
                 convertProperties(context, propertiesHolder.getEntityType(), existingProperties,
                         entityProperties, converter);
-        operationLog.info("||> convertedProperties:");
-        convertedProperties.forEach(ent -> operationLog.info(ent));
         if (isEqualsMultiple(existingPropertyValuesByCode, convertedProperties) == false)
         {
-            operationLog.info("||> isEqualsMultiple == false");
             propertiesHolder.setProperties(convertedProperties);
         }
     }
diff --git a/server-application-server/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/EntityPropertiesConverter.java b/server-application-server/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/EntityPropertiesConverter.java
index 7410fbb6955..cc590dd6604 100644
--- a/server-application-server/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/EntityPropertiesConverter.java
+++ b/server-application-server/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/EntityPropertiesConverter.java
@@ -344,6 +344,7 @@ public final class EntityPropertiesConverter implements IEntityPropertiesConvert
             final PersonPE registrator)
     {
         operationLog.info("||> convertProperties" + Arrays.toString(properties));
+        System.out.println("|||> convertProperties" + Arrays.toString(properties));
         return convertProperties(properties, entityTypeCode, registrator, true, true);
     }
 
@@ -381,7 +382,8 @@ public final class EntityPropertiesConverter implements IEntityPropertiesConvert
             }
         }
         operationLog.info("||> convertProperties POST");
-        list.forEach(l -> operationLog.info(l));
+        list.forEach(l -> operationLog.info("||> "+l));
+        list.forEach(l -> System.out.println("|||> "+l));
         return list;
     }
 
@@ -661,6 +663,12 @@ public final class EntityPropertiesConverter implements IEntityPropertiesConvert
             EntityTypePE entityType, List<IEntityProperty> newProperties, PersonPE author,
             Set<String> propertiesToUpdate)
     {
+        operationLog.info("||> updateProperties " + entityType + " " + entityType + " ");
+        propertiesToUpdate.forEach(l -> operationLog.info("||> "+l));
+        newProperties.forEach(l -> operationLog.info("||> "+l));
+
+        propertiesToUpdate.forEach(l -> System.out.println("|||> "+l));
+        newProperties.forEach(l -> System.out.println("|||> "+l));
         // all new properties should be among propertiesToUpdate (no need to check it)
         final Set<T> set = updateProperties(oldProperties, entityType, newProperties, author);
         // add old properties that are not among propertiesToUpdate (preserve those properties)
-- 
GitLab