Examples of ORecordLazySet


Examples of com.orientechnologies.orient.core.db.record.ORecordLazySet

    try {
      Set<OIdentifiable> values = map.get(iKey);

      if (values == null)
        values = new ORecordLazySet(configuration.getDatabase());
      else
        values.clear();

      values.add(iSingleValue);
View Full Code Here

Examples of com.orientechnologies.orient.core.db.record.ORecordLazySet

    } else if (Set.class.isAssignableFrom(iType) && !(iValue instanceof Set)) {
      // CONVERT IT TO SET
      final Collection<?> newValue;

      if (iValue instanceof ORecordLazyList || iValue instanceof ORecordLazyMap)
        newValue = new ORecordLazySet(this);
      else
        newValue = new OTrackedSet<Object>(this);

      if (iValue instanceof Collection<?>)
        ((Collection<Object>) newValue).addAll((Collection<Object>) iValue);
View Full Code Here

Examples of com.orientechnologies.orient.core.db.record.ORecordLazySet

    acquireExclusiveLock();

    try {
      Set<OIdentifiable> values = map.get(iKey);
      if (values == null)
        values = new ORecordLazySet(configuration.getDatabase());

      if (!iSingleValue.getIdentity().isValid())
        ((ORecord<?>) iSingleValue).save();

      values.add(iSingleValue);
View Full Code Here

Examples of com.orientechnologies.orient.core.db.record.ORecordLazySet

    try {
      Set<OIdentifiable> values = map.get(iKey);

      if (values == null)
        values = new ORecordLazySet(configuration.getDatabase());
      else if (values.size() == 1) {
        // CHECK IF THE ID IS THE SAME OF CURRENT: THIS IS THE UPDATE CASE
        if (!values.contains(iSingleValue))
          throw new OIndexException("Found duplicated key '" + iKey + "' on unique index '" + name + "'");
        else
View Full Code Here

Examples of com.orientechnologies.orient.core.db.record.ORecordLazySet

      try {
        // SEARCH FOR THE WORD
        refs = map.get(word);
        if (refs == null)
          // WORD NOT EXISTS: CREATE THE KEYWORD CONTAINER THE FIRST TIME THE WORD IS FOUND
          refs = new ORecordLazySet(configuration.getDatabase());

        // ADD THE CURRENT DOCUMENT AS REF FOR THAT WORD
        refs.add(iSingleValue);

        // SAVE THE INDEX ENTRY
View Full Code Here

Examples of com.orientechnologies.orient.core.db.record.ORecordLazySet

      final ODocument edge = new ODocument(this, iClassName != null ? iClassName : EDGE_CLASS_NAME);
      edge.field(EDGE_FIELD_OUT, iOutVertex);
      edge.field(EDGE_FIELD_IN, iInVertex);

      ORecordLazySet outEdges = ((ORecordLazySet) iOutVertex.field(VERTEX_FIELD_OUT_EDGES));
      if (outEdges == null) {
        outEdges = new ORecordLazySet(iOutVertex);
        iOutVertex.field(VERTEX_FIELD_OUT_EDGES, outEdges);
      }
      outEdges.add(edge);

      ORecordLazySet inEdges = ((ORecordLazySet) iInVertex.field(VERTEX_FIELD_IN_EDGES));
      if (inEdges == null) {
        inEdges = new ORecordLazySet(iInVertex);
        iInVertex.field(VERTEX_FIELD_IN_EDGES, inEdges);
      }
      inEdges.add(edge);

      if (safeMode) {
        save(edge);
        commitBlock(safeMode);
      }
View Full Code Here

Examples of com.orientechnologies.orient.core.db.record.ORecordLazySet

  public Set<OIdentifiable> getOutEdges(final ODocument iVertex, final String iLabel) {
    if (!iVertex.getSchemaClass().isSubClassOf(vertexBaseClass))
      throw new IllegalArgumentException("The document received is not a vertex");

    final ORecordLazySet set = iVertex.field(VERTEX_FIELD_OUT_EDGES);

    if (iLabel == null)
      // RETURN THE ENTIRE COLLECTION
      if (set != null)
        return Collections.unmodifiableSet(set);
      else
        return Collections.emptySet();

    // FILTER BY LABEL
    final ORecordLazySet result = new ORecordLazySet(underlying);
    if (set != null)
      for (OIdentifiable item : set) {
        if (iLabel == null || iLabel.equals(((ODocument) item).field(LABEL)))
          result.add(item);
      }

    return result;
  }
View Full Code Here

Examples of com.orientechnologies.orient.core.db.record.ORecordLazySet

  public Set<OIdentifiable> getInEdges(final ODocument iVertex, final String iLabel) {
    if (!iVertex.getSchemaClass().isSubClassOf(vertexBaseClass))
      throw new IllegalArgumentException("The document received is not a vertex");

    final ORecordLazySet set = iVertex.field(VERTEX_FIELD_IN_EDGES);

    if (iLabel == null)
      // RETURN THE ENTIRE COLLECTION
      if (set != null)
        return Collections.unmodifiableSet(set);
      else
        return Collections.emptySet();

    // FILTER BY LABEL
    final ORecordLazySet result = new ORecordLazySet(underlying);
    if (set != null)
      for (OIdentifiable item : set) {
        if (iLabel == null || iLabel.equals(((ODocument) item).field(LABEL)))
          result.add(item);
      }

    return result;
  }
View Full Code Here

Examples of com.orientechnologies.orient.core.db.record.ORecordLazySet

  public Set<OIdentifiable> get(final Object iKey) {
    acquireExclusiveLock();
    try {

      final ORecordLazySet values = (ORecordLazySet) map.get(iKey);
      if (values != null)
        values.setDatabase(ODatabaseRecordThreadLocal.INSTANCE.get());

      if (values == null)
        return ORecordLazySet.EMPTY_SET;

      return values;
View Full Code Here

Examples of com.orientechnologies.orient.core.db.record.ORecordLazySet

    try {
      final ONavigableMap<Object, Set<OIdentifiable>> subSet = map.subMap(iRangeFrom, iInclusive, iRangeTo, iInclusive);
      if (subSet == null)
        return ORecordLazySet.EMPTY_SET;

      final Set<OIdentifiable> result = new ORecordLazySet(configuration.getDatabase());
      for (Set<OIdentifiable> v : subSet.values()) {
        result.addAll(v);
      }

      return result;

    } finally {
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.