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

Examples of org.qi4j.sample.dcicargo.sample_a.data.shipping.location.Location


    @Test( expected = FoundNoRoutesException.class )
    public void deviation_3a_NoRoutesCanBeThatFast() throws Exception
    {
        UnitOfWork uow = module.currentUnitOfWork();
        Location HONGKONG = uow.get( Location.class, CNHKG.code().get() );
        Location STOCKHOLM = uow.get( Location.class, SESTO.code().get() );
        Cargos CARGOS = uow.get( Cargos.class, CargosEntity.CARGOS_ID );
        TrackingId trackingId = new BookNewCargo( CARGOS, HONGKONG, STOCKHOLM, day( 1 ) ).book();
        Cargo cargo = uow.get( Cargo.class, trackingId.id().get() );

        // No routes will be found
View Full Code Here


    @Test
    public void step_3_CalculatePossibleRoutes() throws Exception
    {
        UnitOfWork uow = module.currentUnitOfWork();
        Location HONGKONG = uow.get( Location.class, CNHKG.code().get() );
        Location STOCKHOLM = uow.get( Location.class, SESTO.code().get() );
        Cargos CARGOS = uow.get( Cargos.class, CargosEntity.CARGOS_ID );

        // Create valid cargo
        TrackingId trackingId = new BookNewCargo( CARGOS, HONGKONG, STOCKHOLM, day( 30 ) ).book();
        Cargo cargo = uow.get( Cargo.class, trackingId.id().get() );
View Full Code Here

    @Test
    public void step_5_AssignCargoToRoute() throws Exception
    {
        UnitOfWork uow = module.currentUnitOfWork();
        Location HONGKONG = uow.get( Location.class, CNHKG.code().get() );
        Location STOCKHOLM = uow.get( Location.class, SESTO.code().get() );
        Cargos CARGOS = uow.get( Cargos.class, CargosEntity.CARGOS_ID );

        // Create valid cargo
        Date deadline = day( 30 );
        TrackingId trackingId = new BookNewCargo( CARGOS, HONGKONG, STOCKHOLM, deadline ).book();
View Full Code Here

                cargo.delivery().set( new BuildDeliverySnapshot( cargo ).get() );
            }

            public void changeDestination( Location newDestination )
            {
                Location currentOrigin = cargo.routeSpecification().get().origin().get();
                Date currentDeadline = cargo.routeSpecification().get().arrivalDeadline().get();

                RouteSpecification newRouteSpecification =
                    context.buildRouteSpecification( vbf, currentOrigin, newDestination, currentDeadline );
View Full Code Here

              USCHI = unlocode( "USCHI" ); // Chicago
              USDAL = unlocode( "USDAL" ); // Dallas
              USNYC = unlocode( "USNYC" ); // New York
 
              // Location entity objects
                Location MELBOURNE = location( AUMEL, "Melbourne" );
                Location HANGZHOU = location( CNHGH, "Hangzhou" );
                Location HONGKONG = location( CNHKG, "Hongkong" );
                Location SHANGHAI = location( CNSHA, "Shanghai" );
                Location HAMBURG = location( DEHAM, "Hamburg" );
                Location HELSINKI = location( FIHEL, "Helsinki" );
                Location TOKYO = location( JNTKO, "Tokyo" );
                Location ROTTERDAM = location( NLRTM, "Rotterdam" );
                Location GOTHENBURG = location( SEGOT, "Gothenburg" );
                Location STOCKHOLM = location( SESTO, "Stockholm" );
                Location CHICAGO = location( USCHI, "Chicago" );
                Location DALLAS = location( USDAL, "Dallas" );
                Location NEWYORK = location( USNYC, "New York" );

              // Voyage entity objects
                Voyage V100S = voyage( "V100S", schedule(
                  carrierMovement( NEWYORK, CHICAGO, day( 1 ), day( 2 ) ),
                  carrierMovement( CHICAGO, DALLAS, day( 8 ), day( 9 ) )
View Full Code Here

            for( Location location : allLocations )
            {
                locationList.add( location );
            }

            Location origin;
            Location destination;
            Random random = new Random();
            Date deadline;
            String uuid;
            String id;
            try
            {
                for( int i = 0; i < numberOfCargos; i++ )
                {
                    origin = locationList.get( random.nextInt( locationSize ) );

                    // Find destination different from origin
                    do
                    {
                        destination = locationList.get( random.nextInt( locationSize ) );
                    }
                    while( destination.equals( origin ) );

                    deadline = new LocalDate().plusDays( 15 + random.nextInt( 10 ) )
                        .toDateTime( new LocalTime() )
                        .toDate();
View Full Code Here

        Label label = new Label( "text", new StringResourceModel(
            "expectedEvent.${expectedEvent}", this, new Model<ValueMap>( map ) ) );
        add( label );

        CargoDTO cargo = cargoModel.getObject();
        Location destination = cargo.routeSpecification().get().destination().get();

        if( cargo.itinerary().get() == null )
        {
            map.put( "expectedEvent", "ROUTE" );
            return;
        }

        HandlingEvent previousEvent = cargo.delivery().get().lastHandlingEvent().get();
        if( previousEvent == null )
        {
            map.put( "expectedEvent", "RECEIVE" );
            map.put( "location", cargo.routeSpecification().get().origin().get().getString() );
            return;
        }

        Location lastLocation = previousEvent.location().get();
        if( previousEvent.handlingEventType().get() == HandlingEventType.CLAIM && lastLocation == destination )
        {
            map.put( "expectedEvent", "END_OF_CYCLE" );
            map.put( "location", destination.getString() );
            label.add( new AttributeModifier( "class", "correctColor" ) );
View Full Code Here

TOP

Related Classes of org.qi4j.sample.dcicargo.sample_a.data.shipping.location.Location

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.