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

Examples of org.qi4j.sample.dcicargo.sample_b.data.structure.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


                    // ROUTE
                    if( i > 11 )
                    {
                        final List<Itinerary> routes = routingService.fetchRoutesForSpecification( routeSpec );
                        final Itinerary itinerary = routes.get( 0 );
                        new AssignCargoToRoute( cargo, itinerary ).assign();
                    }

                    // MISROUTE: Route specification not satisfied with itinerary
                    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 ).setEscapeModelStrings( true ) );

        IModel<List<Leg>> legListModel = new LoadableDetachableModel<List<Leg>>()
        {
            @Override
            protected List<Leg> load()
            {
                return candidateRouteModel.getObject().legs().get();
            }
        };

        add( new ListView<Leg>( "legs", legListModel )
        {
            @Override
            protected void populateItem( ListItem<Leg> item )
            {
                Leg leg = item.getModelObject();
                item.add( new Label( "voyage", leg.voyage().get().toString() ),
                          new Label( "loadLocation", leg.loadLocation().get().getCode() ),
                          new Label( "loadTime", new Model<Date>( leg.loadTime().get() ) ),
                          new Label( "unloadLocation", leg.unloadLocation().get().getCode() ),
                          new Label( "unloadTime", new Model<Date>( leg.unloadTime().get() ) )
                );
            }
        } );

        StatelessForm form = new StatelessForm<Void>( "form" );
        form.add( new AjaxFallbackButton( "assign", form )
        {
            @Override
            protected void onSubmit( AjaxRequestTarget target, Form<?> form )
            {
                try
                {
                    Itinerary itinerary = candidateRouteModel.getObject();
                    new AssignCargoToRoute( trackingIdString, itinerary ).assign();
                    setResponsePage( CargoDetailsPage.class, new PageParameters().set( 0, trackingIdString ) );
                }
                catch( Exception e )
                {
View Full Code Here

TOP

Related Classes of org.qi4j.sample.dcicargo.sample_b.data.structure.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.