Package org.qi4j.sample.dcicargo.sample_b.data.structure.delivery

Examples of org.qi4j.sample.dcicargo.sample_b.data.structure.delivery.Delivery


                RouteSpecification routeSpec = cargo.routeSpecification().get();
                String destination = routeSpec.destination().get().getCode();
                Date deadline = routeSpec.arrivalDeadline().get();

                // Routing status
                Delivery delivery = cargo.delivery().get();
                RoutingStatus routingStatus = cargo.delivery().get().routingStatus().get();
                boolean isMisrouted = routingStatus == RoutingStatus.MISROUTED;

                // Transport status
                TransportStatus transportStatus = delivery.transportStatus().get();
                boolean isHiJacked = transportStatus.equals( UNKNOWN );

                // Delivery status
                boolean isMisdirected = delivery.isMisdirected().get();
                HandlingEvent event = delivery.lastHandlingEvent().get();
                boolean inCustoms = event != null && event.handlingEventType().get() == CUSTOMS;

                // Output

                item.add( new LinkPanel( "trackingId", CargoDetailsPage.class, trackingId ) );
View Full Code Here


    {
        super( new PageParameters().set( 0, trackingId ) );

        IModel<CargoDTO> cargoModel = new CommonQueries().cargo( trackingId );
        CargoDTO cargo = cargoModel.getObject();
        Delivery delivery = cargo.delivery().get();
        TransportStatus transportStatus = delivery.transportStatus().get();
        RouteSpecification routeSpecification = cargo.routeSpecification().get();
        final RoutingStatus routingStatus = delivery.routingStatus().get();
        boolean isMisrouted = routingStatus == MISROUTED;
        boolean isReRouted = !cargo.origin().get().getCode().equals( routeSpecification.origin().get().getCode() );

        add( new PrevNext( "prevNext", CargoDetailsPage.class, trackingId ) );

        add( new Label( "trackingId", trackingId ) );

        // Show both cargo origin and new route spec origin when re-routed during transport
        if( isReRouted )
        {
            Fragment originFragment = new Fragment( "origin", "re-routed-originFragment", this );
            originFragment.add( new Label( "cargoOrigin", cargo.origin().get().getString() ) );
            originFragment.add( new Label( "routeOrigin", routeSpecification.origin()
                .get()
                .getString() ).add( new CorrectColor( isMisrouted ) ) );
            add( originFragment );
        }
        else
        {
            Fragment originFragment = new Fragment( "origin", "originFragment", this );
            originFragment.add( new Label( "cargoOrigin", cargo.origin().get().getString() ) );
            add( originFragment );
        }

        add( new Label( "departure", Model.of( routeSpecification.earliestDeparture().get() ) ) );
        add( new Label( "destination", routeSpecification.destination()
            .get()
            .getString() ).add( new CorrectColor( isMisrouted ) ) );
        add( new Label( "deadline", Model.of( routeSpecification.arrivalDeadline().get() ) ) );
        add( new Label( "routingStatus", routingStatus.toString() ).add( new ErrorColor( isMisrouted ) ) );
        add( new LinkPanel( "changeDestination", ChangeDestinationPage.class, trackingId, "Change destination" ) );

        if( transportStatus.equals( CLAIMED ) )
        {
            // Can't re-route claimed cargo
            add( new Label( "routingAction" ) );
            add( new DeliveryFragment( delivery ) );
            add( new ItineraryFragment( cargoModel, routingStatus ) );
        }
        else if( routingStatus.equals( NOT_ROUTED ) )
        {
            add( new LinkPanel( "routingAction", RouteCargoPage.class, trackingId, "Route" ) );
            add( new Label( "delivery" ) );
            add( new Label( "itinerary" ) );
        }
        else
        {
            add( new LinkPanel( "routingAction", ReRouteCargoPage.class, trackingId, "Re-route" ) );
            add( new DeliveryFragment( delivery ) );
            add( new ItineraryFragment( cargoModel, routingStatus ) );
        }

        if( delivery.lastHandlingEvent().get() == null )
        {
            add( new Label( "handlingHistoryPanel" ) );
        }
        else
        {
View Full Code Here

        UnitOfWork uow = module.currentUnitOfWork();
        CARGOS = uow.get( CargoAggregateRoot.class, CargoAggregateRoot.CARGOS_ID );
        HANDLING_EVENTS = uow.get( HandlingEventAggregateRoot.class, HandlingEventAggregateRoot.HANDLING_EVENTS_ID );
        // Create new cargo
        RouteSpecification routeSpec = routeSpecFactory.build( HONGKONG, STOCKHOLM, TODAY, deadline = DAY24 );
        Delivery delivery = delivery( TODAY, IN_PORT, ROUTED, leg1 );
        cargo = CARGOS.createCargo( routeSpec, delivery, "Loaded_CARGO" );
        trackingId = cargo.trackingId().get();
//        delivery = cargo.delivery().get();
    }
View Full Code Here

TOP

Related Classes of org.qi4j.sample.dcicargo.sample_b.data.structure.delivery.Delivery

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.