View Javadoc
1   package org.kuali.common.devops.jenkins.updates.model;
2   
3   import java.util.List;
4   
5   import org.kuali.common.core.build.ValidatingBuilder;
6   import org.kuali.common.core.validate.annotation.IdiotProofImmutable;
7   
8   import com.fasterxml.jackson.annotation.JsonProperty;
9   import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
10  import com.google.common.collect.ImmutableList;
11  
12  @IdiotProofImmutable
13  @JsonDeserialize(builder = JenkinsSignature.Builder.class)
14  public final class JenkinsSignature {
15  
16  	private final String digest;
17  	private final String signature;
18  
19  	@JsonProperty("correct_digest")
20  	private final String correctDigest;
21  
22  	@JsonProperty("correct_signature")
23  	private final String correctSignature;
24  	private final ImmutableList<String> certificates;
25  
26  	private JenkinsSignature(Builder builder) {
27  		this.digest = builder.digest;
28  		this.signature = builder.signature;
29  		this.correctDigest = builder.correctDigest;
30  		this.correctSignature = builder.correctSignature;
31  		this.certificates = ImmutableList.copyOf(builder.certificates);
32  	}
33  
34  	public static Builder builder() {
35  		return new Builder();
36  	}
37  
38  	public static class Builder extends ValidatingBuilder<JenkinsSignature> {
39  
40  		private String digest;
41  		private String signature;
42  		@JsonProperty("correct_digest")
43  		private String correctDigest;
44  		@JsonProperty("correct_signature")
45  		private String correctSignature;
46  		private List<String> certificates;
47  
48  		public Builder withDigest(String digest) {
49  			this.digest = digest;
50  			return this;
51  		}
52  
53  		public Builder withSignature(String signature) {
54  			this.signature = signature;
55  			return this;
56  		}
57  
58  		public Builder withCorrectDigest(String correctDigest) {
59  			this.correctDigest = correctDigest;
60  			return this;
61  		}
62  
63  		public Builder withCorrectSignature(String correctSignature) {
64  			this.correctSignature = correctSignature;
65  			return this;
66  		}
67  
68  		public Builder withCertificates(ImmutableList<String> certificates) {
69  			this.certificates = certificates;
70  			return this;
71  		}
72  
73  		@Override
74  		public JenkinsSignature build() {
75  			return validate(new JenkinsSignature(this));
76  		}
77  	}
78  
79  	public String getDigest() {
80  		return digest;
81  	}
82  
83  	public String getSignature() {
84  		return signature;
85  	}
86  
87  	public String getCorrectDigest() {
88  		return correctDigest;
89  	}
90  
91  	public String getCorrectSignature() {
92  		return correctSignature;
93  	}
94  
95  	public List<String> getCertificates() {
96  		return certificates;
97  	}
98  
99  }