NextBarcode.java

  1. /*
  2.  * Copyright 2005-2025 the original author or authors.
  3.  *
  4.  * Licensed under the Apache License, Version 2.0 (the "License");
  5.  * you may not use this file except in compliance with the License.
  6.  * You may obtain a copy of the License at
  7.  *
  8.  * http://www.apache.org/licenses/LICENSE-2.0
  9.  *
  10.  * Unless required by applicable law or agreed to in writing, software
  11.  * distributed under the License is distributed on an "AS IS" BASIS,
  12.  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13.  * See the License for the specific language governing permissions and
  14.  * limitations under the License.
  15.  */
  16. package org.openwms.common.transport.barcode;

  17. import jakarta.persistence.Column;
  18. import jakarta.persistence.Entity;
  19. import jakarta.persistence.Table;
  20. import jakarta.persistence.UniqueConstraint;
  21. import org.ameba.integration.jpa.BaseEntity;

  22. import java.io.Serializable;
  23. import java.util.Objects;

  24. /**
  25.  * A NextBarcode.
  26.  *
  27.  * @author Heiko Scherrer
  28.  */
  29. @Entity
  30. @Table(name = "COM_BARCODE", uniqueConstraints =
  31.     @UniqueConstraint(name = "UC_BARCODE_NAME", columnNames = {"C_NAME"})
  32. )
  33. public class NextBarcode extends BaseEntity implements Serializable {

  34.     /** Name of the Account. */
  35.     @Column(name = "C_NAME")
  36.     private String name;
  37.     /** Last given Barcode. */
  38.     @Column(name = "C_CURRENT", length = 40)
  39.     private String currentBarcode;

  40.     public String getName() {
  41.         return name;
  42.     }

  43.     public void setName(String name) {
  44.         this.name = name;
  45.     }

  46.     public String getCurrentBarcode() {
  47.         return currentBarcode;
  48.     }

  49.     public void setCurrentBarcode(String currentBarcode) {
  50.         this.currentBarcode = currentBarcode;
  51.     }

  52.     @Override
  53.     public boolean equals(Object o) {
  54.         if (this == o) return true;
  55.         if (o == null || getClass() != o.getClass()) return false;
  56.         NextBarcode that = (NextBarcode) o;
  57.         return Objects.equals(name, that.name) &&
  58.                 Objects.equals(currentBarcode, that.currentBarcode);
  59.     }

  60.     @Override
  61.     public int hashCode() {
  62.         return Objects.hash(name, currentBarcode);
  63.     }

  64.     @Override
  65.     public String toString() {
  66.         return currentBarcode;
  67.     }
  68. }