Package com.fasterxml.jackson.databind

Examples of com.fasterxml.jackson.databind.JsonNode.asText()


                }
            }
            if(!either_locationId_or_coord) throw new IllegalStateException("location missing. either locationId or locationCoordinate is required");
            //service name
            JsonNode nameNode = serviceNode.path(JsonConstants.Job.NAME);
            if(!nameNode.isMissingNode()) serviceBuilder.setName(nameNode.asText());
            //service duration
            serviceBuilder.setServiceTime(serviceNode.path(JsonConstants.Job.SERVICE_DURATION).asDouble());
            //service tw
            JsonNode start_tw_node = serviceNode.path(JsonConstants.Job.TIME_WINDOW).path(JsonConstants.TimeWindow.START);
            JsonNode end_tw_node = serviceNode.path(JsonConstants.Job.TIME_WINDOW).path(JsonConstants.TimeWindow.END);
View Full Code Here


        JsonNode vehicles = root.path(JsonConstants.VEHICLES);
        for(JsonNode vehicleNode : vehicles){
            //vehicle id
            JsonNode vehicle_id_node = vehicleNode.path(JsonConstants.Vehicle.ID);
            if(vehicle_id_node.isMissingNode()) throw new IllegalStateException("vehicle id missing");
            VehicleImpl.Builder vehicleBuilder = VehicleImpl.Builder.newInstance(vehicle_id_node.asText());
            //vehicle type
            VehicleType type = vehicle_type_map.get(vehicleNode.path(JsonConstants.Vehicle.TYPE_ID).asText());
            vehicleBuilder.setType(type);
            //earliest start
            JsonNode earliestStartNode = vehicleNode.path(JsonConstants.Vehicle.EARLIEST_START);
View Full Code Here

            //start
                //location id
            boolean either_id_or_coord = false;
            JsonNode startAddressId = vehicleNode.path(JsonConstants.Vehicle.START_ADDRESS).path(JsonConstants.Address.ID);
            if(!startAddressId.isMissingNode()){
                vehicleBuilder.setStartLocationId(startAddressId.asText());
                either_id_or_coord = true;
            }
                //location coordinate
            {
                JsonNode lonNode = vehicleNode.path(JsonConstants.Vehicle.START_ADDRESS).path(JsonConstants.Address.LON);
View Full Code Here

            if(!either_id_or_coord) throw new IllegalStateException("start location of vehicle missing. either id or coordinate required");
            //end
                //location id
            JsonNode endAddressId = vehicleNode.path(JsonConstants.Vehicle.END_ADDRESS).path(JsonConstants.Address.ID);
            if(!endAddressId.isMissingNode()){
                if(!startAddressId.asText().equals(endAddressId.asText())){
                    vehicleBuilder.setEndLocationId(endAddressId.asText());
                }
            }
                //location coordinate
            {
View Full Code Here

            //end
                //location id
            JsonNode endAddressId = vehicleNode.path(JsonConstants.Vehicle.END_ADDRESS).path(JsonConstants.Address.ID);
            if(!endAddressId.isMissingNode()){
                if(!startAddressId.asText().equals(endAddressId.asText())){
                    vehicleBuilder.setEndLocationId(endAddressId.asText());
                }
            }
                //location coordinate
            {
                JsonNode lonNode = vehicleNode.path(JsonConstants.Vehicle.END_ADDRESS).path(JsonConstants.Address.LON);
View Full Code Here

    private void parse_and_map_vehicle_types(JsonNode root) {
        JsonNode types = root.path(JsonConstants.VEHICLE_TYPES);
        for(JsonNode typeNode : types){
            JsonNode typeIdNode = typeNode.path(JsonConstants.Vehicle.Type.ID);
            if(typeIdNode.isMissingNode()) throw new IllegalStateException("type id missing");
            VehicleTypeImpl.Builder typeBuilder = VehicleTypeImpl.Builder.newInstance(typeIdNode.asText());
            typeBuilder.setFixedCost(typeNode.path(JsonConstants.Vehicle.Type.FIXED_COSTS).asDouble());
            typeBuilder.setCostPerDistance(typeNode.path(JsonConstants.Vehicle.Type.DISTANCE).asDouble());
            typeBuilder.setCostPerTime(typeNode.path(JsonConstants.Vehicle.Type.TIME).asDouble());
            JsonNode capacity = typeNode.path(JsonConstants.Vehicle.Type.CAPACITY);
            Iterator<JsonNode> capacity_dimension_iterator = capacity.iterator();
View Full Code Here

            //service id
            JsonNode jobIdNode = serviceNode.path(JsonConstants.Job.ID);
            if(jobIdNode.isMissingNode()) throw new IllegalStateException("service-id is missing");

            Service.Builder serviceBuilder;
            if(typeNode.isMissingNode()) serviceBuilder = Service.Builder.newInstance(jobIdNode.asText());
            else if(typeNode.asText().equals(JsonConstants.Job.SERVICE)) serviceBuilder = Service.Builder.newInstance(jobIdNode.asText());
            else if(typeNode.asText().equals(JsonConstants.Job.PICKUP)) serviceBuilder = Pickup.Builder.newInstance(jobIdNode.asText());
            else if(typeNode.asText().equals(JsonConstants.Job.DELIVERY)) serviceBuilder = Delivery.Builder.newInstance(jobIdNode.asText());
            else throw new IllegalStateException("type of service ("+typeNode.asText()+") is not supported");
View Full Code Here

            JsonNode jobIdNode = serviceNode.path(JsonConstants.Job.ID);
            if(jobIdNode.isMissingNode()) throw new IllegalStateException("service-id is missing");

            Service.Builder serviceBuilder;
            if(typeNode.isMissingNode()) serviceBuilder = Service.Builder.newInstance(jobIdNode.asText());
            else if(typeNode.asText().equals(JsonConstants.Job.SERVICE)) serviceBuilder = Service.Builder.newInstance(jobIdNode.asText());
            else if(typeNode.asText().equals(JsonConstants.Job.PICKUP)) serviceBuilder = Pickup.Builder.newInstance(jobIdNode.asText());
            else if(typeNode.asText().equals(JsonConstants.Job.DELIVERY)) serviceBuilder = Delivery.Builder.newInstance(jobIdNode.asText());
            else throw new IllegalStateException("type of service ("+typeNode.asText()+") is not supported");

            //service address
View Full Code Here

            if(jobIdNode.isMissingNode()) throw new IllegalStateException("service-id is missing");

            Service.Builder serviceBuilder;
            if(typeNode.isMissingNode()) serviceBuilder = Service.Builder.newInstance(jobIdNode.asText());
            else if(typeNode.asText().equals(JsonConstants.Job.SERVICE)) serviceBuilder = Service.Builder.newInstance(jobIdNode.asText());
            else if(typeNode.asText().equals(JsonConstants.Job.PICKUP)) serviceBuilder = Pickup.Builder.newInstance(jobIdNode.asText());
            else if(typeNode.asText().equals(JsonConstants.Job.DELIVERY)) serviceBuilder = Delivery.Builder.newInstance(jobIdNode.asText());
            else throw new IllegalStateException("type of service ("+typeNode.asText()+") is not supported");

            //service address
            JsonNode addressIdNode = serviceNode.path(JsonConstants.Job.ADDRESS).path(JsonConstants.Address.ID);
View Full Code Here

            Service.Builder serviceBuilder;
            if(typeNode.isMissingNode()) serviceBuilder = Service.Builder.newInstance(jobIdNode.asText());
            else if(typeNode.asText().equals(JsonConstants.Job.SERVICE)) serviceBuilder = Service.Builder.newInstance(jobIdNode.asText());
            else if(typeNode.asText().equals(JsonConstants.Job.PICKUP)) serviceBuilder = Pickup.Builder.newInstance(jobIdNode.asText());
            else if(typeNode.asText().equals(JsonConstants.Job.DELIVERY)) serviceBuilder = Delivery.Builder.newInstance(jobIdNode.asText());
            else throw new IllegalStateException("type of service ("+typeNode.asText()+") is not supported");

            //service address
            JsonNode addressIdNode = serviceNode.path(JsonConstants.Job.ADDRESS).path(JsonConstants.Address.ID);
            boolean either_locationId_or_coord = false;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.