Package org.qi4j.sample.dcicargo.sample_a.data.shipping.itinerary

Examples of org.qi4j.sample.dcicargo.sample_a.data.shipping.itinerary.Itinerary


                }

                // The returned result is then translated back into our domain model.
                for( TransitPath transitPath : transitPaths )
                {
                    final Itinerary itinerary = toItinerary( transitPath );

                    // Use the specification to safe-guard against invalid itineraries
                    // We can use the side-effects free method of the RouteSpecification data object
                    if( routeSpecification.isSatisfiedBy( itinerary ) )
                    {
View Full Code Here


    @Test
    public void deviation_2d_UnsatisfyingItinerary_wrongOrigin() throws Exception
    {
        deviation_2c_ItineraryIsUnknown_buildFromNonRoutedCargo();

        Itinerary itinerary = itinerary(
            leg( V100S, HONGKONG, NEWYORK, day( 1 ), day( 8 ) ),
            leg( V200T, NEWYORK, DALLAS, day( 9 ), day( 12 ) ),
            leg( V300A, DALLAS, STOCKHOLM, day( 13 ), day( 16 ) )
        );

        // Hangzhou not in itinerary first leg
        RouteSpecification routeSpec = routeSpecification( HANGZHOU, STOCKHOLM, day( 20 ) );
        cargo.itinerary().set( itinerary );
        cargo.routeSpecification().set( routeSpec );
        Delivery delivery = new BuildDeliverySnapshot( cargo ).get();

        // Route specification not satisfied by itinerary
        assertThat( itinerary.firstLeg().loadLocation().get(), is( not( equalTo( routeSpec.origin().get() ) ) ) );
        assertThat( delivery.routingStatus().get(), is( equalTo( RoutingStatus.MISROUTED ) ) );
    }
View Full Code Here

        V100S = uow.get( Voyage.class, "V100S" );
        V200T = uow.get( Voyage.class, "V200T" );
        V300A = uow.get( Voyage.class, "V300A" );
        trackingId = new BookNewCargo( CARGOS, HONGKONG, STOCKHOLM, day( 17 ) ).createCargo( "ABC" );
        cargo = uow.get( Cargo.class, trackingId.id().get() );
        Itinerary itinerary = itinerary(
              leg( V100S, HONGKONG, NEWYORK, day( 1 ), day( 8 ) ),
              leg( V200T, NEWYORK, DALLAS, day( 9 ), day( 12 ) ),
              leg( V300A, DALLAS, STOCKHOLM, day( 13 ),
                   arrival = day( 16 ) )
        );
View Full Code Here

        V300A = uow.get( Voyage.class, "V300A" );

        // Create cargo
        trackingId = new BookNewCargo( CARGOS, HONGKONG, STOCKHOLM, day( 17 ) ).createCargo( "ABC" );
        cargo = uow.get( Cargo.class, trackingId.id().get() );
        Itinerary itinerary = itinerary(
            leg( V100S, HONGKONG, NEWYORK, day( 1 ), day( 8 ) ),
            leg( V200T, NEWYORK, DALLAS, day( 9 ), day( 12 ) ),
            leg( V300A, DALLAS, STOCKHOLM, day( 13 ), day( 16 ) )
        );
View Full Code Here

        List<Itinerary> routeCandidates = new BookNewCargo( cargo ).routeCandidates();

        // Get first route found
        // Would normally be found with an Itinerary id from customer selection
        Itinerary itinerary = routeCandidates.get( 0 );

        // Use case step 5 - System assigns cargo to route
        new BookNewCargo( cargo, itinerary ).assignCargoToRoute();

        assertThat( "Itinerary has been assigned to cargo.", itinerary, is( equalTo( cargo.itinerary().get() ) ) );
View Full Code Here

                    // BOOK cargo with no handling (i == 11)

                    // ROUTE
                    if( i > 11 )
                    {
                        Itinerary itinerary = new BookNewCargo( cargo ).routeCandidates().get( 0 );
                        new BookNewCargo( cargo, itinerary ).assignCargoToRoute();
                    }

                    // RECEIVE
                    if( i > 12 )
View Full Code Here

                       final IModel<Itinerary> candidateRouteModel,
                       int index
    )
    {
        super( id, candidateRouteModel );
        Itinerary itinerary = candidateRouteModel.getObject();

        IModel<String> header = Model.of( "Route candidate " + index + " - duration: " + itinerary.days() + " days." );
        add( new Label( "routeHeader", header ) );

        final FeedbackPanel routeFeedback = new FeedbackPanel( "routeFeedback" );
        add( routeFeedback.setOutputMarkupId( true ) );
View Full Code Here

TOP

Related Classes of org.qi4j.sample.dcicargo.sample_a.data.shipping.itinerary.Itinerary

Copyright © 2018 www.massapicom. 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.