Examples of OCompositeKey


Examples of com.orientechnologies.orient.core.index.OCompositeKey

      final Map<Object, Object> params = new HashMap<Object, Object>();
      final Map<Object, List<Object>> compositeKeyParams = new HashMap<Object, List<Object>>();

      for (final Entry<Object, Object> paramEntry : parameters.entrySet())
        if (paramEntry.getValue() instanceof OCompositeKey) {
          final OCompositeKey compositeKey = (OCompositeKey) paramEntry.getValue();
          compositeKeyParams.put(paramEntry.getKey(), compositeKey.getKeys());
        } else
          params.put(paramEntry.getKey(), paramEntry.getValue());

      buffer.set(!params.isEmpty());
      if (!params.isEmpty()) {
        final ODocument param = new ODocument();
        param.field("parameters", params);
        buffer.set(param.toStream());
      }

      buffer.set(!compositeKeyParams.isEmpty());
      if (!compositeKeyParams.isEmpty()) {
        final ODocument compositeKey = new ODocument();
        compositeKey.field("compositeKeyParams", compositeKeyParams);
        buffer.set(compositeKey.toStream());
      }
    }

    return buffer.toByteArray();
  }
View Full Code Here

Examples of com.orientechnologies.orient.core.index.OCompositeKey

      if (parameters == null)
        parameters = new HashMap<Object, Object>();

      for (final Entry<Object, Object> p : compositeKeyParams.entrySet()) {
        if (p.getValue() instanceof List) {
          final OCompositeKey compositeKey = new OCompositeKey((List<?>) p.getValue());
          if (p.getKey() instanceof String && Character.isDigit(((String) p.getKey()).charAt(0)))
            parameters.put(Integer.parseInt((String) p.getKey()), compositeKey);
          else
            parameters.put(p.getKey(), compositeKey);
View Full Code Here

Examples of com.orientechnologies.orient.core.index.OCompositeKey

        // SEARCH INSIDE THE NODE
        final V value = lastNode.search(k);

        // PROBABLY PARTIAL KEY IS FOUND USE SEARCH MODE TO FIND PREFERRED ONE
        if (key instanceof OCompositeKey) {
          final OCompositeKey compositeKey = (OCompositeKey) key;

          if (value != null && compositeKey.getKeys().size() == keySize) {
            return setLastSearchNode(key, lastNode);
          }

          if (partialSearchMode.equals(PartialSearchMode.NONE)) {
            if (value != null || iGetContainer)
View Full Code Here

Examples of com.orientechnologies.orient.core.index.OCompositeKey

    else if (((OCompositeKey) key).getKeys().size() == keySize)
      k = (K) key;
    else if (partialSearchMode.equals(PartialSearchMode.NONE))
      k = (K) key;
    else {
      final OCompositeKey fullKey = new OCompositeKey((Comparable<? super K>) key);
      int itemsToAdd = keySize - fullKey.getKeys().size();

      final Comparable<?> keyItem;
      if (partialSearchMode.equals(PartialSearchMode.HIGHEST_BOUNDARY))
        keyItem = ALWAYS_GREATER_KEY;
      else
        keyItem = ALWAYS_LESS_KEY;

      for (int i = 0; i < itemsToAdd; i++)
        fullKey.addKey(keyItem);

      k = (K) fullKey;
    }
    return k;
  }
View Full Code Here

Examples of com.orientechnologies.orient.core.index.OCompositeKey

  private OMVRBTreeEntry<K, V> adjustSearchResult(final OCompositeKey key, final PartialSearchMode partialSearchMode,
      final OMVRBTreeEntry<K, V> foundEntry) {
    if (partialSearchMode.equals(PartialSearchMode.NONE))
      return foundEntry;

    final OCompositeKey keyToSearch = key;
    final OCompositeKey foundKey = (OCompositeKey) foundEntry.getKey();

    if (keyToSearch.getKeys().size() < keySize) {
      final OCompositeKey borderKey = new OCompositeKey();
      final OCompositeKey keyToCompare = new OCompositeKey();

      final List<Object> keyItems = foundKey.getKeys();

      for (int i = 0; i < keySize - 1; i++) {
        final Object keyItem = keyItems.get(i);
        borderKey.addKey(keyItem);

        if (i < keyToSearch.getKeys().size())
          keyToCompare.addKey(keyItem);
      }

      if (partialSearchMode.equals(PartialSearchMode.HIGHEST_BOUNDARY))
        borderKey.addKey(ALWAYS_GREATER_KEY);
      else
View Full Code Here

Examples of com.orientechnologies.orient.core.index.OCompositeKey

            keyContainer = entry.field("k");
          }
          if (keyContainer != null) {
            final Object storedKey = keyContainer.field("key");
            if (storedKey instanceof List)
              key = new OCompositeKey((List<? extends Comparable<?>>) storedKey);
            else if (Boolean.TRUE.equals(keyContainer.field("binary"))) {
              key = OStreamSerializerAnyStreamable.INSTANCE.fromStream((byte[]) storedKey);
            } else
              key = storedKey;
          } else
View Full Code Here

Examples of com.orientechnologies.orient.core.index.OCompositeKey

    Set<OIndex<?>> indexes = clazz.getInvolvedIndexes(Arrays.asList(iKey));
    if (indexes.iterator().hasNext()) {
      final OIndex<?> idx = indexes.iterator().next();
      if (idx != null) {
        List<Object> keys = Arrays.asList(convertKeys(idx, iValue));
        OCompositeKey compositeKey = new OCompositeKey(keys);
        Object indexValue = idx.get(compositeKey);
        if (indexValue != null && !(indexValue instanceof Iterable<?>))
          indexValue = Arrays.asList(indexValue);

        return new OrientElementIterable<Vertex>(this, (Iterable<?>) indexValue);
View Full Code Here

Examples of com.orientechnologies.orient.core.index.OCompositeKey

      Assert.assertTrue(rids.remove(document.<OIdentifiable> field("rid").getIdentity()));
    }

    while (true) {
      result = databaseDocumentTx.query(new OSQLSynchQuery<ODocument>(
          "select from index:IndexPaginationTest where key > ? limit 5  order by key"), new OCompositeKey(lastKey, lastRid));
      if (result.isEmpty())
        break;

      Assert.assertEquals(result.size(), 5);
View Full Code Here

Examples of com.orientechnologies.orient.core.index.OCompositeKey

      Assert.assertTrue(rids.remove(document.<ORID> field("rid")));
    }

    while (true) {
      result = databaseDocumentTx.query(new OSQLSynchQuery<ODocument>(
          "select from index:IndexPaginationTestDescOrder where key < ? limit 5  order by key desc"), new OCompositeKey(lastKey,
          lastRid));
      if (result.isEmpty())
        break;

      Assert.assertEquals(result.size(), 5);
View Full Code Here

Examples of com.orientechnologies.orient.core.index.OCompositeKey

      doc.save();

    graph.setCurrentGraphInThreadLocal();
    graph.autoStartTransaction();
    underlying.put(keyTemp, doc);
    recordKeyValueIndex.put(new OCompositeKey(doc.getIdentity(), keyTemp), doc.getIdentity());
  }
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.