Package org.bson.types

Examples of org.bson.types.ObjectId


    }
    return list;
  }

  public static String createValidId() {
    return new ObjectId().toString();
  }
View Full Code Here


    }
    return list;
  }

  public static String createValidId() {
    return new ObjectId().toString();
  }
View Full Code Here

  public void canUseManuallyAssignedObjectId() {
    OgmSession session = openSession();
    Transaction tx = session.beginTransaction();

    // given
    BarKeeper brian = new BarKeeper( new ObjectId(), "Brian" );

    // when
    session.persist( brian );

    tx.commit();
View Full Code Here

  public void canUseManuallyAssignedObjectIdInAssociation() {
    OgmSession session = openSession();
    Transaction tx = session.beginTransaction();

    // given
    BarKeeper brian = new BarKeeper( new ObjectId(), "Brian" );
    Drink cubaLibre = new Drink( new ObjectId(), "Cuba Libre" );
    brian.setFavoriteDrink( cubaLibre );

    // when
    session.persist( brian );
    session.persist( cubaLibre );
View Full Code Here

  public String toString(ObjectId value) {
    return value == null ? null : value.toString();
  }
  @Override
  public ObjectId fromString(String string) {
    return new ObjectId( string );
  }
View Full Code Here

  public <X> X unwrap(String value, Class<X> type, WrapperOptions options) {
    if ( value == null ) {
      return null;
    }

    return (X) new ObjectId( value );
  }
View Full Code Here

        Map<String, Object> inputData = Maps.newHashMap();
        if (rir.inputId != null)
            inputData.put("input_id", rir.inputId);
        else
            inputData.put("input_id", new ObjectId().toHexString());
        inputData.put("title", rir.title);
        inputData.put("type", rir.type);
        inputData.put("creator_user_id", rir.creatorUserId);
        inputData.put("configuration", rir.configuration);
        inputData.put("created_at", Tools.iso8601());
View Full Code Here

        }
    }

  protected ObjectId loadObjectId(String id) {
    try {
      return new ObjectId(id);
    } catch (IllegalArgumentException e) {
          LOG.error("Invalid ObjectID \"" + id + "\". Returning HTTP 400.");
          throw new WebApplicationException(400);
    }
  }
View Full Code Here

                mapper.get());
    }

    @Override
    public FilterDescription load(String filterId) throws NotFoundException {
        final FilterDescription filter = dbCollection.findOneById(new ObjectId(filterId));

        if (filter == null) {
            throw new NotFoundException();
        }
        return filter;
View Full Code Here

        return true;
    }

    @Override
    public int delete(String filterId) {
        return dbCollection.removeById(new ObjectId(filterId)).getN();
    }
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.