TransportUnitReservation.java
/*
* Copyright 2005-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.openwms.wms.inventory;
import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
import jakarta.persistence.ForeignKey;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Table;
import org.ameba.integration.jpa.ApplicationEntity;
import org.ameba.integration.jpa.BaseEntity;
import org.hibernate.envers.AuditOverride;
import org.hibernate.envers.Audited;
import org.hibernate.envers.NotAudited;
import org.openwms.wms.transport.TransportUnit;
import java.io.Serializable;
import java.util.Objects;
/**
* A TransportUnitReservation.
*
* @author Heiko Scherrer
*/
@Audited
@AuditOverride(forClass = ApplicationEntity.class)
@AuditOverride(forClass = BaseEntity.class)
@Entity
@Table(name = "WMS_INV_TU_RESERVATION")
public class TransportUnitReservation extends AbstractReservation implements Serializable {
/** The {@code TransportUnit} instance, the {@code Reservation} belongs to. */
@NotAudited
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "C_TRANSPORT_UNIT_PK", referencedColumnName = "C_PK", nullable = false, foreignKey = @ForeignKey(name = "FK_TURESERVATION_PK"))
private TransportUnit transportUnit;
/** Dear JPA... */
protected TransportUnitReservation() { }
public TransportUnitReservation(TransportUnit transportUnit, String reservedBy) {
super(reservedBy);
this.transportUnit = transportUnit;
}
public TransportUnit getTransportUnit() {
return transportUnit;
}
public void setTransportUnit(TransportUnit transportUnit) {
this.transportUnit = transportUnit;
}
@Override
public String toString() {
return "TransportUnitReservation{transportUnit=" + transportUnit+"}";
}
/**
* {@inheritDoc}
*
* All fields.
*/
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof TransportUnitReservation)) return false;
if (!super.equals(o)) return false;
TransportUnitReservation that = (TransportUnitReservation) o;
return Objects.equals(transportUnit, that.transportUnit);
}
/**
* {@inheritDoc}
*
* All fields.
*/
@Override
public int hashCode() {
return Objects.hash(super.hashCode(), transportUnit);
}
}