2 * Copyright (c) 2010-2022 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.bmwconnecteddrive.internal.dto.status;
15 import org.openhab.binding.bmwconnecteddrive.internal.utils.Constants;
16 import org.openhab.binding.bmwconnecteddrive.internal.utils.Converter;
19 * The {@link CBSMessage} Data Transfer Object
21 * @author Bernd Weymann - Initial contribution
23 public class CBSMessage {
24 public String cbsType;// ": "BRAKE_FLUID",
25 public String cbsState;// ": "OK",
26 public String cbsDueDate;// ": "2021-11",
27 public String cbsDescription;// ": "Next change due at the latest by the stated date."
28 public int cbsRemainingMileage = -1; // 46000
30 public String cbsTypeConverted = null;
31 public String cbsDescriptionConverted = null;
33 public String getDueDate() {
34 if (cbsDueDate == null) {
35 return Constants.NULL_DATE;
37 return cbsDueDate + Constants.UTC_APPENDIX;
41 public String getType() {
42 if (cbsTypeConverted == null) {
43 if (cbsType == null) {
44 cbsTypeConverted = Constants.INVALID;
46 cbsTypeConverted = Converter.toTitleCase(cbsType);
49 return cbsTypeConverted;
52 public String getDescription() {
53 if (cbsDescriptionConverted == null) {
54 if (cbsDescription == null) {
55 cbsDescriptionConverted = Constants.INVALID;
57 cbsDescriptionConverted = cbsDescription;
60 return cbsDescriptionConverted;
64 public String toString() {
65 return new StringBuilder(cbsDueDate).append(Constants.HYPHEN).append(cbsRemainingMileage)
66 .append(Constants.HYPHEN).append(cbsType).toString();