Example 61 : Debugging allocations
This example shows how to see why a particular service was not selected.
package com.metapack.dm.test; import com.metapack.deliverymanager.client.AllocationFilter; import com.metapack.deliverymanager.client.Consignment; import com.metapack.deliverymanager.client.DateRange; import com.metapack.deliverymanager.client.webservices.DebugService; public class Example61 extends ExampleBase { public void run() throws Exception { DebugService service = createDebugService(); Consignment consignment = createDefaultConsignment( "EXAMPLE-61" , 1 ); DateRange acceptableCollectionSlot = new DateRange( createDate( "2009-02-14T00:00:00" ) , null ); AllocationFilter filter = new AllocationFilter(); filter.setFirstCollectionOnly( true ); filter.setAcceptableCollectionSlots( new DateRange[] { acceptableCollectionSlot } ); filter.setPreFilterSortOrder1( ExampleBase.SORT_EARLIEST_COLLECTION_ASCENDING ); filter.setFilterGroup1( ExampleBase.FILTER_GROUP_SERVICE ); filter.setSortOrder1( ExampleBase.SORT_COST_CHEAPEST ); String[] messages = service.debugWhyNot( consignment , filter ); for( String message : messages ) { System.out.println( message ); } } }

