Skip to content

Commit ba7adfb

Browse files
committed
RANGER-5061: checkstyle compliance updates - security-admin org.apache.ranger.entity package
1 parent 151e64f commit ba7adfb

File tree

99 files changed

+1110
-2575
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+1110
-2575
lines changed

security-admin/src/main/java/org/apache/ranger/entity/XXAccessAudit.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
import javax.persistence.Entity;
2828
import javax.persistence.Table;
2929

30+
import java.util.Objects;
31+
3032
@Entity
3133
@Table(name = "xa_access_audit")
3234
public class XXAccessAudit extends XXAccessAuditBase implements java.io.Serializable {
@@ -40,7 +42,8 @@ public class XXAccessAudit extends XXAccessAuditBase implements java.io.Serializ
4042

4143
//event duration in ms
4244
@Column(name = "EVENT_DUR_MS")
43-
protected long eventDuration;
45+
protected long eventDuration;
46+
4447
@Column(name = "tags")
4548
protected String tags;
4649

@@ -94,11 +97,15 @@ public int hashCode() {
9497
*/
9598
@Override
9699
public boolean equals(Object obj) {
97-
if (!super.equals(obj)) {
100+
if (this == obj) {
101+
return true;
102+
} else if (!super.equals(obj)) {
98103
return false;
99104
}
105+
100106
XXAccessAudit other = (XXAccessAudit) obj;
101-
return (this.tags != null || other.tags == null) && (this.tags == null || this.tags.equals(other.tags));
107+
108+
return Objects.equals(tags, other.tags);
102109
}
103110

104111
/**

security-admin/src/main/java/org/apache/ranger/entity/XXAccessAuditBase.java

Lines changed: 51 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
import javax.persistence.TemporalType;
3838

3939
import java.util.Date;
40+
import java.util.Objects;
4041

4142
@MappedSuperclass
4243
public class XXAccessAuditBase extends XXDBBase implements java.io.Serializable {
@@ -46,23 +47,26 @@ public class XXAccessAuditBase extends XXDBBase implements java.io.Serializable
4647
@SequenceGenerator(name = "XA_ACCESS_AUDIT_SEQ", sequenceName = "XA_ACCESS_AUDIT_SEQ", allocationSize = 1)
4748
@GeneratedValue(strategy = GenerationType.AUTO, generator = "XA_ACCESS_AUDIT_SEQ")
4849
@Column(name = "ID")
49-
protected Long id;
50+
protected Long id;
51+
5052
/**
5153
* Repository Type
5254
* <ul>
5355
* <li>This attribute is of type enum CommonEnums::AssetType
5456
* </ul>
5557
*/
5658
@Column(name = "AUDIT_TYPE", nullable = false)
57-
protected int auditType = AppConstants.ASSET_UNKNOWN;
59+
protected int auditType = AppConstants.ASSET_UNKNOWN;
60+
5861
/**
5962
* Access Result
6063
* <ul>
6164
* <li>This attribute is of type enum CommonEnums::AccessResult
6265
* </ul>
6366
*/
6467
@Column(name = "ACCESS_RESULT")
65-
protected int accessResult = RangerConstants.ACCESS_RESULT_DENIED;
68+
protected int accessResult = RangerConstants.ACCESS_RESULT_DENIED;
69+
6670
/**
6771
* Access Type
6872
* <ul>
@@ -71,6 +75,7 @@ public class XXAccessAuditBase extends XXDBBase implements java.io.Serializable
7175
*/
7276
@Column(name = "ACCESS_TYPE", length = 255)
7377
protected String accessType;
78+
7479
/**
7580
* Acl Enforcer
7681
* <ul>
@@ -79,6 +84,7 @@ public class XXAccessAuditBase extends XXDBBase implements java.io.Serializable
7984
*/
8085
@Column(name = "ACL_ENFORCER", length = 255)
8186
protected String aclEnforcer;
87+
8288
/**
8389
* Agent Id
8490
* <ul>
@@ -87,6 +93,7 @@ public class XXAccessAuditBase extends XXDBBase implements java.io.Serializable
8793
*/
8894
@Column(name = "AGENT_ID", length = 255)
8995
protected String agentId;
96+
9097
/**
9198
* Client Ip
9299
* <ul>
@@ -95,6 +102,7 @@ public class XXAccessAuditBase extends XXDBBase implements java.io.Serializable
95102
*/
96103
@Column(name = "CLIENT_IP", length = 255)
97104
protected String clientIP;
105+
98106
/**
99107
* Client Type
100108
* <ul>
@@ -103,13 +111,15 @@ public class XXAccessAuditBase extends XXDBBase implements java.io.Serializable
103111
*/
104112
@Column(name = "CLIENT_TYPE", length = 255)
105113
protected String clientType;
114+
106115
/**
107116
* Policy Id
108117
* <ul>
109118
* </ul>
110119
*/
111120
@Column(name = "POLICY_ID")
112-
protected long policyId;
121+
protected long policyId;
122+
113123
/**
114124
* Repository Name
115125
* <ul>
@@ -118,13 +128,15 @@ public class XXAccessAuditBase extends XXDBBase implements java.io.Serializable
118128
*/
119129
@Column(name = "REPO_NAME", length = 255)
120130
protected String repoName;
131+
121132
/**
122133
* Repository Type
123134
* <ul>
124135
* </ul>
125136
*/
126137
@Column(name = "REPO_TYPE")
127-
protected int repoType;
138+
protected int repoType;
139+
128140
/**
129141
* Reason of result
130142
* <ul>
@@ -133,6 +145,7 @@ public class XXAccessAuditBase extends XXDBBase implements java.io.Serializable
133145
*/
134146
@Column(name = "RESULT_REASON", length = 255)
135147
protected String resultReason;
148+
136149
/**
137150
* Session Id
138151
* <ul>
@@ -141,14 +154,16 @@ public class XXAccessAuditBase extends XXDBBase implements java.io.Serializable
141154
*/
142155
@Column(name = "SESSION_ID", length = 255)
143156
protected String sessionId;
157+
144158
/**
145159
* Event Time
146160
* <ul>
147161
* </ul>
148162
*/
149163
@Temporal(TemporalType.TIMESTAMP)
150164
@Column(name = "EVENT_TIME")
151-
protected Date eventTime = DateUtil.getUTCDate();
165+
protected Date eventTime = DateUtil.getUTCDate();
166+
152167
/**
153168
* Requesting User
154169
* <ul>
@@ -157,6 +172,7 @@ public class XXAccessAuditBase extends XXDBBase implements java.io.Serializable
157172
*/
158173
@Column(name = "REQUEST_USER", length = 255)
159174
protected String requestUser;
175+
160176
/**
161177
* Action
162178
* <ul>
@@ -165,6 +181,7 @@ public class XXAccessAuditBase extends XXDBBase implements java.io.Serializable
165181
*/
166182
@Column(name = "ACTION", length = 2000)
167183
protected String action;
184+
168185
/**
169186
* Requesting Data
170187
* <ul>
@@ -173,6 +190,7 @@ public class XXAccessAuditBase extends XXDBBase implements java.io.Serializable
173190
*/
174191
@Column(name = "REQUEST_DATA", length = 2000)
175192
protected String requestData;
193+
176194
/**
177195
* Resource Path
178196
* <ul>
@@ -181,6 +199,7 @@ public class XXAccessAuditBase extends XXDBBase implements java.io.Serializable
181199
*/
182200
@Column(name = "RESOURCE_PATH", length = 2000)
183201
protected String resourcePath;
202+
184203
/**
185204
* Resource Type
186205
* <ul>
@@ -202,9 +221,11 @@ public static String getEnumName(String fieldName) {
202221
if ("auditType".equals(fieldName)) {
203222
return "CommonEnums.AssetType";
204223
}
224+
205225
if ("accessResult".equals(fieldName)) {
206226
return "CommonEnums.AccessResult";
207227
}
228+
208229
return null;
209230
}
210231

@@ -235,62 +256,31 @@ public int hashCode() {
235256
*/
236257
@Override
237258
public boolean equals(Object obj) {
238-
if (!super.equals(obj)) {
259+
if (this == obj) {
260+
return true;
261+
} else if (!super.equals(obj)) {
239262
return false;
240263
}
264+
241265
XXAccessAuditBase other = (XXAccessAuditBase) obj;
242-
if (this.auditType != other.auditType) {
243-
return false;
244-
}
245-
if (this.accessResult != other.accessResult) {
246-
return false;
247-
}
248-
if ((this.accessType == null && other.accessType != null) || (this.accessType != null && !this.accessType.equals(other.accessType))) {
249-
return false;
250-
}
251-
if ((this.aclEnforcer == null && other.aclEnforcer != null) || (this.aclEnforcer != null && !this.aclEnforcer.equals(other.aclEnforcer))) {
252-
return false;
253-
}
254-
if ((this.agentId == null && other.agentId != null) || (this.agentId != null && !this.agentId.equals(other.agentId))) {
255-
return false;
256-
}
257-
if ((this.clientIP == null && other.clientIP != null) || (this.clientIP != null && !this.clientIP.equals(other.clientIP))) {
258-
return false;
259-
}
260-
if ((this.clientType == null && other.clientType != null) || (this.clientType != null && !this.clientType.equals(other.clientType))) {
261-
return false;
262-
}
263-
if (this.policyId != other.policyId) {
264-
return false;
265-
}
266-
if ((this.repoName == null && other.repoName != null) || (this.repoName != null && !this.repoName.equals(other.repoName))) {
267-
return false;
268-
}
269-
if (this.repoType != other.repoType) {
270-
return false;
271-
}
272-
if ((this.resultReason == null && other.resultReason != null) || (this.resultReason != null && !this.resultReason.equals(other.resultReason))) {
273-
return false;
274-
}
275-
if ((this.sessionId == null && other.sessionId != null) || (this.sessionId != null && !this.sessionId.equals(other.sessionId))) {
276-
return false;
277-
}
278-
if ((this.eventTime == null && other.eventTime != null) || (this.eventTime != null && !this.eventTime.equals(other.eventTime))) {
279-
return false;
280-
}
281-
if ((this.requestUser == null && other.requestUser != null) || (this.requestUser != null && !this.requestUser.equals(other.requestUser))) {
282-
return false;
283-
}
284-
if ((this.action == null && other.action != null) || (this.action != null && !this.action.equals(other.action))) {
285-
return false;
286-
}
287-
if ((this.requestData == null && other.requestData != null) || (this.requestData != null && !this.requestData.equals(other.requestData))) {
288-
return false;
289-
}
290-
if ((this.resourcePath == null && other.resourcePath != null) || (this.resourcePath != null && !this.resourcePath.equals(other.resourcePath))) {
291-
return false;
292-
}
293-
return (this.resourceType != null || other.resourceType == null) && (this.resourceType == null || this.resourceType.equals(other.resourceType));
266+
267+
return Objects.equals(auditType, other.auditType) &&
268+
Objects.equals(accessResult, other.accessResult) &&
269+
Objects.equals(accessType, other.accessType) &&
270+
Objects.equals(aclEnforcer, other.aclEnforcer) &&
271+
Objects.equals(agentId, other.agentId) &&
272+
Objects.equals(clientIP, other.clientIP) &&
273+
Objects.equals(clientType, other.clientType) &&
274+
Objects.equals(policyId, other.policyId) &&
275+
Objects.equals(repoName, other.repoName) &&
276+
Objects.equals(resultReason, other.resultReason) &&
277+
Objects.equals(sessionId, other.sessionId) &&
278+
Objects.equals(eventTime, other.eventTime) &&
279+
Objects.equals(requestUser, other.requestUser) &&
280+
Objects.equals(action, other.action) &&
281+
Objects.equals(requestData, other.requestData) &&
282+
Objects.equals(resourcePath, other.resourcePath) &&
283+
Objects.equals(resourceType, other.resourceType);
294284
}
295285

296286
/**
@@ -301,6 +291,7 @@ public boolean equals(Object obj) {
301291
@Override
302292
public String toString() {
303293
String str = "XXAccessAudit=";
294+
304295
str += super.toString();
305296
str += "id={" + id + "} ";
306297
str += "auditType={" + auditType + "} ";
@@ -320,6 +311,7 @@ public String toString() {
320311
str += "requestData={" + requestData + "} ";
321312
str += "resourcePath={" + resourcePath + "} ";
322313
str += "resourceType={" + resourceType + "} ";
314+
323315
return str;
324316
}
325317

security-admin/src/main/java/org/apache/ranger/entity/XXAccessAuditV5.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,16 @@
3333
@Table(name = "xa_access_audit")
3434
public class XXAccessAuditV5 extends XXAccessAuditBase implements java.io.Serializable {
3535
private static final long serialVersionUID = 1L;
36+
3637
@Column(name = "SEQ_NUM")
37-
protected long sequenceNumber;
38+
protected long sequenceNumber;
39+
3840
@Column(name = "EVENT_COUNT")
39-
protected long eventCount;
41+
protected long eventCount;
42+
4043
//event duration in ms
4144
@Column(name = "EVENT_DUR_MS")
42-
protected long eventDuration;
45+
protected long eventDuration;
4346

4447
@Override
4548
public int getMyClassType() {
@@ -54,9 +57,11 @@ public int getMyClassType() {
5457
@Override
5558
public String toString() {
5659
String str = super.toString();
60+
5761
str += "sequenceNumber={" + sequenceNumber + "}";
5862
str += "eventCount={" + eventCount + "}";
5963
str += "eventDuration={" + eventDuration + "}";
64+
6065
return str;
6166
}
6267

security-admin/src/main/java/org/apache/ranger/entity/XXAccessTypeDef.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
@Table(name = "x_access_type_def")
3535
public class XXAccessTypeDef extends XXDBBase implements java.io.Serializable {
3636
private static final long serialVersionUID = 1L;
37+
3738
/**
3839
* id of the XXAccessTypeDef
3940
* <ul>
@@ -43,7 +44,7 @@ public class XXAccessTypeDef extends XXDBBase implements java.io.Serializable {
4344
@SequenceGenerator(name = "x_access_type_def_SEQ", sequenceName = "x_access_type_def_SEQ", allocationSize = 1)
4445
@GeneratedValue(strategy = GenerationType.AUTO, generator = "x_access_type_def_SEQ")
4546
@Column(name = "id")
46-
protected Long id;
47+
protected Long id;
4748

4849
/**
4950
* defId of the XXAccessTypeDef
@@ -148,8 +149,6 @@ public int hashCode() {
148149
public boolean equals(Object obj) {
149150
if (this == obj) {
150151
return true;
151-
} else if (getClass() != obj.getClass()) {
152-
return false;
153152
} else if (!super.equals(obj)) {
154153
return false;
155154
}

0 commit comments

Comments
 (0)