Examples of RegisterHandlingEvent


Examples of org.qi4j.sample.dcicargo.sample_a.context.shipping.handling.RegisterHandlingEvent

                    if( i > 12 )
                    {
                        nextEvent = cargo.delivery().get().nextExpectedHandlingEvent().get();
                        port = nextEvent.location().get().getCode();
                        Date mockTime = new Date();
                        new RegisterHandlingEvent( mockTime, mockTime, trackingId, "RECEIVE", port, null ).register();
                    }

                    // LOAD
                    if( i > 13 )
                    {
                        nextEvent = cargo.delivery().get().nextExpectedHandlingEvent().get();
                        time = nextEvent.time().get();
                        port = nextEvent.location().get().getCode();
                        voyage = nextEvent.voyage().get().voyageNumber().get().number().get();
                        new RegisterHandlingEvent( time, time, trackingId, "LOAD", port, voyage ).register();
                    }

                    // UNLOAD
                    if( i > 14 )
                    {
                        nextEvent = cargo.delivery().get().nextExpectedHandlingEvent().get();
                        time = nextEvent.time().get();
                        port = nextEvent.location().get().getCode();
                        voyage = nextEvent.voyage().get().voyageNumber().get().number().get();
                        new RegisterHandlingEvent( time, time, trackingId, "UNLOAD", port, voyage ).register();
                    }

                    // Cargo is now in port
                    nextEvent = cargo.delivery().get().nextExpectedHandlingEvent().get();
                    time = nextEvent.time().get();
                    port = nextEvent.location().get().getCode();
                    type = nextEvent.handlingEventType().get();

                    // MISDIRECTED: Unexpected customs handling before reaching destination
                    if( i == 16 )
                    {
                        new RegisterHandlingEvent( time, time, trackingId, "CUSTOMS", port, null ).register();
                    }

                    // MISDIRECTED: Unexpected claim before reaching destination
                    if( i == 17 )
                    {
                        new RegisterHandlingEvent( time, time, trackingId, "CLAIM", port, null ).register();
                    }

                    // MISDIRECTED: LOAD in wrong port
                    if( i == 18 )
                    {
                        String wrongPort = port.equals( "USDAL" ) ? "USCHI" : "USDAL";
                        voyage = nextEvent.voyage().get().voyageNumber().get().number().get();
                        new RegisterHandlingEvent( time, time, trackingId, "LOAD", wrongPort, voyage ).register();
                    }

                    // MISDIRECTED: LOAD onto wrong carrier
                    if( i == 19 )
                    {
                        voyage = nextEvent.voyage().get().voyageNumber().get().number().get();
                        String wrongVoyage = voyage.equals( "V100S" ) ? "V200T" : "V100S";
                        new RegisterHandlingEvent( time, time, trackingId, "LOAD", port, wrongVoyage ).register();
                    }

                    // MISDIRECTED: LOAD onto wrong carrier in wrong port
                    if( i == 20 )
                    {
                        String wrongPort = port.equals( "USDAL" ) ? "USCHI" : "USDAL";
                        voyage = nextEvent.voyage().get().voyageNumber().get().number().get();
                        String wrongVoyage = voyage.equals( "V100S" ) ? "V200T" : "V100S";
                        new RegisterHandlingEvent( time, time, trackingId, "LOAD", wrongPort, wrongVoyage ).register();
                    }

                    // MISDIRECTED: UNLOAD in wrong port
                    if( i == 21 )
                    {
                        String wrongPort = port.equals( "USDAL" ) ? "USCHI" : "USDAL";
                        voyage = nextEvent.voyage().get().voyageNumber().get().number().get();
                        new RegisterHandlingEvent( time, time, trackingId, "UNLOAD", wrongPort, voyage ).register();
                    }

                    // MISDIRECTED: UNLOAD from wrong carrier
                    if( i == 22 )
                    {
                        voyage = nextEvent.voyage().get().voyageNumber().get().number().get();
                        String wrongVoyage = voyage.equals( "V100S" ) ? "V200T" : "V100S";
                        new RegisterHandlingEvent( time, time, trackingId, "UNLOAD", port, wrongVoyage ).register();
                    }

                    // MISDIRECTED: UNLOAD from wrong carrier in wrong port
                    if( i == 23 )
                    {
                        String wrongPort = port.equals( "USDAL" ) ? "USCHI" : "USDAL";
                        voyage = nextEvent.voyage().get().voyageNumber().get().number().get();
                        String wrongVoyage = voyage.equals( "V100S" ) ? "V200T" : "V100S";
                        new RegisterHandlingEvent( time, time, trackingId, "UNLOAD", wrongPort, wrongVoyage ).register();
                    }

                    // Complete all LOAD/UNLOADS
                    if( i > 23 )
                    {
                        do
                        {
                            voyage = nextEvent.voyage().get().voyageNumber().get().number().get();
                            new RegisterHandlingEvent( time, time, trackingId, type.name(), port, voyage ).register();

                            nextEvent = cargo.delivery().get().nextExpectedHandlingEvent().get();
                            time = nextEvent.time().get();
                            port = nextEvent.location().get().getCode();
                            type = nextEvent.handlingEventType().get();
                        }
                        while( type != HandlingEventType.CLAIM );
                    }

                    // CLAIM at destination - this ends the life cycle of the cargo delivery
                    if( i == 25 )
                    {
                        new RegisterHandlingEvent( time, time, trackingId, "CLAIM", port, null ).register();
                    }

                    // Add more cases if needed...

                    i++;
View Full Code Here

Examples of org.qi4j.sample.dcicargo.sample_a.context.shipping.handling.RegisterHandlingEvent

                        {
                            throw new Exception( "Can't re-submit the same data." );
                        }

                        // Perform use case
                        new RegisterHandlingEvent(
                            new Date(), completion, trackingId, eventType, unLocode, voyageNumber ).register();

                        // We could redirect to Details, but it's more fun to update details in a separate
                        // window to follow the successive handling event registrations you make...
//                        setResponsePage( CargoDetails.class, new PageParameters().set( 0, trackingId ) );
View Full Code Here

Examples of org.qi4j.sample.dcicargo.sample_b.context.interaction.handling.registration.RegisterHandlingEvent

        public void register( ParsedHandlingEventData parsedHandlingEventData )
            throws ProcessHandlingEventException
        {
            try
            {
                HandlingEvent handlingEvent = new RegisterHandlingEvent( parsedHandlingEventData ).getEvent();
                logger.debug( "Registered handling event" );

                inspect( handlingEvent );
            }
            catch( CannotRegisterHandlingEventException e )
View Full Code Here

Examples of org.qi4j.sample.dcicargo.sample_b.context.interaction.handling.registration.RegisterHandlingEvent

    public void deviation_1a_UnknownCargo()
        throws Exception
    {
        parsedEventData = parsedHandlingEventData( DAY1, DAY1, "XXX", RECEIVE, "CNHKG", null );
        thrown.expect( UnknownCargoException.class, "Found no cargo with tracking id 'XXX'." );
        handlingEvent = new RegisterHandlingEvent( parsedEventData ).getEvent();
    }
View Full Code Here

Examples of org.qi4j.sample.dcicargo.sample_b.context.interaction.handling.registration.RegisterHandlingEvent

    {
        deviation_1a_UnknownCargo();

        parsedEventData = parsedHandlingEventData( DAY1, DAY1, "ABC", RECEIVE, "ZZZZZ", null );
        thrown.expect( UnknownLocationException.class, "Found no location with UN locode 'ZZZZZ'." );
        handlingEvent = new RegisterHandlingEvent( parsedEventData ).getEvent();
    }
View Full Code Here

Examples of org.qi4j.sample.dcicargo.sample_b.context.interaction.handling.registration.RegisterHandlingEvent

        throws Exception
    {
        deviation_2a_UnknownUnlocode();

        parsedEventData = parsedHandlingEventData( DAY1, DAY1, "ABC", RECEIVE, "CNHKG", "V201" );
        handlingEvent = new RegisterHandlingEvent( parsedEventData ).getEvent();
    }
View Full Code Here

Examples of org.qi4j.sample.dcicargo.sample_b.context.interaction.handling.registration.RegisterHandlingEvent

    {
        deviation_3a_VoyageNumber_SilentlySkipIfNotRequired();

        parsedEventData = parsedHandlingEventData( DAY1, DAY1, "ABC", LOAD, "CNHKG", null );
        thrown.expect( MissingVoyageNumberException.class, "Missing voyage number. Handling event LOAD requires a voyage." );
        handlingEvent = new RegisterHandlingEvent( parsedEventData ).getEvent();
    }
View Full Code Here

Examples of org.qi4j.sample.dcicargo.sample_b.context.interaction.handling.registration.RegisterHandlingEvent

    {
        deviation_3b_VoyageNumber_Missing();

        parsedEventData = parsedHandlingEventData( DAY1, DAY1, "ABC", LOAD, "CNHKG", "V600S" );
        thrown.expect( UnknownVoyageException.class, "Found no voyage with voyage number 'V600S'." );
        handlingEvent = new RegisterHandlingEvent( parsedEventData ).getEvent();
    }
View Full Code Here

Examples of org.qi4j.sample.dcicargo.sample_b.context.interaction.handling.registration.RegisterHandlingEvent

        tempUow.complete();

        // Receive 2nd time
        parsedEventData = parsedHandlingEventData( DAY2, DAY2, "ABC", RECEIVE, "CNHKG", null );
        thrown.expect( DuplicateEventException.class, "Cargo can't be received more than once" );
        handlingEvent = new RegisterHandlingEvent( parsedEventData ).getEvent();
    }
View Full Code Here

Examples of org.qi4j.sample.dcicargo.sample_b.context.interaction.handling.registration.RegisterHandlingEvent

        tempUow.complete();

        // In customs 2nd time
        parsedEventData = parsedHandlingEventData( DAY2, DAY2, "ABC", CUSTOMS, "CNHKG", null );
        thrown.expect( DuplicateEventException.class, "Cargo can't be in customs more than once" );
        handlingEvent = new RegisterHandlingEvent( parsedEventData ).getEvent();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.