View Javadoc

1   package com.atlassian.jira.rest.client.api.domain;
2   
3   import com.google.common.base.Objects;
4   
5   import javax.annotation.Nonnull;
6   import javax.annotation.Nullable;
7   
8   /**
9    * Item that can be associated with Audit Record.
10   * Represents additional information about item related to record like user, group or schema.
11   *
12   * @since v2.0
13   */
14  public class AuditAssociatedItem {
15  
16      @Nullable
17      private final String id;
18  
19      private final String name;
20  
21      private final String typeName;
22  
23      @Nullable
24      private final String parentId;
25  
26      @Nullable
27      private final String parentName;
28  
29      public AuditAssociatedItem(final String id, final String name, final String typeName, final String parentId, final String parentName) {
30          this.id = id;
31          this.name = name;
32          this.typeName = typeName;
33          this.parentId = parentId;
34          this.parentName = parentName;
35      }
36  
37      @Nullable
38      public String getId() {
39          return id;
40      }
41  
42      @Nonnull
43      public String getName() {
44          return name;
45      }
46  
47      @Nonnull
48      public String getTypeName() {
49          return typeName;
50      }
51  
52      @Nullable
53      public String getParentId() {
54          return parentId;
55      }
56  
57      @Nullable
58      public String getParentName() {
59          return parentName;
60      }
61  
62      protected Objects.ToStringHelper getToStringHelper() {
63          return Objects.toStringHelper(this).
64                  add("id", id).
65                  add("name", name).
66                  add("typeName", typeName).
67                  add("parentId", parentId).
68                  add("parentName", parentName);
69      }
70  
71      @Override
72      public boolean equals(final Object o) {
73          if (o instanceof AuditAssociatedItem) {
74              final AuditAssociatedItem that = (AuditAssociatedItem) o;
75              return Objects.equal(this.id, that.id)
76                      && Objects.equal(this.name, that.name)
77                      && Objects.equal(this.parentId, that.parentId)
78                      && Objects.equal(this.parentName, that.parentName)
79                      && Objects.equal(this.typeName, that.typeName);
80          }
81          return false;
82      }
83  
84      @Override
85      public int hashCode() {
86          return Objects.hashCode(id, name, typeName, typeName, parentId, parentName);
87      }
88  
89  }