syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ilgro...@apache.org
Subject [3/5] syncope git commit: Moving the default toString() style to ToStringStyle.JSON_STYLE
Date Fri, 15 Sep 2017 10:36:26 GMT
Moving the default toString() style to ToStringStyle.JSON_STYLE


Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/86fc76eb
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/86fc76eb
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/86fc76eb

Branch: refs/heads/2_0_X
Commit: 86fc76eb9a390608954abc6e35953b3d2b978bfa
Parents: 7bb15ac
Author: Francesco Chicchiriccò <ilgrosso@apache.org>
Authored: Fri Sep 15 12:31:13 2017 +0200
Committer: Francesco Chicchiriccò <ilgrosso@apache.org>
Committed: Fri Sep 15 12:31:13 2017 +0200

----------------------------------------------------------------------
 .../console/commons/status/StatusBean.java      |  2 +-
 .../console/panels/search/SearchClause.java     |  2 +-
 .../syncope/common/lib/AbstractBaseBean.java    |  2 +-
 .../apache/syncope/common/lib/to/UserTO.java    | 16 ++--------------
 .../rest/api/beans/ConnObjectTOListQuery.java   |  2 +-
 .../api/dao/search/AbstractSearchCond.java      |  2 +-
 .../api/dao/search/OrderByClause.java           |  2 +-
 .../jpa/entity/AbstractPlainAttrValue.java      | 20 ++++++++++----------
 .../core/provisioning/api/IntAttrName.java      |  2 +-
 .../core/provisioning/api/WorkflowResult.java   |  2 +-
 .../provisioning/api/cache/VirAttrCacheKey.java |  2 +-
 .../java/job/report/AuditReportlet.java         |  6 +++---
 .../security/SyncopeAuthenticationDetails.java  |  2 +-
 .../security/SyncopeGrantedAuthority.java       |  2 +-
 14 files changed, 26 insertions(+), 38 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/86fc76eb/client/console/src/main/java/org/apache/syncope/client/console/commons/status/StatusBean.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/commons/status/StatusBean.java
b/client/console/src/main/java/org/apache/syncope/client/console/commons/status/StatusBean.java
index c8bba79..fe7ce9f 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/commons/status/StatusBean.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/commons/status/StatusBean.java
@@ -96,7 +96,7 @@ public class StatusBean implements Serializable {
 
     @Override
     public String toString() {
-        return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE);
+        return ReflectionToStringBuilder.toString(this, ToStringStyle.JSON_STYLE);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/syncope/blob/86fc76eb/client/console/src/main/java/org/apache/syncope/client/console/panels/search/SearchClause.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/search/SearchClause.java
b/client/console/src/main/java/org/apache/syncope/client/console/panels/search/SearchClause.java
index 9007485..415abba 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/search/SearchClause.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/search/SearchClause.java
@@ -126,6 +126,6 @@ public final class SearchClause implements Serializable {
 
     @Override
     public String toString() {
-        return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE);
+        return ReflectionToStringBuilder.toString(this, ToStringStyle.JSON_STYLE);
     }
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/86fc76eb/common/lib/src/main/java/org/apache/syncope/common/lib/AbstractBaseBean.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/AbstractBaseBean.java
b/common/lib/src/main/java/org/apache/syncope/common/lib/AbstractBaseBean.java
index bd8b06e..0187d70 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/AbstractBaseBean.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/AbstractBaseBean.java
@@ -49,6 +49,6 @@ public abstract class AbstractBaseBean implements Serializable {
 
     @Override
     public String toString() {
-        return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE);
+        return ReflectionToStringBuilder.toString(this, ToStringStyle.JSON_STYLE);
     }
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/86fc76eb/common/lib/src/main/java/org/apache/syncope/common/lib/to/UserTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/UserTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/UserTO.java
index 6deab32..8acca6f 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/UserTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/UserTO.java
@@ -20,7 +20,6 @@ package org.apache.syncope.common.lib.to;
 
 import com.fasterxml.jackson.annotation.JsonIgnore;
 import com.fasterxml.jackson.annotation.JsonProperty;
-import java.lang.reflect.Field;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
@@ -30,8 +29,7 @@ import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlType;
 import org.apache.commons.collections4.IterableUtils;
 import org.apache.commons.collections4.Predicate;
-import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
+import org.apache.commons.lang3.builder.ToStringExclude;
 import org.apache.syncope.common.lib.types.AnyTypeKind;
 
 @XmlRootElement(name = "user")
@@ -40,6 +38,7 @@ public class UserTO extends AnyTO implements GroupableRelatableTO {
 
     private static final long serialVersionUID = 7791304495192615740L;
 
+    @ToStringExclude
     private String password;
 
     private final List<String> roles = new ArrayList<>();
@@ -242,15 +241,4 @@ public class UserTO extends AnyTO implements GroupableRelatableTO {
     public List<MembershipTO> getDynMemberships() {
         return dynMemberships;
     }
-
-    @Override
-    public String toString() {
-        return new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) {
-
-            @Override
-            protected boolean accept(final Field f) {
-                return super.accept(f) && !f.getName().equals("password");
-            }
-        }.toString();
-    }
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/86fc76eb/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/ConnObjectTOListQuery.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/ConnObjectTOListQuery.java
b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/ConnObjectTOListQuery.java
index 7ab27b0..8d354f5 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/ConnObjectTOListQuery.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/ConnObjectTOListQuery.java
@@ -112,6 +112,6 @@ public class ConnObjectTOListQuery implements Serializable {
 
     @Override
     public String toString() {
-        return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE);
+        return ReflectionToStringBuilder.toString(this, ToStringStyle.JSON_STYLE);
     }
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/86fc76eb/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/search/AbstractSearchCond.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/search/AbstractSearchCond.java
b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/search/AbstractSearchCond.java
index 2087bc7..d84083c 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/search/AbstractSearchCond.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/search/AbstractSearchCond.java
@@ -40,7 +40,7 @@ public abstract class AbstractSearchCond implements Serializable {
 
     @Override
     public String toString() {
-        return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE);
+        return ReflectionToStringBuilder.toString(this, ToStringStyle.JSON_STYLE);
     }
 
     public abstract boolean isValid();

http://git-wip-us.apache.org/repos/asf/syncope/blob/86fc76eb/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/search/OrderByClause.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/search/OrderByClause.java
b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/search/OrderByClause.java
index 8d4b978..5fa9e79 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/search/OrderByClause.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/search/OrderByClause.java
@@ -67,6 +67,6 @@ public class OrderByClause implements Serializable {
 
     @Override
     public String toString() {
-        return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE);
+        return ReflectionToStringBuilder.toString(this, ToStringStyle.JSON_STYLE);
     }
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/86fc76eb/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractPlainAttrValue.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractPlainAttrValue.java
b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractPlainAttrValue.java
index bac48c6..5a6df87 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractPlainAttrValue.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractPlainAttrValue.java
@@ -223,8 +223,8 @@ public abstract class AbstractPlainAttrValue extends AbstractGeneratedKeyEntity
     public String getValueAsString() {
         final AttrSchemaType type = getAttr() == null || getAttr().getSchema() == null
                 || getAttr().getSchema().getType() == null
-                        ? AttrSchemaType.String
-                        : getAttr().getSchema().getType();
+                ? AttrSchemaType.String
+                : getAttr().getSchema().getType();
 
         return getValueAsString(type);
     }
@@ -241,23 +241,23 @@ public abstract class AbstractPlainAttrValue extends AbstractGeneratedKeyEntity
             case Long:
                 result = getAttr() == null || getAttr().getSchema() == null
                         || getAttr().getSchema().getConversionPattern() == null
-                                ? getLongValue().toString()
-                                : FormatUtils.format(getLongValue(), getAttr().getSchema().getConversionPattern());
+                        ? getLongValue().toString()
+                        : FormatUtils.format(getLongValue(), getAttr().getSchema().getConversionPattern());
                 break;
 
             case Double:
                 result = getAttr() == null || getAttr().getSchema() == null
                         || getAttr().getSchema().getConversionPattern() == null
-                                ? getDoubleValue().toString()
-                                : FormatUtils.format(getDoubleValue(), getAttr().getSchema().getConversionPattern());
+                        ? getDoubleValue().toString()
+                        : FormatUtils.format(getDoubleValue(), getAttr().getSchema().getConversionPattern());
                 break;
 
             case Date:
                 result = getAttr() == null || getAttr().getSchema() == null
                         || getAttr().getSchema().getConversionPattern() == null
-                                ? FormatUtils.format(getDateValue())
-                                : FormatUtils.format(
-                                        getDateValue(), false, getAttr().getSchema().getConversionPattern());
+                        ? FormatUtils.format(getDateValue())
+                        : FormatUtils.format(
+                                getDateValue(), false, getAttr().getSchema().getConversionPattern());
                 break;
 
             case Binary:
@@ -277,6 +277,6 @@ public abstract class AbstractPlainAttrValue extends AbstractGeneratedKeyEntity
 
     @Override
     public String toString() {
-        return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE);
+        return ReflectionToStringBuilder.toString(this, ToStringStyle.JSON_STYLE);
     }
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/86fc76eb/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/IntAttrName.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/IntAttrName.java
b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/IntAttrName.java
index 1dfa654..f46384e 100644
--- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/IntAttrName.java
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/IntAttrName.java
@@ -97,7 +97,7 @@ public class IntAttrName {
 
     @Override
     public String toString() {
-        return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
+        return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/86fc76eb/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/WorkflowResult.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/WorkflowResult.java
b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/WorkflowResult.java
index c1902eb..472a108 100644
--- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/WorkflowResult.java
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/WorkflowResult.java
@@ -77,6 +77,6 @@ public class WorkflowResult<T> {
 
     @Override
     public String toString() {
-        return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE);
+        return ReflectionToStringBuilder.toString(this, ToStringStyle.JSON_STYLE);
     }
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/86fc76eb/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/cache/VirAttrCacheKey.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/cache/VirAttrCacheKey.java
b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/cache/VirAttrCacheKey.java
index 10e76a5..41d5224 100644
--- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/cache/VirAttrCacheKey.java
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/cache/VirAttrCacheKey.java
@@ -73,6 +73,6 @@ public class VirAttrCacheKey {
 
     @Override
     public String toString() {
-        return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE, true);
+        return ReflectionToStringBuilder.toString(this, ToStringStyle.JSON_STYLE, true);
     }
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/86fc76eb/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/report/AuditReportlet.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/report/AuditReportlet.java
b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/report/AuditReportlet.java
index 96039f0..d6f0ec5 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/report/AuditReportlet.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/report/AuditReportlet.java
@@ -86,7 +86,7 @@ public class AuditReportlet extends AbstractReportlet {
 
             if (auditEntry.getBefore() != null) {
                 char[] before = ToStringBuilder.reflectionToString(
-                        auditEntry.getBefore(), ToStringStyle.MULTI_LINE_STYLE).toCharArray();
+                        auditEntry.getBefore(), ToStringStyle.JSON_STYLE).toCharArray();
                 handler.startElement("", "", "before", null);
                 handler.characters(before, 0, before.length);
                 handler.endElement("", "", "before");
@@ -96,7 +96,7 @@ public class AuditReportlet extends AbstractReportlet {
                 handler.startElement("", "", "inputs", null);
                 for (Object inputObj : auditEntry.getInput()) {
                     char[] input = ToStringBuilder.reflectionToString(
-                            inputObj, ToStringStyle.MULTI_LINE_STYLE).toCharArray();
+                            inputObj, ToStringStyle.JSON_STYLE).toCharArray();
                     handler.startElement("", "", "input", null);
                     handler.characters(input, 0, input.length);
                     handler.endElement("", "", "input");
@@ -106,7 +106,7 @@ public class AuditReportlet extends AbstractReportlet {
 
             if (auditEntry.getOutput() != null) {
                 char[] output = ToStringBuilder.reflectionToString(
-                        auditEntry.getOutput(), ToStringStyle.MULTI_LINE_STYLE).toCharArray();
+                        auditEntry.getOutput(), ToStringStyle.JSON_STYLE).toCharArray();
                 handler.startElement("", "", "output", null);
                 handler.characters(output, 0, output.length);
                 handler.endElement("", "", "output");

http://git-wip-us.apache.org/repos/asf/syncope/blob/86fc76eb/core/spring/src/main/java/org/apache/syncope/core/spring/security/SyncopeAuthenticationDetails.java
----------------------------------------------------------------------
diff --git a/core/spring/src/main/java/org/apache/syncope/core/spring/security/SyncopeAuthenticationDetails.java
b/core/spring/src/main/java/org/apache/syncope/core/spring/security/SyncopeAuthenticationDetails.java
index e5a6726..cfd1eec 100644
--- a/core/spring/src/main/java/org/apache/syncope/core/spring/security/SyncopeAuthenticationDetails.java
+++ b/core/spring/src/main/java/org/apache/syncope/core/spring/security/SyncopeAuthenticationDetails.java
@@ -60,7 +60,7 @@ public class SyncopeAuthenticationDetails implements Serializable {
 
     @Override
     public String toString() {
-        return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE);
+        return ReflectionToStringBuilder.toString(this, ToStringStyle.JSON_STYLE);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/86fc76eb/core/spring/src/main/java/org/apache/syncope/core/spring/security/SyncopeGrantedAuthority.java
----------------------------------------------------------------------
diff --git a/core/spring/src/main/java/org/apache/syncope/core/spring/security/SyncopeGrantedAuthority.java
b/core/spring/src/main/java/org/apache/syncope/core/spring/security/SyncopeGrantedAuthority.java
index 578dd35..79667f1 100644
--- a/core/spring/src/main/java/org/apache/syncope/core/spring/security/SyncopeGrantedAuthority.java
+++ b/core/spring/src/main/java/org/apache/syncope/core/spring/security/SyncopeGrantedAuthority.java
@@ -90,7 +90,7 @@ public class SyncopeGrantedAuthority implements GrantedAuthority {
 
     @Override
     public String toString() {
-        return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE);
+        return ReflectionToStringBuilder.toString(this, ToStringStyle.JSON_STYLE);
     }
 
 }


Mime
View raw message