public boolean deserializeProperties()

in core/src/main/java/com/jetbrains/youtrackdb/internal/core/record/impl/EntityImpl.java [3181:3281]


  public boolean deserializeProperties(String... propertyNames) {
    if (status != STATUS.LOADED) {
      return false;
    }

    List<String> additional = null;
    if (source == null)
    // ALREADY UNMARSHALLED OR JUST EMPTY
    {
      return true;
    }

    checkForBinding();
    if (propertyNames != null && propertyNames.length > 0) {
      // EXTRACT REAL FIELD NAMES
      for (final var f : propertyNames) {
        if (f != null && !(!f.isEmpty() && f.charAt(0) == '@')) {
          var pos1 = f.indexOf('[');
          var pos2 = f.indexOf('.');
          if (pos1 > -1 || pos2 > -1) {
            var pos = pos1 > -1 ? pos1 : pos2;
            if (pos2 > -1 && pos2 < pos) {
              pos = pos2;
            }

            // REPLACE THE FIELD NAME
            if (additional == null) {
              additional = new ArrayList<>();
            }
            additional.add(f.substring(0, pos));
          }
        }
      }

      if (additional != null) {
        var copy = new String[propertyNames.length + additional.size()];
        System.arraycopy(propertyNames, 0, copy, 0, propertyNames.length);
        var next = propertyNames.length;
        for (var s : additional) {
          copy[next++] = s;
        }
        propertyNames = copy;
      }

      // CHECK IF HAS BEEN ALREADY UNMARSHALLED
      if (properties != null && !properties.isEmpty()) {
        var allFound = true;
        for (var f : propertyNames) {
          if (f != null && !(!f.isEmpty() && f.charAt(0) == '@') && !properties.containsKey(
              f)) {
            allFound = false;
            break;
          }
        }

        if (allFound)
        // ALL THE REQUESTED FIELDS HAVE BEEN LOADED BEFORE AND AVAILABLE, AVOID UNMARSHALLING
        {
          return true;
        }
      }
    }

    status = RecordElement.STATUS.UNMARSHALLING;
    try {
      checkForProperties();
      recordSerializer.fromStream(session, source, this, propertyNames);
    } finally {
      status = RecordElement.STATUS.LOADED;
    }

    if (propertyNames != null && propertyNames.length > 0) {
      for (var property : propertyNames) {
        if (property != null && !property.isEmpty() && property.charAt(0) == '@')
        // ATTRIBUTE
        {
          return true;
        }
      }

      // PARTIAL UNMARSHALLING
      if (properties != null && !properties.isEmpty()) {
        for (var f : propertyNames) {
          if (f != null && properties.containsKey(f)) {
            return true;
          }
        }
      }

      // NO FIELDS FOUND
      return false;
    } else {
      if (source != null)
      // FULL UNMARSHALLING
      {
        source = null;
      }
    }

    return true;
  }