Package org.qi4j.sample.dcicargo.sample_b.data.factory.exception

Examples of org.qi4j.sample.dcicargo.sample_b.data.factory.exception.CannotCreateRouteSpecificationException


        public RouteSpecification build( Location origin, Location destination, Date earliestDeparture, Date deadline )
            throws CannotCreateRouteSpecificationException
        {
            if( origin == destination )
            {
                throw new CannotCreateRouteSpecificationException( "Origin location can't be same as destination location." );
            }

            Date endOfToday = new DateMidnight().plusDays( 1 ).toDate();
            if( deadline.before( endOfToday ) )
            {
                throw new CannotCreateRouteSpecificationException( "Arrival deadline is in the past or Today." +
                                                                   "\nDeadline           " + deadline +
                                                                   "\nToday (midnight)   " + endOfToday );
            }

            if( deadline.before( earliestDeparture ) )
            {
                throw new CannotCreateRouteSpecificationException( "Deadline can't be before departure:" +
                                                                   "\nDeparture   " + earliestDeparture +
                                                                   "\nDeadline    " + deadline );
            }

            ValueBuilder<RouteSpecification> routeSpec = vbf.newValueBuilder( RouteSpecification.class );
View Full Code Here


        throws CannotCreateRouteSpecificationException, UnexpectedCarrierException
    {
        // Pre-conditions
        if( transportStatus.equals( CLAIMED ) )
        {
            throw new CannotCreateRouteSpecificationException( "Can't derive new route specification for a claimed cargo." );
        }

        return cargoInspector.getUpdatedRouteSpecification();
    }
View Full Code Here

TOP

Related Classes of org.qi4j.sample.dcicargo.sample_b.data.factory.exception.CannotCreateRouteSpecificationException

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.