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

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


                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 ) );

                item.add( new Label( "origin", origin ) );

                item.add( new Label( "destination", destination ) );

                item.add( new Label( "deadline", new Model<Date>( deadline ) ) );

                item.add( new Label( "routingStatus", routingStatus.toString() ).add( new ErrorColor( isMisrouted ) ) );

                String customsLabel = transportStatus.name() + ( inCustoms ? " (CUSTOMS)" : "" );
                item.add( new Label( "transportStatus", customsLabel ).add( new ErrorColor( isHiJacked ) ) );

                String directed = isMisdirected ? "Misdirected" : "On track";
                item.add( new Label( "deliveryStatus", directed ).add( new ErrorColor( isMisdirected ) ) );
            }
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 ) );
View Full Code Here

TOP

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

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.