Package com.orientechnologies.orient.core.id

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


    final ORecordBytes response;

    try {

      response = db.load(new ORecordId(rid));
      if (response != null) {
        sendBinaryFileContent(iRequest, OHttpUtils.STATUS_OK_CODE, OHttpUtils.STATUS_OK_DESCRIPTION, fileType, response, fileName);
      } else {
        sendTextContent(iRequest, OHttpUtils.STATUS_INVALIDMETHOD_CODE, "Record requested not exists", null,
            OHttpUtils.CONTENT_TEXT_PLAIN, "Record requestes not exists");
View Full Code Here


      case OTransactionEntry.DELETED:
        database.executeDeleteRecord(iRecord, iRecord.getVersion());
        break;
      }
    } else {
      final ORecordId rid = (ORecordId) iRecord.getIdentity();

      if (!rid.isValid()) {
        // // TODO: NEED IT FOR REAL?
        // // NEW RECORD: CHECK IF IT'S ALREADY IN
        // for (OTransactionEntry entry : entries.values()) {
        // if (entry.getRecord() == iRecord)
        // return;
View Full Code Here

      database.checkSecurity(ODatabaseSecurityResources.CLUSTER, ORole.PERMISSION_READ, firstCluster.toLowerCase(), clusterIds[0]);

      scanEntireClusters(clusterIds);
    } else if (compiledFilter.getTargetRecords() != null) {
      ORecordId rid = new ORecordId();
      ORecordInternal<?> record;
      for (String rec : compiledFilter.getTargetRecords()) {
        rid.fromString(rec);
        record = database.load(rid);
        foreach(record);
      }
    } else
      throw new OQueryParsingException("No source found in query: specify class, clusters or single records");
View Full Code Here

    if (!word.toString().contains(":"))
      throw new OCommandSQLParsingException(
          "Range must contains record id in the form of <cluster-id>:<cluster-pos>. Example: RANGE 10:50, 10:100", text, currentPos);

    try {
      rangeFrom = new ORecordId(word.toString());
    } catch (Exception e) {
      throw new OCommandSQLParsingException("Invalid record id setted as RANGE from. Value setted is '" + word
          + "' but it should be a valid record id in the form of <cluster-id>:<cluster-pos>. Example: RANGE 10:50", text,
          currentPos);
    }

    if (newPos == -1)
      return;

    currentPos = newPos;

    newPos = OSQLHelper.nextWord(text, textUpperCase, currentPos, word, true);

    if (newPos == -1)
      return;

    if (!word.toString().equalsIgnoreCase("LIMIT")) {
      if (!word.toString().contains(":"))
        throw new OCommandSQLParsingException(
            "Range must contains record id in the form of <cluster-id>:<cluster-pos>. Example: RANGE 10:50, 10:100", text,
            currentPos);

      try {
        rangeTo = new ORecordId(word.toString());
      } catch (Exception e) {
        throw new OCommandSQLParsingException("Invalid record id setted as RANGE to. Value setted is '" + word
            + "' but it should be a valid record id in the form of <cluster-id>:<cluster-pos>. Example: RANGE 10:50, 10:100", text,
            currentPos);
      }
View Full Code Here

      return;

    final OIdentifiable o = super.get(iIndex);

    if (o != null && o instanceof ORecordId) {
      final ORecordId rid = (ORecordId) o;

      marshalling = true;
      try {
        final ORecordInternal<?> record = database.load(rid);
        set(iIndex, (OIdentifiable) record);
View Full Code Here

    for (String item : items) {
      if (item.length() == 0)
        continue;

      super.rawAdd(new ORecordId(item));
    }

    modCount = currentModCount;
    marshalling = false;
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);

    } finally {
      if (db != null)
        OSharedDocumentDatabase.release(db);
    }
View Full Code Here

      throws IOException {

    if (txEntry.status != OTransactionEntry.DELETED && !txEntry.getRecord().isDirty())
      return;

    final ORecordId rid = (ORecordId) txEntry.getRecord().getIdentity();

    final OCluster cluster = txEntry.clusterName != null ? storage.getClusterByName(txEntry.clusterName) : storage
        .getClusterById(rid.clusterId);

    if (!(cluster instanceof OClusterLocal))
      // ONLY LOCAL CLUSTER ARE INVOLVED IN TX
      return;

    if (txEntry.getRecord() instanceof OTxListener)
      ((OTxListener) txEntry.getRecord()).onEvent(txEntry, OTxListener.EVENT.BEFORE_COMMIT);

    switch (txEntry.status) {
    case OTransactionEntry.LOADED:
      break;

    case OTransactionEntry.CREATED: {
      // CHECK 2 TIMES TO ASSURE THAT IT'S A CREATE OR AN UPDATE BASED ON RECURSIVE TO-STREAM METHOD
      byte[] stream = txEntry.getRecord().toStream();

      if (rid.isNew()) {
        if (iTx.getDatabase().callbackHooks(ORecordHook.TYPE.BEFORE_CREATE, txEntry.getRecord()))
          // RECORD CHANGED: RE-STREAM IT
          stream = txEntry.getRecord().toStream();

        rid.clusterId = cluster.getId();
View Full Code Here

  public OSerializableStream fromStream(final byte[] iStream) throws OSerializationException {
    final OMemoryInputStream buffer = new OMemoryInputStream(iStream);
    try {
      text = buffer.getAsString();
      limit = buffer.getAsInteger();
      beginRange = new ORecordId().fromStream(buffer.getAsByteArrayFixed(ORecordId.PERSISTENT_SIZE));
      endRange = new ORecordId().fromStream(buffer.getAsByteArrayFixed(ORecordId.PERSISTENT_SIZE));
      fetchPlan = buffer.getAsString();
      if (fetchPlan.length() == 0)
        fetchPlan = null;

      byte[] paramBuffer = buffer.getAsByteArray();
View Full Code Here

    final String recordIdString = word.toString();
    if (recordIdString == null || recordIdString.equals(""))
      throw new OCommandSQLParsingException("Record to search can't be null", text, pos);
    try {
      recordId = new ORecordId(recordIdString);
      if (!recordId.isValid())
        throw new OCommandSQLParsingException("Record ID " + recordIdString + " is not valid", text, pos);
    } catch (IllegalArgumentException iae) {
      throw new OCommandSQLParsingException("Error reading record Id", text, pos, iae);
    }
View Full Code Here

TOP

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

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.