2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2021 Nokia.
4 * ================================================================================
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 * SPDX-License-Identifier: Apache-2.0
18 * ============LICENSE_END=========================================================
21 package org.onap.oom.certservice.certification.model;
23 import java.util.Objects;
25 public final class CertificateUpdateModel {
27 private final String encodedCsr;
28 private final String encodedPrivateKey;
29 private final String encodedOldCert;
30 private final String encodedOldPrivateKey;
31 private final String caName;
33 private CertificateUpdateModel(String encodedCsr, String encodedPrivateKey, String encodedOldCert,
34 String encodedOldPrivateKey, String caName) {
35 this.encodedCsr = encodedCsr;
36 this.encodedPrivateKey = encodedPrivateKey;
37 this.encodedOldCert = encodedOldCert;
38 this.encodedOldPrivateKey = encodedOldPrivateKey;
42 public String getEncodedCsr() {
46 public String getEncodedPrivateKey() {
47 return encodedPrivateKey;
50 public String getEncodedOldCert() {
51 return encodedOldCert;
54 public String getEncodedOldPrivateKey() {
55 return encodedOldPrivateKey;
58 public String getCaName() {
63 public boolean equals(Object o) {
64 if (this == o) return true;
65 if (o == null || getClass() != o.getClass()) return false;
66 CertificateUpdateModel that = (CertificateUpdateModel) o;
67 return Objects.equals(encodedCsr, that.encodedCsr)
68 && Objects.equals(encodedPrivateKey, that.encodedPrivateKey)
69 && Objects.equals(encodedOldCert, that.encodedOldCert)
70 && Objects.equals(encodedOldPrivateKey, that.encodedOldPrivateKey)
71 && Objects.equals(caName, that.caName);
75 public int hashCode() {
76 return Objects.hash(encodedCsr, encodedPrivateKey, encodedOldCert, encodedOldPrivateKey, caName);
79 public static class CertificateUpdateModelBuilder {
81 private String encodedCsr;
82 private String encodedPrivateKey;
83 private String encodedOldCert;
84 private String encodedOldPrivateKey;
85 private String caName;
87 public CertificateUpdateModelBuilder setEncodedCsr(String encodedCsr) {
88 this.encodedCsr = encodedCsr;
92 public CertificateUpdateModelBuilder setEncodedPrivateKey(String encodedPrivateKey) {
93 this.encodedPrivateKey = encodedPrivateKey;
97 public CertificateUpdateModelBuilder setEncodedOldCert(String encodedOldCert) {
98 this.encodedOldCert = encodedOldCert;
102 public CertificateUpdateModelBuilder setEncodedOldPrivateKey(String encodedOldPrivateKey) {
103 this.encodedOldPrivateKey = encodedOldPrivateKey;
107 public CertificateUpdateModelBuilder setCaName(String caName) {
108 this.caName = caName;
112 public CertificateUpdateModel build() {
113 return new CertificateUpdateModel(encodedCsr, encodedPrivateKey, encodedOldCert, encodedOldPrivateKey, caName);