2 * Copyright (c) 2010-2023 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.semsportal.internal.dto;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.eclipse.jdt.annotation.Nullable;
19 * The base response contains the generic properties of each response from the portal. Depending on the request, the
20 * data component contains different information. The subclasses of the BaseResponse contain the mapping of the data
21 * with respect to their request context.
23 * @author Iwan Bron - Initial contribution
26 public class BaseResponse {
27 public static final String OK = "0";
29 public static final String NO_SESSION = "100001";
30 public static final String SESSION_EXPIRED = "100002";
31 public static final String INVALID = "100005";
32 public static final String EXCEPTION = "innerexception";
34 private @Nullable String code;
35 private @Nullable String msg;
37 public @Nullable String getCode() {
41 public @Nullable String getMsg() {
45 public boolean isOk() {
46 return OK.equals(code);
49 public boolean isError() {
50 return EXCEPTION.equals(code);
53 public boolean isSessionInvalid() {
54 return NO_SESSION.equals(code) || SESSION_EXPIRED.equals(code);