Package org.bson.types

Examples of org.bson.types.ObjectId


    public AlarmCallbackConfigurationImpl(ObjectId id, Map<String, Object> fields) {
        super(id, fields);
        if (fields.get("stream_id") != null) {
            Object rawStreamId = fields.get("stream_id");
            if (rawStreamId instanceof String && !(((String)rawStreamId).isEmpty()))
                this.stream_id = new ObjectId((String)rawStreamId);
            if (rawStreamId instanceof ObjectId)
                this.stream_id = (ObjectId)rawStreamId;
        }

        this.type = (String)fields.get("type");
View Full Code Here


    public void setStream(Stream stream) {
        setStreamId(stream.getId());
    }

    public void setStreamId(String stream_id) {
        this.stream_id = new ObjectId(stream_id);
    }
View Full Code Here

        Map<String, Object> streamRuleData = Maps.newHashMap();
        streamRuleData.put("type", cr.type);
        streamRuleData.put("value", cr.value);
        streamRuleData.put("field", cr.field);
        streamRuleData.put("inverted", cr.inverted);
        streamRuleData.put("stream_id", new ObjectId(streamid));

        return new StreamRuleImpl(streamRuleData);
    }
View Full Code Here

        return new StreamRuleImpl(streamRuleData);
    }

    @Override
    public List<StreamRule> loadForStreamId(String streamId) throws NotFoundException {
        ObjectId id = new ObjectId(streamId);
        final List<StreamRule> streamRules = new ArrayList<StreamRule>();
        final List<DBObject> respStreamRules = query(StreamRuleImpl.class,
                new BasicDBObject("stream_id", id)
        );
View Full Code Here

        );

        List<Alert> alerts = Lists.newArrayList();

        for (DBObject alertObj : alertObjects) {
            alerts.add(new AlertImpl(new ObjectId(alertObj.get("_id").toString()), alertObj.toMap()));
        }

        return alerts;
    }
View Full Code Here

    private String creatorUserId;
    @Nullable
    private String contentPack = null;

    public OutputImpl() {
        this._id = new ObjectId();
    }
View Full Code Here

    public OutputImpl(String title, String type, Map<String, Object> configuration, Date createdAt, String creatorUserId) {
        this(title, type, configuration, createdAt, creatorUserId, null);
    }

    public OutputImpl(String title, String type, Map<String, Object> configuration, Date createdAt, String creatorUserId, String contentPack) {
        this._id = new ObjectId();
        this.title = title;
        this.type = type;
        this.configuration = configuration;
        this.createdAt = createdAt;
        this.creatorUserId = creatorUserId;
View Full Code Here

    public String getId() {
        return _id.toHexString();
    }

    public void setId(String id) {
        this._id = new ObjectId(id);
    }
View Full Code Here

    }

    @Override
    public Map<String, Object> getFields() {
        final HashMap<String, Object> fields = new HashMap<>();
        fields.put(FIELD_ID, new ObjectId(getId()));
        fields.put(FIELD_TITLE, getTitle());
        fields.put(FIELD_TYPE, getType());
        fields.put(FIELD_CONFIGURATION, getConfiguration());
        fields.put(FIELD_CREATOR_USER_ID, getCreatorUserId());
        fields.put(FIELD_CREATED_AT, getCreatedAt());
View Full Code Here


    private BasicDBObject getBasicDBObject(Date timestamp, String metricName, String metricType) {
        final BasicDBObject report = new BasicDBObject();

        report.put("_id", new ObjectId());
        report.put("type", metricType);
        report.put("timestamp", timestamp);
        report.put("name", metricName);
        report.put("node", nodeId);
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.