Package com.orientechnologies.orient.core.id

Examples of com.orientechnologies.orient.core.id.OClusterPositionLong


    document.field(FLOAT_NUMBER, 12.5f);
    document.field(DOUBLE_NUMBER, 12.5d);
    document.field(BYTE_FIELD, (byte) 'C');
    document.field(BOOLEAN_FIELD, true);
    document.field(DATE_FIELD, new Date());
    document.field(RECORDID_FIELD, new ORecordId(10, new OClusterPositionLong(10)));

    byte[] res = serializer.toStream(document, false);
    ODocument extr = (ODocument) serializer.fromStream(res, new ODocument(), new String[] {});

    assertEquals(extr.fields(), document.fields());
View Full Code Here


    document.field("character", 'C');
    document.field("alive", true);
    document.field("dateTime", new Date());
    document.field("bigNumber", new BigDecimal("43989872423376487952454365232141525434.32146432321442534"));
    ORidBag bag = new ORidBag();
    bag.add(new ORecordId(1, new OClusterPositionLong(1)));
    bag.add(new ORecordId(2, new OClusterPositionLong(2)));
    // document.field("ridBag", bag);
    Calendar c = Calendar.getInstance();
    document.field("date", c.getTime(), OType.DATE);
    Calendar c1 = Calendar.getInstance();
    c1.set(Calendar.MILLISECOND, 0);
    c1.set(Calendar.SECOND, 0);
    c1.set(Calendar.MINUTE, 0);
    c1.set(Calendar.HOUR_OF_DAY, 0);
    document.field("date1", c1.getTime(), OType.DATE);

    byte[] byteValue = new byte[10];
    Arrays.fill(byteValue, (byte) 10);
    document.field("bytes", byteValue);

    document.field("utf8String", new String("A" + "\u00ea" + "\u00f1" + "\u00fc" + "C"));
    document.field("recordId", new ORecordId(10, new OClusterPositionLong(10)));

    byte[] res = serializer.toStream(document, false);
    ODocument extr = (ODocument) serializer.fromStream(res, new ODocument(), new String[] {});

    c.set(Calendar.MILLISECOND, 0);
View Full Code Here

    listMixed.add(4.0f);
    listMixed.add(7.0D);
    listMixed.add("hello");
    listMixed.add(new Date());
    listMixed.add((byte) 10);
    listMixed.add(new ORecordId(10, new OClusterPositionLong(20)));
    document.field("listMixed", listMixed);

    byte[] res = serializer.toStream(document, false);
    ODocument extr = (ODocument) serializer.fromStream(res, new ODocument(), new String[] {});
View Full Code Here

  public void testLinkCollections() {
    ODatabaseDocument db = new ODatabaseDocumentTx("memory:ODocumentSchemalessBinarySerializationTest").create();
    try {
      ODocument document = new ODocument();
      Set<ORecordId> linkSet = new HashSet<ORecordId>();
      linkSet.add(new ORecordId(10, new OClusterPositionLong(20)));
      linkSet.add(new ORecordId(10, new OClusterPositionLong(21)));
      linkSet.add(new ORecordId(10, new OClusterPositionLong(22)));
      linkSet.add(new ORecordId(11, new OClusterPositionLong(22)));
      document.field("linkSet", linkSet, OType.LINKSET);

      List<ORecordId> linkList = new ArrayList<ORecordId>();
      linkList.add(new ORecordId(10, new OClusterPositionLong(20)));
      linkList.add(new ORecordId(10, new OClusterPositionLong(21)));
      linkList.add(new ORecordId(10, new OClusterPositionLong(22)));
      linkList.add(new ORecordId(11, new OClusterPositionLong(22)));
      document.field("linkList", linkList, OType.LINKLIST);
      byte[] res = serializer.toStream(document, false);
      ODocument extr = (ODocument) serializer.fromStream(res, new ODocument(), new String[] {});

      assertEquals(extr.fields(), document.fields());
View Full Code Here

    ODatabaseDocument db = new ODatabaseDocumentTx("memory:ODocumentSchemalessBinarySerializationTest").create();
    try {
      ODocument document = new ODocument();

      Map<String, OIdentifiable> map = new HashMap<String, OIdentifiable>();
      map.put("link", new ORecordId(0, new OClusterPositionLong(0)));
      document.field("map", map, OType.LINKMAP);

      byte[] res = serializer.toStream(document, false);
      ODocument extr = (ODocument) serializer.fromStream(res, new ODocument(), new String[] {});
      assertEquals(extr.fields(), document.fields());
View Full Code Here

    document.field("bitHeigth", 12.5d);
    document.field("class", (byte) 'C');
    document.field("character", 'C');
    document.field("alive", true);
    document.field("date", new Date());
    document.field("recordId", new ORecordId(10, new OClusterPositionLong(10)));

    byte[] res = serializer.toStream(document, false);
    ODocument extr = (ODocument) serializer.fromStream(res, new ODocument(), new String[] {});

    assertEquals(extr.fields(), document.fields());
View Full Code Here

    }
    return found;
  }

  private ORecordId readOptimizedLink(final BytesContainer bytes) {
    return new ORecordId(OVarIntSerializer.readAsInteger(bytes), new OClusterPositionLong(OVarIntSerializer.readAsLong(bytes)));
  }
View Full Code Here

        if (!rid.equals(record.getIdentity()))
          // SAVE IT ONLY IF DIFFERENT
          exportImportHashTable.put(rid, record.getIdentity());

        if (record.getIdentity().equals(new ORecordId(37, new OClusterPositionLong(8)))) {
          record = ORecordSerializerJSON.INSTANCE.fromString(value, record, null);
        }
      }

    } catch (Exception t) {
View Full Code Here

  @Test
  public void testKeepFieldTypeSerialization() throws Exception {
    ODocument doc = new ODocument();
    doc.field("integer", 10, OType.INTEGER);
    doc.field("link", new ORecordId(1, new OClusterPositionLong(2)), OType.LINK);
    doc.field("string", 20, OType.STRING);
    doc.field("binary", new byte[] { 30 }, OType.BINARY);

    assertEquals(doc.fieldType("integer"), OType.INTEGER);
    assertEquals(doc.fieldType("link"), OType.LINK);
View Full Code Here

  @Test
  public void testKeepAutoFieldTypeSerialization() throws Exception {
    ODocument doc = new ODocument();
    doc.field("integer", 10);
    doc.field("link", new ORecordId(1, new OClusterPositionLong(2)));
    doc.field("string", "string");
    doc.field("binary", new byte[] { 30 });

    // this is null because is not set on value set.
    assertNull(doc.fieldType("integer"));
View Full Code Here

TOP

Related Classes of com.orientechnologies.orient.core.id.OClusterPositionLong

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.