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 obj) {
67 if (obj == null || getClass() != obj.getClass()) {
70 CertificateUpdateModel that = (CertificateUpdateModel) obj;
71 return Objects.equals(encodedCsr, that.encodedCsr)
72 && Objects.equals(encodedPrivateKey, that.encodedPrivateKey)
73 && Objects.equals(encodedOldCert, that.encodedOldCert)
74 && Objects.equals(encodedOldPrivateKey, that.encodedOldPrivateKey)
75 && Objects.equals(caName, that.caName);
79 public int hashCode() {
80 return Objects.hash(encodedCsr, encodedPrivateKey, encodedOldCert, encodedOldPrivateKey, caName);
83 public static class CertificateUpdateModelBuilder {
85 private String encodedCsr;
86 private String encodedPrivateKey;
87 private String encodedOldCert;
88 private String encodedOldPrivateKey;
89 private String caName;
91 public CertificateUpdateModelBuilder setEncodedCsr(String encodedCsr) {
92 this.encodedCsr = encodedCsr;
96 public CertificateUpdateModelBuilder setEncodedPrivateKey(String encodedPrivateKey) {
97 this.encodedPrivateKey = encodedPrivateKey;
101 public CertificateUpdateModelBuilder setEncodedOldCert(String encodedOldCert) {
102 this.encodedOldCert = encodedOldCert;
106 public CertificateUpdateModelBuilder setEncodedOldPrivateKey(String encodedOldPrivateKey) {
107 this.encodedOldPrivateKey = encodedOldPrivateKey;
111 public CertificateUpdateModelBuilder setCaName(String caName) {
112 this.caName = caName;
116 public CertificateUpdateModel build() {
117 return new CertificateUpdateModel(encodedCsr, encodedPrivateKey, encodedOldCert, encodedOldPrivateKey,