@Override public Set<String> getStateIds() { Iterator<MongoState> res = getCollection().find().as(MongoState.class).iterator(); Set<String> result = new HashSet<String>(); while (res.hasNext()) { MongoState state = res.next(); result.add(state.getId()); } return result; }
/** * Gets the. * * @param params the params * @return the mongo state */ public MongoState get(final ObjectNode params) { final MongoStateConfig config = MongoStateConfig.decorate(params); final String id = config.getId(); MongoState result = null; try { synchronized (this) { result = getCollection().findOne("{_id: #}", id).as(MongoState.class); if (result == null) { result = new MongoState(id, this, params); getCollection().insert(result); } else { result.setService(this); } } result.setCollection(getCollection()); } catch (final Exception e) { LOG.log(Level.WARNING, "get error", e); } return result; }