1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package dev.aherscu.qa.s3.publisher.maven.plugin.config;
18
19 import java.util.*;
20
21 public class Metadata {
22
23
24
25
26 String id;
27
28
29
30
31 String cacheControl;
32 String contentDisposition;
33
34
35
36
37 String contentType;
38
39
40 String contentLanguage;
41
42
43
44
45 int secondsToExpire;
46
47
48
49 String contentEncoding;
50
51
52 String websiteRedirectLocation;
53
54
55
56
57
58 String cannedAcl;
59
60
61
62
63 boolean def;
64
65 private static String toLowerCase(final String value) {
66 if (value != null)
67 return value.toLowerCase(Locale.ENGLISH);
68
69 return null;
70 }
71
72 @Override
73 public boolean equals(final Object o) {
74 if (o == this)
75 return true;
76 if (!(o instanceof Metadata))
77 return false;
78 final Metadata metadata = (Metadata) o;
79 return Objects.equals(id, metadata.id)
80 && Objects.equals(cacheControl, metadata.cacheControl)
81 && Objects.equals(contentDisposition, metadata.contentDisposition)
82 && Objects.equals(contentType, metadata.contentType)
83 && Objects.equals(contentLanguage, metadata.contentLanguage)
84 && secondsToExpire == metadata.secondsToExpire
85 && Objects.equals(contentEncoding, metadata.contentEncoding)
86 && Objects
87 .equals(websiteRedirectLocation,
88 metadata.websiteRedirectLocation)
89 && Objects.equals(cannedAcl, metadata.cannedAcl)
90 && def == metadata.def;
91 }
92
93 public String getCacheControl() {
94 return toLowerCase(cacheControl);
95 }
96
97 public String getCannedAcl() {
98 return cannedAcl;
99 }
100
101 public String getContentDisposition() {
102 return toLowerCase(contentDisposition);
103 }
104
105 public String getContentEncoding() {
106 return toLowerCase(contentEncoding);
107 }
108
109 public String getContentLanguage() {
110 return toLowerCase(contentLanguage);
111 }
112
113 public String getContentType() {
114 return toLowerCase(contentType);
115 }
116
117 public String getId() {
118 return id;
119 }
120
121 public int getSecondsToExpire() {
122 return secondsToExpire;
123 }
124
125 public String getWebsiteRedirectLocation() {
126 return toLowerCase(websiteRedirectLocation);
127 }
128
129 @Override
130 public int hashCode() {
131 final int prime = 31;
132 int result = 1;
133 result = prime * result + (id == null ? 0 : id.hashCode());
134 return result;
135 }
136
137 public boolean isDefault() {
138 return def;
139 }
140
141 @Override
142 public String toString() {
143 return "metadada ["
144 + " id=" + id
145 + " cacheControl=" + cacheControl
146 + " contentDisposition=" + contentDisposition
147 + " contentType=" + contentType
148 + " contentLanguage=" + contentLanguage
149 + " secondsToExpire=" + secondsToExpire
150 + " contentEncoding=" + contentEncoding
151 + " websiteRedirectLocation=" + websiteRedirectLocation
152 + " cannedAcl=" + cannedAcl
153 + " ]";
154 }
155 }