]> git.basschouten.com Git - openhab-addons.git/blob
2b50ef644766f4573adc702aa519d3aa071d7553
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
7  * This program and the accompanying materials are made available under the
8  * terms of the Eclipse Public License 2.0 which is available at
9  * http://www.eclipse.org/legal/epl-2.0
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.tr064.internal.soap;
14
15 import java.util.Map;
16
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.eclipse.jdt.annotation.Nullable;
19 import org.openhab.binding.tr064.internal.dto.scpd.root.SCPDServiceType;
20
21 /**
22  * The {@link SOAPRequest} is a wrapper for SOAP requests
23  *
24  * @author Jan N. Klug - Initial contribution
25  */
26 @NonNullByDefault
27 public class SOAPRequest {
28     public SCPDServiceType service;
29     public String soapAction;
30     public Map<String, String> arguments = Map.of();
31
32     public SOAPRequest(SCPDServiceType service, String soapAction) {
33         this.service = service;
34         this.soapAction = soapAction;
35     }
36
37     public SOAPRequest(SCPDServiceType service, String soapAction, Map<String, String> arguments) {
38         this.service = service;
39         this.soapAction = soapAction;
40         this.arguments = arguments;
41     }
42
43     @Override
44     public boolean equals(@Nullable Object o) {
45         if (this == o) {
46             return true;
47         }
48         if (o == null || getClass() != o.getClass()) {
49             return false;
50         }
51
52         SOAPRequest that = (SOAPRequest) o;
53
54         if (!service.equals(that.service)) {
55             return false;
56         }
57         if (!soapAction.equals(that.soapAction)) {
58             return false;
59         }
60         return arguments.equals(that.arguments);
61     }
62
63     @Override
64     public int hashCode() {
65         int result = service.hashCode();
66         result = 31 * result + soapAction.hashCode();
67         result = 31 * result + arguments.hashCode();
68         return result;
69     }
70
71     @Override
72     public String toString() {
73         return "SOAPRequest{" + "service=" + service + ", soapAction='" + soapAction + '\'' + ", arguments=" + arguments
74                 + '}';
75     }
76 }