Skip to content

Commit cd55d21

Browse files
committed
RANGER-3948: updated Json annotation to skip serialization of empty values
1 parent 31f7be8 commit cd55d21

32 files changed

+68
-68
lines changed

agents-common/src/main/java/org/apache/ranger/admin/client/datatype/GrantRevokeData.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333

3434
@JsonAutoDetect(getterVisibility = Visibility.NONE, setterVisibility = Visibility.NONE, fieldVisibility = Visibility.ANY)
35-
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
35+
@JsonSerialize(include = JsonSerialize.Inclusion.NON_EMPTY)
3636
@JsonIgnoreProperties(ignoreUnknown = true)
3737
public class GrantRevokeData implements java.io.Serializable {
3838
private static final long serialVersionUID = 1L;
@@ -162,7 +162,7 @@ public String toString() {
162162
}
163163

164164
@JsonAutoDetect(getterVisibility = Visibility.NONE, setterVisibility = Visibility.NONE, fieldVisibility = Visibility.ANY)
165-
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
165+
@JsonSerialize(include = JsonSerialize.Inclusion.NON_EMPTY)
166166
@JsonIgnoreProperties(ignoreUnknown = true)
167167
public static class PermMap implements java.io.Serializable {
168168
private List<String> userList = new ArrayList<>();

agents-common/src/main/java/org/apache/ranger/admin/client/datatype/RESTResponse.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434

3535
@JsonAutoDetect(getterVisibility = Visibility.NONE, setterVisibility = Visibility.NONE, fieldVisibility = Visibility.ANY)
36-
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
36+
@JsonSerialize(include = JsonSerialize.Inclusion.NON_EMPTY)
3737
@JsonIgnoreProperties(ignoreUnknown = true)
3838
public class RESTResponse implements java.io.Serializable {
3939
private static final Logger LOG = LoggerFactory.getLogger(RESTResponse.class);
@@ -140,7 +140,7 @@ public String toString() {
140140
}
141141

142142
@JsonAutoDetect(getterVisibility = Visibility.NONE, setterVisibility = Visibility.NONE, fieldVisibility = Visibility.ANY)
143-
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
143+
@JsonSerialize(include = JsonSerialize.Inclusion.NON_EMPTY)
144144
@JsonIgnoreProperties(ignoreUnknown = true)
145145
public static class Message implements java.io.Serializable {
146146
private String name;

agents-common/src/main/java/org/apache/ranger/plugin/model/AuditFilter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
import org.codehaus.jackson.map.annotate.JsonSerialize;
3434

3535
@JsonAutoDetect(fieldVisibility=Visibility.ANY)
36-
@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
36+
@JsonSerialize(include=JsonSerialize.Inclusion.NON_EMPTY)
3737
@JsonIgnoreProperties(ignoreUnknown=true)
3838
@XmlRootElement
3939
@XmlAccessorType(XmlAccessType.FIELD)
@@ -127,4 +127,4 @@ public String toString() {
127127
+ ", isAudited=" + isAudited
128128
+ "}";
129129
}
130-
}
130+
}

agents-common/src/main/java/org/apache/ranger/plugin/model/GroupInfo.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
import java.util.Map;
3232

3333
@JsonAutoDetect(fieldVisibility=JsonAutoDetect.Visibility.ANY)
34-
@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
34+
@JsonSerialize(include=JsonSerialize.Inclusion.NON_EMPTY)
3535
@JsonIgnoreProperties(ignoreUnknown=true)
3636
@XmlRootElement
3737
@XmlAccessorType(XmlAccessType.FIELD)
@@ -84,4 +84,4 @@ public String toString() {
8484
+ "}";
8585
}
8686

87-
}
87+
}

agents-common/src/main/java/org/apache/ranger/plugin/model/RangerBaseModelObject.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
import org.codehaus.jackson.map.annotate.JsonSerialize;
3232

3333
@JsonAutoDetect(getterVisibility=Visibility.NONE, setterVisibility=Visibility.NONE, fieldVisibility=Visibility.ANY)
34-
@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL )
34+
@JsonSerialize(include=JsonSerialize.Inclusion.NON_EMPTY )
3535
@JsonIgnoreProperties(ignoreUnknown=true)
3636
@XmlRootElement
3737
@XmlAccessorType(XmlAccessType.FIELD)

agents-common/src/main/java/org/apache/ranger/plugin/model/RangerMetrics.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
import org.codehaus.jackson.map.annotate.JsonSerialize;
3232

3333
@JsonAutoDetect(fieldVisibility=Visibility.ANY)
34-
@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
34+
@JsonSerialize(include=JsonSerialize.Inclusion.NON_EMPTY)
3535
@JsonIgnoreProperties(ignoreUnknown=true)
3636
@XmlRootElement
3737
@XmlAccessorType(XmlAccessType.FIELD)

agents-common/src/main/java/org/apache/ranger/plugin/model/RangerPluginInfo.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
import java.util.Map;
3535

3636
@JsonAutoDetect(fieldVisibility=JsonAutoDetect.Visibility.ANY)
37-
@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
37+
@JsonSerialize(include=JsonSerialize.Inclusion.NON_EMPTY)
3838
@JsonIgnoreProperties(ignoreUnknown=true)
3939
@XmlRootElement
4040
@XmlAccessorType(XmlAccessType.FIELD)

agents-common/src/main/java/org/apache/ranger/plugin/model/RangerPolicy.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737

3838
@JsonAutoDetect(fieldVisibility=Visibility.ANY)
39-
@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
39+
@JsonSerialize(include=JsonSerialize.Inclusion.NON_EMPTY)
4040
@JsonIgnoreProperties(ignoreUnknown=true)
4141
@XmlRootElement
4242
@XmlAccessorType(XmlAccessType.FIELD)
@@ -712,7 +712,7 @@ public int compare(RangerPolicy me, RangerPolicy other) {
712712
}
713713

714714
@JsonAutoDetect(fieldVisibility=Visibility.ANY)
715-
@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
715+
@JsonSerialize(include=JsonSerialize.Inclusion.NON_EMPTY)
716716
@JsonIgnoreProperties(ignoreUnknown=true)
717717
@XmlRootElement
718718
@XmlAccessorType(XmlAccessType.FIELD)
@@ -880,7 +880,7 @@ public boolean equals(Object obj) {
880880
}
881881

882882
@JsonAutoDetect(fieldVisibility=Visibility.ANY)
883-
@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
883+
@JsonSerialize(include=JsonSerialize.Inclusion.NON_EMPTY)
884884
@JsonIgnoreProperties(ignoreUnknown=true)
885885
@XmlRootElement
886886
@XmlAccessorType(XmlAccessType.FIELD)
@@ -1173,7 +1173,7 @@ public boolean equals(Object obj) {
11731173
}
11741174

11751175
@JsonAutoDetect(fieldVisibility=Visibility.ANY)
1176-
@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
1176+
@JsonSerialize(include=JsonSerialize.Inclusion.NON_EMPTY)
11771177
@JsonIgnoreProperties(ignoreUnknown=true)
11781178
@XmlRootElement
11791179
@XmlAccessorType(XmlAccessType.FIELD)
@@ -1260,7 +1260,7 @@ public StringBuilder toString(StringBuilder sb) {
12601260
}
12611261

12621262
@JsonAutoDetect(fieldVisibility=Visibility.ANY)
1263-
@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
1263+
@JsonSerialize(include=JsonSerialize.Inclusion.NON_EMPTY)
12641264
@JsonIgnoreProperties(ignoreUnknown=true)
12651265
@XmlRootElement
12661266
@XmlAccessorType(XmlAccessType.FIELD)
@@ -1347,7 +1347,7 @@ public StringBuilder toString(StringBuilder sb) {
13471347
}
13481348

13491349
@JsonAutoDetect(fieldVisibility=Visibility.ANY)
1350-
@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
1350+
@JsonSerialize(include=JsonSerialize.Inclusion.NON_EMPTY)
13511351
@JsonIgnoreProperties(ignoreUnknown=true)
13521352
@XmlRootElement
13531353
@XmlAccessorType(XmlAccessType.FIELD)
@@ -1451,7 +1451,7 @@ public boolean equals(Object obj) {
14511451
}
14521452

14531453
@JsonAutoDetect(fieldVisibility=Visibility.ANY)
1454-
@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
1454+
@JsonSerialize(include=JsonSerialize.Inclusion.NON_EMPTY)
14551455
@JsonIgnoreProperties(ignoreUnknown=true)
14561456
@XmlRootElement
14571457
@XmlAccessorType(XmlAccessType.FIELD)
@@ -1569,7 +1569,7 @@ public boolean equals(Object obj) {
15691569
}
15701570

15711571
@JsonAutoDetect(fieldVisibility=Visibility.ANY)
1572-
@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
1572+
@JsonSerialize(include=JsonSerialize.Inclusion.NON_EMPTY)
15731573
@JsonIgnoreProperties(ignoreUnknown=true)
15741574
@XmlRootElement
15751575
@XmlAccessorType(XmlAccessType.FIELD)
@@ -1678,7 +1678,7 @@ public StringBuilder toString(StringBuilder sb) {
16781678
}
16791679

16801680
@JsonAutoDetect(fieldVisibility=Visibility.ANY)
1681-
@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
1681+
@JsonSerialize(include=JsonSerialize.Inclusion.NON_EMPTY)
16821682
@JsonIgnoreProperties(ignoreUnknown=true)
16831683
@XmlRootElement
16841684
@XmlAccessorType(XmlAccessType.FIELD)

agents-common/src/main/java/org/apache/ranger/plugin/model/RangerPolicyDelta.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
import org.codehaus.jackson.map.annotate.JsonSerialize;
3131

3232
@JsonAutoDetect(fieldVisibility=Visibility.ANY)
33-
@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
33+
@JsonSerialize(include=JsonSerialize.Inclusion.NON_EMPTY)
3434
@JsonIgnoreProperties(ignoreUnknown=true)
3535
@XmlRootElement
3636
@XmlAccessorType(XmlAccessType.FIELD)

agents-common/src/main/java/org/apache/ranger/plugin/model/RangerRole.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
import java.util.Objects;
3535

3636
@JsonAutoDetect(fieldVisibility=JsonAutoDetect.Visibility.ANY)
37-
@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
37+
@JsonSerialize(include=JsonSerialize.Inclusion.NON_EMPTY)
3838
@JsonIgnoreProperties(ignoreUnknown=true)
3939
@XmlRootElement
4040
@XmlAccessorType(XmlAccessType.FIELD)
@@ -137,7 +137,7 @@ public String toString() {
137137
}
138138

139139
@JsonAutoDetect(fieldVisibility=JsonAutoDetect.Visibility.ANY)
140-
@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
140+
@JsonSerialize(include=JsonSerialize.Inclusion.NON_EMPTY)
141141
@JsonIgnoreProperties(ignoreUnknown=true)
142142
@XmlRootElement
143143
@XmlAccessorType(XmlAccessType.FIELD)
@@ -195,4 +195,4 @@ private String getPrintableOptions(Map<String, Object> options) {
195195
return ret.toString();
196196
}
197197

198-
}
198+
}

0 commit comments

Comments
 (0)