Package org.qi4j.sample.dcicargo.sample_a.communication.query.dto

Examples of org.qi4j.sample.dcicargo.sample_a.communication.query.dto.CargoDTO


        add( new ListView<CargoDTO>( "list", cargoList )
        {
            @Override
            protected void populateItem( ListItem<CargoDTO> item )
            {
                CargoDTO cargo = item.getModelObject();
                String trackingId = cargo.trackingId().get().id().get();
                Delivery delivery = cargo.delivery().get();
                RoutingStatus routingStatus = cargo.delivery().get().routingStatus().get();

                item.add( new LinkPanel( "trackingId", CargoDetailsPage.class, trackingId ) );

                item.add( new Label( "origin", cargo.origin().get().getCode() ) );

                item.add( new Label( "destination", cargo.routeSpecification().get().destination().get().getCode() ) );

                item.add( new Label( "deadline", new Model<Date>( cargo.routeSpecification()
                                                                      .get()
                                                                      .arrivalDeadline()
                                                                      .get() ) ) );

                item.add( new Label( "routingStatus", routingStatus.toString() ).add( new ErrorColor( routingStatus == RoutingStatus.MISROUTED ) ) );
View Full Code Here


        ValueMap map = new ValueMap();
        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" ) );
            return;
        }

        ExpectedHandlingEvent nextEvent = cargo.delivery().get().nextExpectedHandlingEvent().get();
        if( nextEvent == null )
        {
            map.put( "expectedEvent", "UNKNOWN" );
            label.add( new AttributeModifier( "class", "errorColor" ) );
            return;
View Full Code Here

        private String origin, destination, oldDestination;

        public CargoEditForm( final String trackingId )
        {
            CommonQueries fetch = new CommonQueries();
            CargoDTO cargo = fetch.cargo( trackingId ).getObject();
            List<String> locations = fetch.unLocodes();

            origin = cargo.origin().get().getCode();
            oldDestination = destination = cargo.routeSpecification().get().destination().get().getCode();

            final FeedbackPanel feedback = new FeedbackPanel( "usecaseFeedback" );
            final SelectorInForm destinationSelector = new SelectorInForm(
                "destination", "Destination", locations, this, "origin" );
            final ComponentFeedbackPanel destinationFeedback = new ComponentFeedbackPanel(
View Full Code Here

            public StatusFragment( IModel<CargoDTO> cargoModel, Boolean visible )
            {
                super( "status", "statusFragment", TrackingForm.this );
                setVisible( visible );

                CargoDTO cargo = cargoModel.getObject();

                // Status ----------------------------------------------------------------------
                ValueMap map = new ValueMap();
                map.put( "status", cargo.delivery().get().transportStatus().get().name() );
                map.put( "trackingId", trackingId );
                HandlingEvent lastEvent = cargo.delivery().get().lastHandlingEvent().get();
                if( lastEvent != null )
                {
                    String voyageString = lastEvent.voyage().get() != null ?
                                          lastEvent.voyage()
                                              .get()
                                              .voyageNumber()
                                              .get()
                                              .number()
                                              .get() : "UNKNOWN_VOYAGE";
                    map.put( "voyage", voyageString );
                    map.put( "location", lastEvent.location().get().getString() );
                }
                else
                {
                    map.put( "voyage", "UNKNOWN_VOYAGE" );
                    map.put( "location", cargo.origin().get().getString() );
                }
                add( new Label( "transportStatus", new StringResourceModel(
                    "transportStatus.${status}", this, new Model<ValueMap>( map ) ) ) );

                // ETA ----------------------------------------------------------------------
                String destination = cargo.routeSpecification().get().destination().get().getString();
                Date eta = cargo.delivery().get().eta().get();
                String etaString = eta == null ? "?" : new SimpleDateFormat( "yyyy-MM-dd" ).format( eta );
                add( new Label( "eta", new StringResourceModel(
                    "eta", this, null, Model.of( destination ), Model.of( etaString ) ) ) );

                // Warning/Notifier ----------------------------------------------------------------------
                add( new WebMarkupContainer( "isMisdirected" ).setVisible( cargo.delivery()
                                                                               .get()
                                                                               .isMisdirected()
                                                                               .get() ) );
                add( new WebMarkupContainer( "isClaimed" ).setVisible(
                    !cargo.delivery().get().isMisdirected().get()
                    && cargo.delivery().get().isUnloadedAtDestination().get()
                    && lastEvent != null
                    && lastEvent.handlingEventType().get() == HandlingEventType.CLAIM
                ) );

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

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

        IModel<CargoDTO> cargoModel = new CommonQueries().cargo( trackingId );
        CargoDTO cargo = cargoModel.getObject();
        Delivery delivery = cargo.delivery().get();
        RouteSpecification routeSpecification = cargo.routeSpecification().get();
        final RoutingStatus routingStatus = delivery.routingStatus().get();
        Boolean isMisrouted = routingStatus == RoutingStatus.MISROUTED;

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

        add( new Label( "trackingId", trackingId ) );
        add( new Label( "origin", cargo.origin().get().getString() ) );
        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 ) ) );
View Full Code Here

TOP

Related Classes of org.qi4j.sample.dcicargo.sample_a.communication.query.dto.CargoDTO

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.