Package org.bson.types

Examples of org.bson.types.ObjectId


    public List<Notification> all() {
        List<Notification> notifications = Lists.newArrayList();

        for (DBObject obj : query(NotificationImpl.class, new BasicDBObject(), new BasicDBObject("timestamp", -1))) {
            try {
                notifications.add(new NotificationImpl(new ObjectId(obj.get("_id").toString()), obj.toMap()));
            } catch (IllegalArgumentException e) {
                LOG.warn("There is a notification type we can't handle: [" + obj.get("type") + "]");
                continue;
            }
        }
View Full Code Here


    }

    @Test
    public void testStoreOidOnInsert() throws Exception {
        DBObject dbObject = new BasicDBObject();
        ObjectId oid = template.requestBody("direct:testStoreOidOnInsert", dbObject, ObjectId.class);
        assertEquals(dbObject.get("_id"), oid);
    }
View Full Code Here

    }

    @Test
    public void testStoreOidOnSave() throws Exception {
        DBObject dbObject = new BasicDBObject();
        ObjectId oid = template.requestBody("direct:testStoreOidOnSave", dbObject, ObjectId.class);
        assertEquals(dbObject.get("_id"), oid);
    }
View Full Code Here

     * Generate a unique cluster id, similar to the machine id field in MongoDB ObjectId objects.
     *
     * @return the unique machine id
     */
    public static int getUniqueClusterId() {
        ObjectId objId = new ObjectId();
        return objId._machine();
    }
View Full Code Here

     * Generate a unique cluster id, similar to the machine id field in MongoDB ObjectId objects.
     *
     * @return the unique machine id
     */
    public static int getUniqueClusterId() {
        ObjectId objId = new ObjectId();
        return objId._machine();
    }
View Full Code Here

                    }
                })
                .get(new Route("/record/:recordId") {
                    @Override
                    public void handle(Request request, Response response, Map<String, String> map) throws Exception {
                        ObjectId recordId = new ObjectId(checkNotNull(map.get("recordId")));

                        TmpData sound = checkNotNull(tmpDataDAO.get(recordId));

                        response.write(sound.getData());
                    }
View Full Code Here

@Message
public class Token {
    byte[] userIdBytes;

    public ObjectId getUserId() {
        return new ObjectId(userIdBytes);
    }
View Full Code Here

                        Nabaztag nabaztag = checkNotNull(nabaztagDAO.findOne("apikey", apikey));
                        Set<Subscription> subscriptionSet = nabaztag.getSubscribe();

                        List<ObjectId> objectList = new ArrayList<ObjectId>();
                        for (Subscription subscription : subscriptionSet) {
                            objectList.add(new ObjectId(subscription.getObjectId()));
                        }
                        List<Nabaztag> nabaztagList = nabaztagDAO.find(nabaztagDAO.createQuery().field("_id").in(objectList)).asList();

                        String command = "ST " + url + "\nMW\n";
                        for (Nabaztag nab : nabaztagList) {
                            if (connectionManager.containsKey(nab.getMacAddress()))
                                messageService.sendMessage(nab.getMacAddress(), command);
                        }

                        response.writeJSON("ok");
                    }
                })
                .get(new Route("/nab2nabs/:apikey/tts") {
                    @Override
                    public void handle(Request request, Response response, Map<String, String> map) throws Exception {
                        String apikey = checkNotNull(map.get("apikey"));
                        String text = checkNotNull(request.getParam("text"));
                        Nabaztag nabaztag = checkNotNull(nabaztagDAO.findOne("apikey", apikey));
                        Set<Subscription> subscriptionSet = nabaztag.getSubscribe();

                        List<ObjectId> objectList = new ArrayList<ObjectId>();
                        for (Subscription subscription : subscriptionSet) {
                            objectList.add(new ObjectId(subscription.getObjectId()));
                        }
                        List<Nabaztag> nabaztagList = nabaztagDAO.find(nabaztagDAO.createQuery().field("_id").in(objectList)).asList();

                        for (Nabaztag nab : nabaztagList) {
                            if (connectionManager.containsKey(nab.getMacAddress())){
View Full Code Here

    public void setOwner(ObjectId owner) {
        this.owner = owner;
    }

    public void setOwner(String owner) {
        setOwner(new ObjectId(owner));
    }
View Full Code Here

    protected OrganizationContainer(ItemGroup parent, String name) {
        super(parent, name);
        init(name);
        if(id == null) {
            id = new ObjectId();
        }
    }
View Full Code Here

TOP

Related Classes of org.bson.types.ObjectId

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.