void ComponentManifest::serializeClassDescription()

in libminifi/src/core/state/nodes/AgentInformation.cpp [43:145]


void ComponentManifest::serializeClassDescription(const std::vector<ClassDescription>& descriptions, const std::string& name, SerializedResponseNode& response) {
  if (descriptions.empty()) {
    return;
  }
  SerializedResponseNode type{.name = name, .array = true};
  std::vector<SerializedResponseNode> serialized;
  for (const auto& group : descriptions) {
    SerializedResponseNode desc{.name = group.full_name_};

    if (!group.class_properties_.empty()) {
      SerializedResponseNode props{.name = "propertyDescriptors"};
      for (auto&& prop : group.class_properties_) {
        SerializedResponseNode child = {.name = prop.getName()};
        SerializedResponseNode descriptorDependentProperties{.name = "dependentProperties"};
        for (const auto &propName : prop.getDependentProperties()) {
          SerializedResponseNode descriptorDependentProperty{.name = propName};
          descriptorDependentProperties.children.push_back(descriptorDependentProperty);
        }

        SerializedResponseNode descriptorExclusiveOfProperties{.name = "exclusiveOfProperties"};

        for (const auto &exclusiveProp : prop.getExclusiveOfProperties()) {
          SerializedResponseNode descriptorExclusiveOfProperty{.name = exclusiveProp.first, .value = exclusiveProp.second};
          descriptorExclusiveOfProperties.children.push_back(descriptorExclusiveOfProperty);
        }

        const auto &allowed_types = prop.getAllowedTypes();
        if (!allowed_types.empty()) {
          SerializedResponseNode allowed_type;
          allowed_type.name = "typeProvidedByValue";
          for (const auto &type : allowed_types) {
            std::string class_name = utils::StringUtils::split(type, "::").back();
            std::string typeClazz = type;
            utils::StringUtils::replaceAll(typeClazz, "::", ".");
            allowed_type.children.push_back({.name = "type", .value = typeClazz});
            allowed_type.children.push_back({.name = "group", .value = GROUP_STR});
            allowed_type.children.push_back({.name = "artifact", .value = core::ClassLoader::getDefaultClassLoader().getGroupForClass(class_name).value_or("")});
          }
          child.children.push_back(allowed_type);
        }

        child.children.push_back({.name = "name", .value = prop.getName()});

        if (prop.getName() != prop.getDisplayName()) {
          SerializedResponseNode displayName{.name = "displayName", .value = prop.getDisplayName()};
          child.children.push_back(displayName);
        }

        child.children.push_back({.name = "description", .value = prop.getDescription()});
        child.children.push_back({.name = "validator", .value = std::string{prop.getValidator().getValidatorName()}});
        child.children.push_back({.name = "required", .value = prop.getRequired()});
        child.children.push_back({.name = "expressionLanguageScope", .value = prop.supportsExpressionLanguage() ? "FLOWFILE_ATTRIBUTES" : "NONE"});
        child.children.push_back({.name = "defaultValue", .value = prop.getValue()});
        child.children.push_back(descriptorDependentProperties);
        child.children.push_back(descriptorExclusiveOfProperties);

        if (!prop.getAllowedValues().empty()) {
          SerializedResponseNode allowedValues{.name = "allowableValues", .array = true};
          for (const auto &av : prop.getAllowedValues()) {
            SerializedResponseNode allowableValue{
              .name = "allowableValues",
              .children = {
                {.name = "value", .value = av},
                {.name = "displayName", .value = av},
              }
            };

            allowedValues.children.push_back(allowableValue);
          }
          child.children.push_back(allowedValues);
        }

        props.children.push_back(child);
      }

      desc.children.push_back(props);
    }

    // only for processors
    if (!group.class_relationships_.empty()) {
      desc.children.push_back({.name = "inputRequirement", .value = group.inputRequirement_});
      desc.children.push_back({.name = "isSingleThreaded", .value = group.isSingleThreaded_});

      SerializedResponseNode relationships{.name = "supportedRelationships", .array = true};
      for (const auto &relationship : group.class_relationships_) {
        SerializedResponseNode child{.name = "supportedRelationships"};
        child.children.push_back({.name = "name", .value = relationship.getName()});
        child.children.push_back({.name = "description", .value = relationship.getDescription()});
        relationships.children.push_back(child);
      }

      desc.children.push_back(relationships);
    }

    desc.children.push_back({.name = "typeDescription", .value = group.description_});
    desc.children.push_back({.name = "supportsDynamicRelationships", .value = group.supports_dynamic_relationships_});
    desc.children.push_back({.name = "supportsDynamicProperties", .value = group.supports_dynamic_properties_});
    desc.children.push_back({.name = "type", .value = group.full_name_});

    type.children.push_back(desc);
  }
  response.children.push_back(type);
}