/** * Adds a new input component to the collection of input components of this component.<br> * Created by: tgaengler * * @param inputComponent a new input component */ public void addInputComponent(final Component inputComponent) { if (inputComponent != null) { if (inputComponents == null) { inputComponents = Sets.newCopyOnWriteArraySet(); } if (!inputComponents.contains(inputComponent)) { inputComponents.add(inputComponent); inputComponent.addOutputComponent(this); } } }
/** * Sets the input components collections. * * @param inputComponentsArg the new input components collection */ public void setInputComponents(final Set<Component> inputComponentsArg) { if (inputComponentsArg == null && inputComponents != null) { // remove component from input components, if component will be prepared for removal final Set<Component> componentsToBeDeleted = Sets.newCopyOnWriteArraySet(inputComponents); for (final Component inputComponent : componentsToBeDeleted) { inputComponent.removeOutputComponent(this); } inputComponents.clear(); } if (inputComponentsArg != null) { if (inputComponents == null) { inputComponents = Sets.newCopyOnWriteArraySet(); } // if (!inputComponents.equals(inputComponentsArg)) { if (!DMPPersistenceUtil.getComponentUtils().completeEquals(inputComponents, inputComponentsArg)) { inputComponents.clear(); inputComponents.addAll(inputComponentsArg); } for (final Component inputComponent : inputComponentsArg) { inputComponent.addOutputComponent(this); } } }
/** * Link all input and output components. the input and output components are given as a list of ids and need to be resolved to * actual {@code Component}s. This happens primarily against the components of the current Json or against the database, if * the component wasn't defined within the current Json. * * @param components a map of (id -> {@code Component}) * @param inOutComponents a map of (id -> list ( inIds, outIds ) ) */ private void linkInOutComponents(final Map<String, Component> components, final Map<String, Tuple<List<String>, List<String>>> inOutComponents) { final ComponentService componentService = TransformationDeserializer.getComponentService(deserializationContext); for (final String componentId : components.keySet()) { final Tuple<List<String>, List<String>> inOut = inOutComponents.get(componentId); if (inOut != null) { final List<String> inputComponentIds = inOut.v1(); final List<String> outputComponentIds = inOut.v2(); final List<Component> inputComponents = TransformationDeserializer.lookupComponents(inputComponentIds, components, componentService); final List<Component> outputComponents = TransformationDeserializer .lookupComponents(outputComponentIds, components, componentService); final Component component = components.get(componentId); for (final Component inputComponent : inputComponents) { component.addInputComponent(inputComponent); } for (final Component outputComponent : outputComponents) { component.addOutputComponent(outputComponent); } } } }
inputComponent.addOutputComponent(object);