AllocationRule.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.allocation.spi;
import jakarta.validation.constraints.NotNull;
import org.openwms.core.units.api.Measurable;
import org.openwms.wms.inventory.Product;
import org.springframework.util.Assert;
import java.io.Serializable;
import java.util.List;
/**
* An AllocationRule encapsulates the demanded amount of {@link Product} items.
*
* @author Heiko Scherrer
*/
public class AllocationRule implements Serializable {
@NotNull
private final Measurable quantity;
@NotNull
private final Product product;
private final List<String> sourceLocationGroupNames;
/**
* Create a new AllocationRule.
*
* @param quantity The amount of Product items - non-nullable
* @param product The demanded Product - non-nullable
* @param sourceLocationGroupNames List of LocationGroup names where to search material in
*/
public AllocationRule(Measurable quantity, Product product, List<String> sourceLocationGroupNames) {
super();
Assert.notNull(quantity, "Quantity must not be null");
Assert.notNull(product, "Product must not be null");
this.quantity = quantity;
this.product = product;
this.sourceLocationGroupNames = sourceLocationGroupNames;
}
/**
* Get the quantity.
*
* @return the quantity.
*/
public Measurable getQuantity() {
return quantity;
}
/**
* Get the product.
*
* @return the product.
*/
public Product getProduct() {
return product;
}
/**
* Get the names of LocationGroups where to search for the material.
*
* @return List of names
*/
public List<String> getSourceLocationGroupNames() {
return sourceLocationGroupNames;
}
}