Package org.mongojack.internal.object

Examples of org.mongojack.internal.object.BsonObjectGenerator$Node


    boolean status(final List<String> toks) {
        if (standaloneNodes.size() > 0) {
            out.println("Standalone Nodes:");
            for (String nodeName : standaloneNodes.keySet()) {
                Node node = standaloneNodes.get(nodeName);
                for (String curi : node.getInstalledContributions()) {
                    for (String dc : node.getDeployedComposites(curi)) {
                        out.println("   " + nodeName + " " + dc);
                    }
                }
            }
            out.println();
        }
        if (nodes.size() > 0) {
            for (Node node : nodes.values()) {
                out.println("Domain: " + node.getDomainName());
                List<String> ics;
                if (toks.size() > 1) {
                    ics = new ArrayList<String>();
                    ics.add(toks.get(1));
                } else {
                    ics = node.getInstalledContributions();
                }

                for (String curi : ics) {
                    Contribution c = node.getInstalledContribution(curi);
                    List<String> dcs = node.getDeployedComposites(curi);
                    if (toks.size() > 2) {
                        dcs = new ArrayList<String>();
                        dcs.add(toks.get(2));
                    } else {
                        dcs = node.getDeployedComposites(curi);
                    }
                    for (String compositeUri : dcs) {
                        for (Artifact a : c.getArtifacts()) {
                            if (compositeUri.equals(a.getURI())) {
                                out.println("   " + curi
View Full Code Here


    DBObject convertToBasicDbObject(T object) throws MongoException {
        if (object == null) {
            return null;
        }
        BsonObjectGenerator generator = new BsonObjectGenerator();
        try {
            objectMapper.writeValue(generator, object);
        } catch (JsonMappingException e) {
            throw new MongoJsonMappingException(e);
        } catch (IOException e) {
            // This shouldn't happen
            throw new MongoException(
                    "Unknown error occurred converting BSON to object", e);
        }
        return generator.getDBObject();
    }
View Full Code Here

            return null;
        }
        if (isEnabled(Feature.USE_STREAM_SERIALIZATION)) {
            return new JacksonDBObject<T>(object, view);
        } else {
            BsonObjectGenerator generator = new BsonObjectGenerator();
            try {
                objectMapper.writerWithView(view).writeValue(generator, object);
            } catch (JsonMappingException e) {
                throw new MongoJsonMappingException(e);
            } catch (IOException e) {
                // This shouldn't happen
                throw new MongoException(
                        "Unknown error occurred converting BSON to object", e);
            }
            return generator.getDBObject();
        }
    }
View Full Code Here

                // We don't know what it is, just find a serializer for it
                serializer = JacksonAccessor.findValueSerializer(
                        serializerProvider, value.getClass());
            }
        }
        BsonObjectGenerator objectGenerator = new BsonObjectGenerator();
        try {
            serializer.serialize(value, objectGenerator, serializerProvider);
        } catch (IOException e) {
            throw new MongoJsonMappingException("Error serializing value "
                    + value + " in DBQuery operation " + op, e);
        }
        return objectGenerator.getValue();
    }
View Full Code Here

            } else {
                return array;
            }
        } else {
            // We don't know what it is, serialise it
            BsonObjectGenerator generator = new BsonObjectGenerator();
            try {
                objectMapper.writeValue(generator, value);
            } catch (JsonMappingException e) {
                throw new MongoJsonMappingException(e);
            } catch (IOException e) {
                throw new RuntimeException(
                        "Somehow got an IOException writing to memory", e);
            }
            return generator.getValue();
        }
    }
View Full Code Here

    }

    private static Object serializeUpdateField(Object value,
            JsonSerializer serializer, SerializerProvider serializerProvider,
            String op, String field) {
        BsonObjectGenerator objectGenerator = new BsonObjectGenerator();
        try {
            serializer.serialize(value, objectGenerator, serializerProvider);
        } catch (IOException e) {
            throw new MongoJsonMappingException(
                    "Error serializing value in DBUpdate operation " + op
                            + " field " + field, e);
        }
        return objectGenerator.getValue();
    }
View Full Code Here

         *            The java object id to convert from
         * @return The converted database id
         */
        @Override
        public D toDbId(K id) {
            BsonObjectGenerator generator = new BsonObjectGenerator();
            try {
                jsonSerializer.serialize(id, generator, null);
            } catch (IOException e) {
                throw new MongoException("Error serializing ID", e);
            }
            return (D) generator.getValue();
        }
View Full Code Here

    for (Way way : waysById.values()) {
     
      List<WayNode> origWayNodes = way.getWayNodes();
      List<OSMNode> wayNodes = new ArrayList<OSMNode>(origWayNodes.size());
      for (WayNode origWayNode : origWayNodes) {
        Node origNode = nodesById.get(origWayNode.getNodeId());
        if (origNode != null) {
          wayNodes.add(nodeMap.get(origNode));
        }
      }
     
View Full Code Here

    for (Way way : waysById.values()) {
     
      List<WayNode> origWayNodes = way.getWayNodes();
      List<OwnNode> wayNodes = new ArrayList<OwnNode>(origWayNodes.size());
      for (WayNode origWayNode : origWayNodes) {
        Node origNode = nodesById.get(origWayNode.getNodeId());
        wayNodes.add(nodeMap.get(origNode));
      }
     
      OwnWay ownWay = new OwnWay(tagGroupForEntity(way), wayNodes);
     
View Full Code Here

        CommonEntityData entityData = new CommonEntityData(id, version, timestamp, osmuser,
                changeset, tags);
        if (type.equals(OSMUtils.nodeType())) {
            Point pt = (Point) feature.getDefaultGeometryProperty().getValue();
            entity = new Node(entityData, pt.getY(), pt.getX());

        } else {
            List<WayNode> nodes = Lists.newArrayList();
            String nodesString = (String) feature.getAttribute("nodes");
            for (String s : nodesString.split(";")) {
View Full Code Here

TOP

Related Classes of org.mongojack.internal.object.BsonObjectGenerator$Node

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.