Search in sources :

Example 1 with MultilevelMetadataKeyBuilder

use of org.mule.runtime.module.extension.api.metadata.MultilevelMetadataKeyBuilder in project mule by mulesoft.

the class MetadataKeysDelegate method cloneAndEnrichMetadataKey.

/**
 * Given a {@link MetadataKey}, this is navigated recursively cloning each {@link MetadataKey} of the tree structure creating a
 * {@link MultilevelMetadataKeyBuilder} and adding the partName of each {@link MetadataKey} found.
 *
 * @param key              {@link MetadataKey} to be cloned and enriched
 * @param partOrderMapping {@link Map} that contains the mapping of the name of each part of the {@link MetadataKey}
 * @param level            the current level of the part of the {@link MetadataKey} to be cloned and enriched
 * @return a {@link MetadataKeyBuilder} with the cloned and enriched keys
 */
private MetadataKeyBuilder cloneAndEnrichMetadataKey(MetadataKey key, Map<Integer, ParameterModel> partOrderMapping, int level) {
    final MetadataKeyBuilder keyBuilder = newKey(key.getId(), partOrderMapping.get(level).getName()).withDisplayName(key.getDisplayName());
    key.getProperties().forEach(keyBuilder::withProperty);
    key.getChilds().forEach(childKey -> keyBuilder.withChild(cloneAndEnrichMetadataKey(childKey, partOrderMapping, level + 1)));
    return keyBuilder;
}
Also used : MultilevelMetadataKeyBuilder(org.mule.runtime.module.extension.api.metadata.MultilevelMetadataKeyBuilder) MetadataKeyBuilder(org.mule.runtime.api.metadata.MetadataKeyBuilder)

Aggregations

MetadataKeyBuilder (org.mule.runtime.api.metadata.MetadataKeyBuilder)1 MultilevelMetadataKeyBuilder (org.mule.runtime.module.extension.api.metadata.MultilevelMetadataKeyBuilder)1