1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.syncope.common.rest.api.batch;
20
21 import java.io.Serializable;
22 import java.util.List;
23 import java.util.Map;
24 import java.util.TreeMap;
25 import org.apache.commons.lang3.builder.EqualsBuilder;
26 import org.apache.commons.lang3.builder.HashCodeBuilder;
27
28 public abstract class BatchItem implements Serializable {
29
30 private static final long serialVersionUID = -1393976266651766259L;
31
32 protected final Map<String, List<Object>> headers = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
33
34 protected String content;
35
36 public Map<String, List<Object>> getHeaders() {
37 return headers;
38 }
39
40 public void setHeaders(final Map<String, List<Object>> headers) {
41 this.headers.clear();
42 this.headers.putAll(headers);
43 }
44
45 public String getContent() {
46 return content;
47 }
48
49 public void setContent(final String content) {
50 this.content = content;
51 }
52
53 @Override
54 public int hashCode() {
55 return new HashCodeBuilder().
56 appendSuper(super.hashCode()).
57 append(headers).
58 append(content).
59 build();
60 }
61
62 @Override
63 public boolean equals(final Object obj) {
64 if (this == obj) {
65 return true;
66 }
67 if (obj == null) {
68 return false;
69 }
70 if (getClass() != obj.getClass()) {
71 return false;
72 }
73 final BatchItem other = (BatchItem) obj;
74 return new EqualsBuilder().
75 appendSuper(super.equals(obj)).
76 append(headers, other.headers).
77 append(content, other.content).
78 build();
79 }
80
81 @Override
82 public String toString() {
83 return "BatchItem{"
84 + "headers=" + headers + ", "
85 + "content=" + content
86 + '}';
87 }
88 }