/** * Set the function of a component. Delegates to annotation/databind based parsing of a * {@link org.dswarm.persistence.model.job.Function} * * @param jp the current json parser * @param component the target {@code Component} * @throws IOException */ private static void setFunction(final JsonParser jp, final Component component) throws IOException { final Function function = jp.readValueAs(Function.class); component.setFunction(function); }
/** * {@inheritDoc}<br/> * Clears the relationship to the function, input components and output components. */ @Override protected void prepareObjectForRemoval(final Component object) { // release connections to other objects object.setFunction(null); object.setInputComponents(null); object.setOutputComponents(null); }
/** * {@inheritDoc}<br/> * Clears the relationship to the input attribute paths, output attribute path, input filter and output filter. */ @Override protected void prepareObjectForRemoval(final Mapping object) { // should clear the relationship to the input attribute paths, output attribute path + transformation function object.setInputAttributePaths(null); object.setOutputAttributePath(null); final Component transformation = object.getTransformation(); if (transformation != null) { transformation.setFunction(null); } }
/** * {@inheritDoc}<br/> * Clears the relationship to the functions of the components and decouples the components from each other. */ @Override protected void prepareObjectForRemoval(final Transformation object) { final Set<Component> components = object.getComponents(); if (components != null) { final Set<Component> componentsToBeDeleted = Sets.newCopyOnWriteArraySet(components); for (final Component component : componentsToBeDeleted) { // release functions from components of a transformation // and disconnect components from each other component.setFunction(null); component.setInputComponents(null); component.setOutputComponents(null); } } TransformationService.LOG.trace("transformation after prepare for removal: " + ToStringBuilder.reflectionToString(object)); }
private void replaceFunctionsInComponent(final Component component) throws DMPPersistenceException { if (component == null) { return; } final Function existingComponentFunction = component.getFunction(); final FunctionType componentFunctionFunctionType = existingComponentFunction.getFunctionType(); switch (componentFunctionFunctionType) { case Function: final Function persistentFunction = replaceFunction(existingComponentFunction); component.setFunction(persistentFunction); break; case Transformation: replaceFunctionsInTransformation((Transformation) existingComponentFunction); break; } }
/** * {@inheritDoc} */ @Override public void updateObjectInternal(final Component object, final Component updateObject) throws DMPPersistenceException { super.updateObjectInternal(object, updateObject); final Function function = object.getFunction(); final Set<Component> inputComponents = object.getInputComponents(); final Set<Component> outputComponents = object.getOutputComponents(); final Map<String, String> parameterMappings = object.getParameterMappings(); // final Transformation transformation = object.getTransformation(); updateObject.setFunction(function); updateObject.setInputComponents(inputComponents); updateObject.setOutputComponents(outputComponents); updateObject.setParameterMappings(parameterMappings); // updateObject.setTransformation(transformation); }
component.setFunction(function); component.setParameterMappings(parameterMapping);
/** * Create a new {@code Component} as a copy from a existing component with a specific id. <br> * <b>Use with care!</b> * <p> * This factory is to be used by {@link org.dswarm.persistence.model.job.utils.TransformationDeserializer} to avoid reflection * based access to a private/protected field, since the Json deserializer needs a way to set the id that was provided by the * JSON. * </p> * <p> * The id is otherwise assigned by the database/Hibernate layer. You should never need this outside of * {@code TransformationDeserializer}. * </p> * * @param component the base component that will be copied * @param uuid the target component's id value * @return a new component with the given id and all other attributes copied from the provided component. */ public static Component withId(final Component component, final String uuid) { final Component newComponent = new Component(uuid); newComponent.setFunction(component.getFunction()); newComponent.setInputComponents(component.getInputComponents()); newComponent.setOutputComponents(component.getOutputComponents()); newComponent.setParameterMappings(component.getParameterMappings()); newComponent.setDescription(component.getDescription()); newComponent.setName(component.getName()); return newComponent; } }
component.setFunction(function); component.setParameterMappings(parameterMapping);
component1.setFunction(function1); component1.setParameterMappings(parameterMapping1); component2.setFunction(function2); component2.setParameterMappings(parameterMapping2); component.setFunction(function); component.setParameterMappings(parameterMapping); component.setInputComponents(inputComponents);
component1.setFunction(function1); component1.setParameterMappings(parameterMapping1); component2.setFunction(function2); component2.setParameterMappings(parameterMapping2); component.setFunction(function); component.setParameterMappings(parameterMapping); component.setInputComponents(inputComponents); transformationComponent.setFunction(transformation); transformationComponent.setParameterMappings(transformationComponentParameterMappings); transformationComponent2.setFunction(transformation); transformationComponent2.setParameterMappings(transformationComponentParameterMappings2); component4.setFunction(function4); component4.setParameterMappings(parameterMapping4); transformationComponent3.setFunction(transformation2); transformationComponent3.setParameterMappings(transformationComponent3ParameterMappings);
component1.setFunction(function1); component1.setParameterMappings(parameterMapping1); component2.setFunction(function2); component2.setParameterMappings(parameterMapping2); component.setFunction(function); component.setParameterMappings(parameterMapping); component.setInputComponents(inputComponents); transformationComponent.setFunction(transformation); transformationComponent.setParameterMappings(transformationComponentParameterMappings); transformationComponent2.setFunction(transformation); transformationComponent2.setParameterMappings(transformationComponentParameterMappings2); component4.setFunction(function4); component4.setParameterMappings(parameterMapping4); transformationComponent3.setFunction(transformation2); transformationComponent3.setParameterMappings(transformationComponent3ParameterMappings);
component1.setFunction(function1); component1.setParameterMappings(parameterMapping1); component2.setFunction(function2); component2.setParameterMappings(parameterMapping2); component.setFunction(function); component.setParameterMappings(parameterMapping); component.setInputComponents(inputComponents);
object.setFunction(objectWithUpdates.getFunction()); object.setParameterMappings(objectWithUpdates.getParameterMappings());
public Component createComponent(final String name, final Map<String, String> parameterMappings, final Function function, final Set<Component> inputComponents, final Set<Component> outputComponents) throws Exception { // component needs to be a persistent object from the beginning final Component component = createObject().getObject(); component.setName(name); component.setFunction(function); component.setParameterMappings(parameterMappings); if (inputComponents != null) { component.setInputComponents(inputComponents); } if (outputComponents != null) { component.setOutputComponents(outputComponents); } // update method needs to be utilised here, because component was already created final Component updatedComponent = updateAndCompareObject(component, component); Assert.assertNotNull("the updated component shouldn't be null", updatedComponent); Assert.assertNotNull("the component name shouldn't be null", updatedComponent.getUuid()); return updatedComponent; }
component.setFunction(function); component.setParameterMappings(parameterMappings); transformationComponent.setFunction(transformation); transformationComponent.setParameterMappings(transformationComponentParameterMappings);
component.setFunction(function); component.setParameterMappings(parameterMappings); transformationComponent.setFunction(transformation); transformationComponent.setParameterMappings(transformationComponentParameterMappings);
component.setFunction(function); component.setParameterMappings(parameterMappings); transformationComponent.setFunction(transformation); transformationComponent.setParameterMappings(transformationComponentParameterMappings);
component.setFunction(function); component.setParameterMappings(parameterMappings); transformationComponent.setFunction(transformation); transformationComponent.setParameterMappings(transformationComponentParameterMappings);
component.setFunction(function); component.setParameterMappings(parameterMappings); transformationComponent.setFunction(transformation); transformationComponent.setParameterMappings(transformationComponentParameterMappings);