@Override public AlarmCallbackConfiguration load(String alarmCallbackId) { return coll.findOneById(alarmCallbackId); }
@Override public Alert load(String alertId, String streamId) throws NotFoundException { return this.coll.findOneById(alertId); }
public Optional<ContentPackInstallation> findById(ObjectId id) { final ContentPackInstallation installation = dbCollection.findOneById(id); return Optional.ofNullable(installation); }
@Override public Decorator findById(String decoratorId) throws NotFoundException { final Decorator result = coll.findOneById(decoratorId); if (result == null) { throw new NotFoundException("Decorator with id " + decoratorId + " not found."); } return result; }
@Override public RuleDao load(String id) throws NotFoundException { final RuleDao rule = dbCollection.findOneById(id); if (rule == null) { throw new NotFoundException("No rule with id " + id); } return rule; }
@Override public PipelineDao load(String id) throws NotFoundException { final PipelineDao pipeline = dbCollection.findOneById(id); if (pipeline == null) { throw new NotFoundException("No pipeline with id " + id); } return pipeline; }
@Override public Output load(String streamOutputId) throws NotFoundException { final Output output = coll.findOneById(streamOutputId); if (output == null) { throw new NotFoundException("Couldn't find output with id " + streamOutputId); } return output; }
/** * Get the {@link DTO} for the given ID. * * @param id the ID of the object * @return an Optional containing the found object or an empty Optional if no object can be found for the given ID */ public Optional<DTO> get(String id) { return Optional.ofNullable(db.findOneById(new ObjectId(id))); }
public Optional<DataAdapterDto> get(String idOrName) { try { return Optional.ofNullable(db.findOneById(new ObjectId(idOrName))); } catch (IllegalArgumentException e) { // not an ObjectId, try again with name return Optional.ofNullable(db.findOne(DBQuery.is("name", idOrName))); } }
@Override public Role loadById(String roleId) throws NotFoundException { final Role role = dbCollection.findOneById(new ObjectId(roleId)); if (role == null) { throw new NotFoundException("No role found with id " + roleId); } return role; }
@Override public GrokPattern load(String patternId) throws NotFoundException { final GrokPattern pattern = dbCollection.findOneById(new ObjectId(patternId)); if (pattern == null) { throw new NotFoundException("Couldn't find Grok pattern with ID " + patternId); } return pattern; }
public Optional<LookupTableDto> get(String idOrName) { try { return Optional.ofNullable(db.findOneById(new ObjectId(idOrName))); } catch (IllegalArgumentException e) { // not an ObjectId, try again with name return Optional.ofNullable(db.findOne(DBQuery.is("name", idOrName))); } }
public Optional<IndexFieldTypesDTO> get(String idOrIndexName) { try { return Optional.ofNullable(db.findOneById(new ObjectId(idOrIndexName))); } catch (IllegalArgumentException e) { // Not an ObjectId, try again with index_name return Optional.ofNullable(db.findOne(DBQuery.is(IndexFieldTypesDTO.FIELD_INDEX_NAME, idOrIndexName))); } }
public Optional<CacheDto> get(String idOrName) { try { return Optional.ofNullable(db.findOneById(new ObjectId(idOrName))); } catch (IllegalArgumentException e) { // not an ObjectId, try again with name return Optional.ofNullable(db.findOne(DBQuery.is("name", idOrName))); } }
@Override public Decorator save(Decorator decorator) { checkArgument(decorator instanceof DecoratorImpl, "Argument must be an instance of DecoratorImpl, not %s", decorator.getClass()); if (!Strings.isNullOrEmpty(decorator.id())) { this.coll.updateById(decorator.id(), (DecoratorImpl)decorator); return this.coll.findOneById(decorator.id()); } return this.coll.save((DecoratorImpl) decorator).getSavedObject(); }
@Override public T fetch() { if (object == null) { object = dbCollection.findOneById(getId()); } return object; }
@Override public T fetch(DBObject fields) { // No caching, because otherwise we'd have to track which fields were // passed in return dbCollection.findOneById(getId(), fields); }
@Override public Output load(String streamOutputId) throws NotFoundException { final Output output = coll.findOneById(streamOutputId); if (output == null) { throw new NotFoundException("Couldn't find output with id " + streamOutputId); } return output; }
@Override public FilterDescription load(String filterId) throws NotFoundException { final FilterDescription filter = dbCollection.findOneById(new ObjectId(filterId)); if (filter == null) { throw new NotFoundException("Couldn't find filter with ID " + filterId); } return filter; }
public ConfigurationBundle load(final String bundleId) throws NotFoundException { final ConfigurationBundle bundle = dbCollection.findOneById(new ObjectId(bundleId)); if (bundle == null) { throw new NotFoundException("Couldn't find content pack with ID " + bundleId); } return bundle; }