Package com.orientechnologies.orient.core.db.document

Examples of com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.load()


        ORecordInternal.setIdentity(doc, recordId);

      if (!recordId.isValid())
        throw new IllegalArgumentException("Invalid Record ID in request: " + recordId);

      final ODocument currentDocument = db.load(recordId);

      if (currentDocument == null) {
        iResponse.send(OHttpUtils.STATUS_NOTFOUND_CODE, OHttpUtils.STATUS_NOTFOUND_DESCRIPTION, OHttpUtils.CONTENT_TEXT_PLAIN,
            "Record " + recordId + " was not found.", null);
        return false;
View Full Code Here


    final ORecordAbstract response;

    try {

      response = db.load(new ORecordId(rid));
      if (response != null) {
        if (response instanceof ORecordBytes) {
          sendORecordBinaryFileContent(iRequest, iResponse, OHttpUtils.STATUS_OK_CODE, OHttpUtils.STATUS_OK_DESCRIPTION, fileType,
              (ORecordBytes) response, fileName);
        } else if (response instanceof ODocument) {
View Full Code Here

     final String rid = parametersPos > -1 ? urlParts[2].substring(0, parametersPos) : urlParts[2];

     try {
       db = getProfiledDatabaseInstance(iRequest);

       rec = db.load(new ORecordId(rid), fetchPlan);
       if (rec == null)
         iResponse.send(OHttpUtils.STATUS_NOTFOUND_CODE, "Not Found", OHttpUtils.CONTENT_JSON, "Record with id '" + urlParts[2]
             + "' was not found.", null);
       else if (iRequest.httpMethod.equals("HEAD"))
         // JUST SEND HTTP CODE 200
View Full Code Here

      db = getProfiledDatabaseInstance(iRequest);
      if (db.getMetadata().getSchema().getClass(urlParts[2]) == null) {
        throw new IllegalArgumentException("Invalid class '" + urlParts[2] + "'");
      }
      final String rid = db.getClusterIdByName(urlParts[2]) + ":" + urlParts[3];
      rec = db.load(new ORecordId(rid), fetchPlan);

      if (rec == null)
        iResponse.send(OHttpUtils.STATUS_NOTFOUND_CODE, "Not Found", OHttpUtils.CONTENT_JSON, "Record with id '" + rid
            + "' was not found.", null);
      else if (iRequest.httpMethod.equals("HEAD"))
View Full Code Here

    propertyIndexByKey = new OPropertyMapIndexDefinition("tesClass", "fOne", OType.STRING, OPropertyMapIndexDefinition.INDEX_BY.KEY);

    final ODocument docToStore = propertyIndexByKey.toStream();
    database.save(docToStore);

    final ODocument docToLoad = database.load(docToStore.getIdentity());

    final OPropertyIndexDefinition result = new OPropertyMapIndexDefinition();
    result.fromStream(docToLoad);

    database.drop();
View Full Code Here

        OPropertyMapIndexDefinition.INDEX_BY.VALUE);

    final ODocument docToStore = propertyIndexByValue.toStream();
    database.save(docToStore);

    final ODocument docToLoad = database.load(docToStore.getIdentity());

    final OPropertyIndexDefinition result = new OPropertyMapIndexDefinition();
    result.fromStream(docToLoad);

    database.drop();
View Full Code Here

    propertyIndex = new OPropertyIndexDefinition("tesClass", "fOne", OType.INTEGER);

    final ODocument docToStore = propertyIndex.toStream();
    database.save(docToStore);

    final ODocument docToLoad = database.load(docToStore.getIdentity());

    final OPropertyIndexDefinition result = new OPropertyIndexDefinition();
    result.fromStream(docToLoad);

    database.drop();
View Full Code Here

      // RE-READ THE RECORD
      record1.load();

      ODatabaseRecordThreadLocal.INSTANCE.set(db2);
      ORecordBytes record2 = db2.load(record1.getIdentity());

      record2.setDirty();
      record2.fromStream("This is the second version".getBytes());
      record2.save();
View Full Code Here

      database.commit();

      ODatabaseRecordThreadLocal.INSTANCE.set(db2);

      ORecordBytes record2 = db2.load(record1.getIdentity(), "*:-1", true);
      Assert.assertEquals(record2.getRecordVersion().getCounter(), v1 + 1);
      Assert.assertTrue(new String(record2.toStream()).contains("second"));

    } finally {

View Full Code Here

    databaseDocumentTx.create();

    final ODocument storeDocument = simpleKeyIndexDefinition.toStream();
    storeDocument.save();

    final ODocument loadDocument = databaseDocumentTx.load(storeDocument.getIdentity());
    final OSimpleKeyIndexDefinition loadedKeyIndexDefinition = new OSimpleKeyIndexDefinition();
    loadedKeyIndexDefinition.fromStream(loadDocument);

    databaseDocumentTx.drop();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.