TRANSACTION_EXCHANGE_LANE_SELECTOR_INTERCEPTOR
Description: Limited to code that customizes the selection of the appointed exchange lane when the gate transaction is submitted. The appointed exchange lane represents:
The exact exchange lane in an exchange area that aligns with the same row in the automated yard crane block that the container will be received to or delivered from.
The exchange lane that an OTR is expected to go to for a transaction that requires a container to be received from or delivered to an automated yard crane block. The Appointed Exchange Lane field aligns with the same row that the container will be received to or delivered from.
By default, the Appointed Exchange Lane field has a value of null. N4 sets this value when a transaction requires the OTR to go to an automated yard crane that has exchange areas (Transfer Zone – Transtainer yard block) that run alongside the rows of the block. Both the gate callup stage and the business task RejectWrongExchangeLane rely on this value.
Abstract Base Class: AbstractTransactionExchangeLaneSelectorInterceptor
Method: executeExchangeLaneSelector
Interface:ETransactionExchangeLaneSelectorInterceptor
Module: Gate
Version Added: 3.1
Requires Code Extension Name or Name Pattern: No, but you should only enable one code extension of this type. If more than one is enabled, the gate call-up process picks the first one in the loop and executes it.
Code Extension Name or Name Pattern: None
Where to specify code extensions of this type: Not needed. N4 automatically searches for a code extension of this type.
System-Seeded Code Extensions Using this Type: None
Code Example
The following sample code implements a code extension of type TRANSACTION_EXCHANGE_LANE_SELECTOR_INTERCEPTOR to customize the selection of the appointed exchange lane when the gate transaction is submitted. It overrides the method executeExchangeLaneSelector().
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.io.Serializable;
import com.navis.argo.business.model.ExchangeArea;
import com.navis.argo.business.model.ExchangeLane;
import com.navis.argo.business.model.IYardPosition;
import com.navis.argo.business.model.Yard;
import com.navis.external.framework.AbstractExtensionCallback;
import com.navis.framework.business.atoms.LifeCycleStateEnum;
import com.navis.framework.util.internationalization.UserMessage;
import com.navis.framework.util.message.MessageLevel;
import com.navis.road.extension.exchangelane.ExchangeLaneSelectorExtensionContext;
import com.navis.road.extension.exchangelane.ExchangeLaneSelectorExtensionResponse;
public class MyAbstractTransactionExchangeLaneSelectorInterceptor extends AbstractTransactionExchangeLaneSelectorInterceptor {
@Override
public void executeExchangeLaneSelector(ExchangeLaneSelectorExtensionContext inContext, ExchangeLaneSelectorExtensionResponse inResponse) {
ExchangeLane selectedExchangeLane = null;
Map map = inContext.getParameters();
Serializable yardGkey = (Serializable) map.get(ETransactionExchangeLaneSelectorInterceptor.YARD_GKEY);
Yard theYard = Yard.hydrate(yardGkey);
IYardPosition yardPosition = (IYardPosition) map.get(ETransactionExchangeLaneSelectorInterceptor.CNTR_YARD_POSITION);
String exchangeAreaId = (String) map.get(ETransactionExchangeLaneSelectorInterceptor.EXCHANGE_AREA_ID);
if(theYard != null) {
//get the exchangeArea that is returned in the XPS response
ExchangeArea theExchangeArea = ExchangeArea.findById(exchangeAreaId, theYard, null);
//get the row of the container's block position
String rowName = yardPosition.getRow();
//Select the exchange lane in the exchange area that is adjacent to the container's
//yard position. The exchange lane will have the same row name as the container's full yard position
//Example: yard position M27F35.A --> (Block M27, row F, col 35, tier .A) So, we will select the row that is named "F".
List<ExchangeLane> orderedExchangeLanes = theExchangeArea.getOrderedLanes();
for (ExchangeLane aLane : orderedExchangeLanes) {
if (LifeCycleStateEnum.ACTIVE.equals(aLane.getLifeCycleState()) && aLane.getLaneId().endsWith(rowName)) {
selectedExchangeLane = aLane;
break;
}
}
}
inResponse.setSelectedExchangeLane(selectedExchangeLane);
}
}