RFQStyleWrapper.java
package com.tradecloud.domain.model.requestforquote;
import com.tradecloud.domain.place.FinalDestination;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
public class RFQStyleWrapper extends StockLevelRow {
private RFQStyle stockLevelStyle;
private Map<RFQRegion, List<RFQProduct>> productsByRegion = new LinkedHashMap<>();
public RFQStyleWrapper(RFQStyle stockLevelStyle) {
this.stockLevelStyle = stockLevelStyle;
}
@Override
public Map<GeneratedColumns, BigDecimal> getColumnValueMap() {
return stockLevelStyle.getColumnValueMap();
}
@Override
public Integer getColumn(GeneratedColumns column) {
return stockLevelStyle.getColumn(column);
}
@Override
public String getCode() {
return stockLevelStyle.getCode();
}
@Override
public String getDescription() {
return stockLevelStyle.getDescription();
}
public GeneratedColumns getAverageUsed() {
return stockLevelStyle.getAverageUsed();
}
public void addProduct(RFQProduct product) {
productsByRegion.computeIfAbsent(product.getRfqRegion(), k -> new ArrayList<>()).add(product);
}
public Map<RFQRegion, List<RFQProduct>> getProductsByRegion() {
return productsByRegion;
}
public List<RFQProduct> getStockLevelStyleProducts() {
List<RFQProduct> allProducts = new ArrayList<>();
productsByRegion.values().forEach(allProducts::addAll);
return allProducts;
}
public String getStyle() {
return stockLevelStyle.getStyle();
}
public Integer getOriginalQuantity() {
return stockLevelStyle.getOriginalQuantity();
}
public void setOriginalQuantity(Integer originalQuantity) {
this.stockLevelStyle.setOriginalQuantity(originalQuantity);
}
public String getReason() {
return stockLevelStyle.getReason();
}
public void setReason(String reason) {
this.stockLevelStyle.setReason(reason);
}
public Integer getRfqQuantity() {
return stockLevelStyle.getRfqQuantity();
}
public void setRfqQuantity(Integer rfqQuantity) {
this.stockLevelStyle.setRfqQuantity(rfqQuantity);
}
@Override
public void setBranchQuantity(Integer branchQuantity) {
this.stockLevelStyle.setBranchQuantity(branchQuantity);
}
public Integer getBranchQuantity() {
return this.stockLevelStyle.getBranchQuantity();
}
public FinalDestination getFinalDestination() {
return null;
}
public boolean isProduct() {
return false;
}
public Long getId() {
return stockLevelStyle.getId();
}
@Override
public boolean isRegion(){
return false;
}
@Override
public boolean isStyleLevel() {
return true;
}
}