2 * Copyright (c) 2010-2021 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
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
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.helios.internal.ws.soap;
15 import javax.xml.bind.annotation.XmlElement;
16 import javax.xml.bind.annotation.adapters.XmlAdapter;
19 * The {@link SOAPDataFieldAdapter} is a helper class that is used to
20 * unmarshal some 'variable' SOAP messages
22 * @author Karel Goderis - Initial contribution
24 public class SOAPDataFieldAdapter extends XmlAdapter<SOAPDataFieldAdapter.AdaptedHeliosDataField, SOAPDataField> {
26 public static class AdaptedHeliosDataField {
32 public String Direction;
48 public AdaptedHeliosDataField marshal(SOAPDataField arg0) throws Exception {
53 public SOAPDataField unmarshal(AdaptedHeliosDataField arg0) throws Exception {
57 if (null != arg0.Card && null != arg0.Valid) {
58 SOAPCardEntered heliosCardEntered = new SOAPCardEntered();
59 heliosCardEntered.setCard(arg0.Card);
60 heliosCardEntered.setValid(arg0.Valid);
61 return heliosCardEntered;
63 if (null != arg0.Code && null != arg0.Valid) {
64 SOAPCodeEntered heliosCodeEntered = new SOAPCodeEntered();
65 heliosCodeEntered.setCode(arg0.Code);
66 heliosCodeEntered.setValid(arg0.Valid);
67 return heliosCodeEntered;
69 if (null != arg0.Key) {
70 SOAPKeyPressed heliosKeyPressed = new SOAPKeyPressed();
71 heliosKeyPressed.setKeyCode(arg0.Key);
72 return heliosKeyPressed;
74 if (null != arg0.State && null != arg0.Direction) {
75 SOAPCallStateChanged heliosCallStateChanged = new SOAPCallStateChanged();
76 heliosCallStateChanged.setState(arg0.State);
77 heliosCallStateChanged.setDirection(arg0.Direction);
78 return heliosCallStateChanged;
80 if (null != arg0.State) {
81 SOAPDeviceState heliosDeviceState = new SOAPDeviceState();
82 heliosDeviceState.setState(arg0.State);
83 return heliosDeviceState;