View Javadoc

1   package com.atlassian.jira.rest.client.api.domain;
2   
3   import com.atlassian.jira.rest.client.api.OptionalIterable;
4   import com.google.common.base.Objects;
5   import org.joda.time.DateTime;
6   
7   import javax.annotation.Nullable;
8   
9   /**
10   * Represents record from JIRA Audit Log.
11   *
12   * @since v2.0
13   */
14  public class AuditRecord {
15  
16      private final Long id;
17  
18      private final String summary;
19  
20      private final DateTime created;
21  
22      private final String category;
23  
24      private final String eventSource;
25  
26      @Nullable
27      private final String authorKey;
28  
29      @Nullable
30      private final String remoteAddress;
31  
32      @Nullable
33      private final AuditAssociatedItem objectItem;
34  
35      private final OptionalIterable<AuditAssociatedItem> associatedItem;
36  
37      private final OptionalIterable<AuditChangedValue> changedValues;
38  
39      public AuditRecord(final Long id, final String summary, @Nullable final String remoteAddress,
40                         final DateTime created, final String category, String eventSource,
41                         @Nullable final String authorKey,
42                         @Nullable final AuditAssociatedItem objectItem,
43                         final OptionalIterable<AuditAssociatedItem> associatedItem,
44                         final OptionalIterable<AuditChangedValue> changedValues) {
45          this.id = id;
46          this.summary = summary;
47          this.remoteAddress = remoteAddress;
48          this.created = created;
49          this.category = category;
50          this.eventSource = eventSource;
51          this.authorKey = authorKey;
52          this.objectItem = objectItem;
53          this.associatedItem = associatedItem;
54          this.changedValues = changedValues;
55      }
56  
57      public Long getId() {
58          return id;
59      }
60  
61      public String getSummary() {
62          return summary;
63      }
64  
65      public DateTime getCreated() {
66          return created;
67      }
68  
69      public String getCategory() {
70          return category;
71      }
72  
73      public String getEventSource() {
74          return eventSource;
75      }
76  
77      @Nullable
78      public String getRemoteAddress() {
79          return remoteAddress;
80      }
81  
82      @Nullable
83      public String getAuthorKey() {
84          return authorKey;
85      }
86  
87      @Nullable
88      public AuditAssociatedItem getObjectItem() {
89          return objectItem;
90      }
91  
92      public OptionalIterable<AuditAssociatedItem> getAssociatedItems() {
93          return associatedItem;
94      }
95  
96      public OptionalIterable<AuditChangedValue> getChangedValues() {
97          return changedValues;
98      }
99  
100     protected Objects.ToStringHelper getToStringHelper() {
101         return Objects.toStringHelper(this).
102                 add("id", id).
103                 add("summary", summary).
104                 add("remoteAddress", remoteAddress).
105                 add("created", created).
106                 add("category", category).
107                 add("authorKey", authorKey).
108                 add("objectItem", objectItem).
109                 add("associatedItem", associatedItem).
110                 add("changedValues", changedValues);
111     }
112 
113     @Override
114     public boolean equals(final Object o) {
115         if (o instanceof AuditRecord) {
116             final AuditRecord that = (AuditRecord) o;
117             return Objects.equal(this.id, that.id)
118                     && Objects.equal(this.summary, that.summary)
119                     && Objects.equal(this.remoteAddress, that.remoteAddress)
120                     && Objects.equal(this.created, that.created)
121                     && Objects.equal(this.category, that.category)
122                     && Objects.equal(this.authorKey, that.authorKey)
123                     && Objects.equal(this.objectItem, that.objectItem)
124                     && Objects.equal(this.associatedItem, that.associatedItem)
125                     && Objects.equal(this.changedValues, that.changedValues);
126         }
127         return false;
128     }
129 
130     @Override
131     public int hashCode() {
132         return Objects.hashCode(id, summary, remoteAddress, created, category, authorKey, objectItem, associatedItem, changedValues);
133     }
134 
135 }