001// -------------------------------------------------------------------------------- 002// Copyright 2002-2026 Echo Three, LLC 003// 004// Licensed under the Apache License, Version 2.0 (the "License"); 005// you may not use this file except in compliance with the License. 006// You may obtain a copy of the License at 007// 008// http://www.apache.org/licenses/LICENSE-2.0 009// 010// Unless required by applicable law or agreed to in writing, software 011// distributed under the License is distributed on an "AS IS" BASIS, 012// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013// See the License for the specific language governing permissions and 014// limitations under the License. 015// -------------------------------------------------------------------------------- 016 017package com.echothree.model.control.item.server.transfer; 018 019import javax.inject.Inject; 020 021import com.echothree.model.control.inventory.server.control.InventoryControl; 022import com.echothree.model.control.item.common.transfer.ItemKitMemberTransfer; 023import com.echothree.model.control.item.server.control.ItemControl; 024import com.echothree.model.control.uom.server.control.UomControl; 025import com.echothree.model.data.item.server.entity.ItemKitMember; 026import com.echothree.model.data.user.server.entity.UserVisit; 027import javax.enterprise.context.RequestScoped; 028 029@RequestScoped 030public class ItemKitMemberTransferCache 031 extends BaseItemTransferCache<ItemKitMember, ItemKitMemberTransfer> { 032 033 @Inject 034 InventoryControl inventoryControl; 035 036 @Inject 037 ItemControl itemControl; 038 039 @Inject 040 UomControl uomControl; 041 042 /** Creates a new instance of ItemKitMemberTransferCache */ 043 protected ItemKitMemberTransferCache() { 044 super(); 045 } 046 047 @Override 048 public ItemKitMemberTransfer getTransfer(UserVisit userVisit, ItemKitMember itemKitMember) { 049 var itemKitMemberTransfer = get(itemKitMember); 050 051 if(itemKitMemberTransfer == null) { 052 var item = itemControl.getItemTransfer(userVisit, itemKitMember.getItem()); 053 var inventoryCondition = inventoryControl.getInventoryConditionTransfer(userVisit, itemKitMember.getInventoryCondition()); 054 var unitOfMeasureType = uomControl.getUnitOfMeasureTypeTransfer(userVisit, itemKitMember.getUnitOfMeasureType()); 055 var memberItem = itemControl.getItemTransfer(userVisit, itemKitMember.getMemberItem()); 056 var memberInventoryCondition = inventoryControl.getInventoryConditionTransfer(userVisit, itemKitMember.getMemberInventoryCondition()); 057 var memberUnitOfMeasureType = uomControl.getUnitOfMeasureTypeTransfer(userVisit, itemKitMember.getMemberUnitOfMeasureType()); 058 var quantity = itemKitMember.getQuantity().toString(); 059 060 itemKitMemberTransfer = new ItemKitMemberTransfer(item, inventoryCondition, unitOfMeasureType, memberItem, memberInventoryCondition, 061 memberUnitOfMeasureType, quantity); 062 put(userVisit, itemKitMember, itemKitMemberTransfer); 063 } 064 065 return itemKitMemberTransfer; 066 } 067 068}