Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ACS-6460: T-options overwrite themselves when having the same name #899

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@
import java.util.Map;
import java.util.Set;
import java.util.StringJoiner;
import java.util.TreeSet;
import java.util.function.Function;
import java.util.stream.Collectors;

import static java.util.stream.Collectors.toSet;
import static org.alfresco.transform.config.CoreVersionDecorator.setCoreVersionOnMultiStepTransformers;
import static org.alfresco.transform.registry.TransformRegistryHelper.TRANSFORM_OPTIONS_KEY_PATTERN;

/**
* This class combines one or more T-Engine config and local files and registers them as if they were all in one file.
Expand Down Expand Up @@ -104,7 +104,8 @@ public void addTransformConfig(TransformConfig transformConfig, String readFrom,
overrideSupported(transformConfig.getOverrideSupported(), readFrom, registry);

// Add transform options and transformers from the new transformConfig
transformConfig.getTransformOptions().forEach(combinedTransformOptions::put);
transformConfig.getTransformOptions().forEach(
(optionsName, options) -> combinedTransformOptions.put(String.format(TRANSFORM_OPTIONS_KEY_PATTERN, readFrom, optionsName), options));
transformConfig.getTransformers().forEach(t -> combinedTransformers.add(new Origin<>(t, baseUrl, readFrom)));
}

Expand Down Expand Up @@ -411,7 +412,7 @@ private int removeInvalidTransformer(int i, List<Origin<Transformer>> combinedTr

for (String transformOptionsLabel : transformer.getTransformOptions())
{
if (!combinedTransformOptions.containsKey(transformOptionsLabel))
if (!combinedTransformOptions.containsKey(String.format(TRANSFORM_OPTIONS_KEY_PATTERN, readFrom, transformOptionsLabel)))
{
throw new IllegalStateException("Transformer " + transformerName(name) +
" references \"" + transformOptionsLabel +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@

class TransformRegistryHelper
{
public static final String TRANSFORM_OPTIONS_KEY_PATTERN = "%s-%s";

private TransformRegistryHelper()
{
}
Expand All @@ -60,7 +62,7 @@ static Set<TransformOption> lookupTransformOptions(final Set<String> transformOp
final Set<TransformOption> options = new HashSet<>();
for (String name : transformOptionNames)
{
final Set<TransformOption> oneSetOfTransformOptions = transformOptions.get(name);
final Set<TransformOption> oneSetOfTransformOptions = transformOptions.get(String.format(TRANSFORM_OPTIONS_KEY_PATTERN, readFrom, name));
if (oneSetOfTransformOptions == null)
{
logError.accept("transformOptions in " + readFrom + " with the name " + name +
Expand Down
Loading