3737import javax .persistence .TemporalType ;
3838
3939import java .util .Date ;
40+ import java .util .Objects ;
4041
4142@ MappedSuperclass
4243public 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
0 commit comments