You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@taverna.apache.org by re...@apache.org on 2015/03/26 19:52:13 UTC
[24/51] [partial] incubator-taverna-workbench git commit: all
packages are moved to org.apache.taverna.*
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/net/sf/taverna/t2/workbench/edits/package-info.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workbench/edits/package-info.java b/taverna-edits-api/src/main/java/net/sf/taverna/t2/workbench/edits/package-info.java
deleted file mode 100644
index c1df7c9..0000000
--- a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workbench/edits/package-info.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-/**
- * A {@link net.sf.taverna.t2.workbench.edits.EditManager} that can manage
- * {@link net.sf.taverna.t2.workflowmodel.Edit}s performed from the UI.
- * <p>
- * To perform an edit that is to be undoable, use
- * {@link EditManager#doDataflowEdit(net.sf.taverna.t2.workflowmodel.Dataflow, net.sf.taverna.t2.workflowmodel.Edit)}
- * instead of {@link net.sf.taverna.t2.workflowmodel.Edit#doEdit()}. Such edits
- * can be
- * {@link EditManager#undoDataflowEdit(net.sf.taverna.t2.workflowmodel.Dataflow) undone}
- * and
- * {@link EditManager#redoDataflowEdit(net.sf.taverna.t2.workflowmodel.Dataflow) redone}.
- * </p>
- * <p>
- * Edits are organised by {@link net.sf.taverna.t2.workflowmodel.Dataflow} so
- * that if a user changes the active workflow in the Workbench and does "Undo" -
- * that would undo the last undo done related to that workflow.
- * </p>
- * <p>
- * The {@link net.sf.taverna.t2.workbench.edits.impl} implementation of the
- * EditManager is discovered by {@link net.sf.taverna.t2.workbench.edits.EditManager#getInstance()}. The
- * implementation also includes {@link net.sf.taverna.t2.ui.menu.MenuComponent}s
- * for Undo and Redo.
- * </p>
- *
- * @author Stian Soiland-Reyes
- *
- */
-package net.sf.taverna.t2.workbench.edits;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AbstractEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AbstractEdit.java b/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AbstractEdit.java
deleted file mode 100644
index 3f03282..0000000
--- a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AbstractEdit.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007-2008 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflow.edits;
-
-import net.sf.taverna.t2.workbench.edits.Edit;
-import net.sf.taverna.t2.workbench.edits.EditException;
-import org.apache.taverna.scufl2.api.common.Scufl2Tools;
-import org.apache.taverna.scufl2.api.common.WorkflowBean;
-
-/**
- * An abstract {@link Edit} implementation that checks if an edit has been
- * applied or not.
- *
- * @author Stian Soiland-Reyes
- *
- * @param <Subject>
- * Subject of this edit
- */
-public abstract class AbstractEdit<Subject extends WorkflowBean> implements
- Edit<Subject> {
- private boolean applied = false;
- private final Subject subject;
- protected final Scufl2Tools scufl2Tools = new Scufl2Tools();
-
- /**
- * Construct an AbstractEdit.
- *
- * @param subjectType
- * The expected implementation type of the subject. The edit will
- * not go through unless the subject is an instance of this type.
- * If the edit don't care about the implementation type, provide
- * the official SubjectInterface instead.
- * @param subject
- * The subject of this edit
- */
- public AbstractEdit(Subject subject) {
- if (subject == null && !isNullSubjectAllowed())
- throw new IllegalArgumentException(
- "Cannot construct an edit with null subject");
- this.subject = subject;
- }
-
- protected boolean isNullSubjectAllowed() {
- return false;
- }
-
- @Override
- public final Subject doEdit() throws EditException {
- if (applied)
- throw new EditException("Edit has already been applied!");
- try {
- synchronized (subject) {
- doEditAction(subject);
- applied = true;
- return this.subject;
- }
- } catch (EditException ee) {
- applied = false;
- throw ee;
- }
- }
-
- /**
- * Do the actual edit here
- *
- * @param subject
- * The instance to which the edit applies
- * @throws EditException
- */
- protected abstract void doEditAction(Subject subject)
- throws EditException;
-
- /**
- * Undo any edit effects here
- *
- * @param subject
- * The instance to which the edit applies
- */
- protected abstract void undoEditAction(Subject subject);
-
- @Override
- public final Subject getSubject() {
- return subject;
- }
-
- @Override
- public final boolean isApplied() {
- return applied;
- }
-
- @Override
- public final void undo() {
- if (!applied)
- throw new RuntimeException(
- "Attempt to undo edit that was never applied");
- synchronized (subject) {
- undoEditAction(subject);
- applied = false;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddActivityEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddActivityEdit.java b/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddActivityEdit.java
deleted file mode 100644
index fe6e3ef..0000000
--- a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddActivityEdit.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflow.edits;
-
-import org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.scufl2.api.core.Processor;
-import org.apache.taverna.scufl2.api.profiles.ProcessorBinding;
-
-/**
- * Creates a ProcessorBinding binding for the Activity and Processor and adds the binding to the
- * Profile containing the Activity.
- *
- * @author David Withers
- */
-public class AddActivityEdit extends AbstractEdit<Processor> {
- private Activity activity;
- private ProcessorBinding addedProcessorBinding;
-
- public AddActivityEdit(Processor processor, Activity activity) {
- super(processor);
- this.activity = activity;
- }
-
- @Override
- protected void doEditAction(Processor processor) {
- ProcessorBinding binding = new ProcessorBinding();
- binding.setBoundProcessor(processor);
- binding.setBoundActivity(activity);
- binding.setParent(activity.getParent());
- addedProcessorBinding = binding;
- }
-
- @Override
- protected void undoEditAction(Processor processor) {
- addedProcessorBinding.setParent(null);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddActivityInputPortMappingEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddActivityInputPortMappingEdit.java b/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddActivityInputPortMappingEdit.java
deleted file mode 100644
index 0f084a4..0000000
--- a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddActivityInputPortMappingEdit.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflow.edits;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.scufl2.api.port.InputActivityPort;
-import org.apache.taverna.scufl2.api.port.InputProcessorPort;
-import org.apache.taverna.scufl2.api.profiles.ProcessorBinding;
-import org.apache.taverna.scufl2.api.profiles.ProcessorInputPortBinding;
-
-public class AddActivityInputPortMappingEdit extends AbstractEdit<Activity> {
- private final InputProcessorPort inputProcessorPort;
- private final InputActivityPort inputActivityPort;
- private List<ProcessorInputPortBinding> portBindings;
-
- public AddActivityInputPortMappingEdit(Activity activity,
- InputProcessorPort inputProcessorPort,
- InputActivityPort inputActivityPort) {
- super(activity);
- this.inputProcessorPort = inputProcessorPort;
- this.inputActivityPort = inputActivityPort;
- }
-
- @Override
- protected void doEditAction(Activity activity) {
- portBindings = new ArrayList<>();
- for (ProcessorBinding binding : scufl2Tools
- .processorBindingsToActivity(activity))
- portBindings.add(new ProcessorInputPortBinding(binding,
- inputProcessorPort, inputActivityPort));
- }
-
- @Override
- protected void undoEditAction(Activity activity) {
- for (ProcessorInputPortBinding binding : portBindings)
- binding.setParent(null);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddActivityOutputPortMappingEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddActivityOutputPortMappingEdit.java b/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddActivityOutputPortMappingEdit.java
deleted file mode 100644
index 10d2661..0000000
--- a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddActivityOutputPortMappingEdit.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflow.edits;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.scufl2.api.port.OutputActivityPort;
-import org.apache.taverna.scufl2.api.port.OutputProcessorPort;
-import org.apache.taverna.scufl2.api.profiles.ProcessorBinding;
-import org.apache.taverna.scufl2.api.profiles.ProcessorOutputPortBinding;
-
-public class AddActivityOutputPortMappingEdit extends AbstractEdit<Activity> {
- private final OutputProcessorPort outputProcessorPort;
- private final OutputActivityPort outputActivityPort;
- private List<ProcessorOutputPortBinding> portBindings;
-
- public AddActivityOutputPortMappingEdit(Activity activity,
- OutputProcessorPort outputProcessorPort,
- OutputActivityPort outputActivityPort) {
- super(activity);
- this.outputProcessorPort = outputProcessorPort;
- this.outputActivityPort = outputActivityPort;
- }
-
- @Override
- protected void doEditAction(Activity activity) {
- portBindings = new ArrayList<>();
- for (ProcessorBinding binding : scufl2Tools
- .processorBindingsToActivity(activity))
- portBindings.add(new ProcessorOutputPortBinding(binding,
- outputActivityPort, outputProcessorPort));
- }
-
- @Override
- protected void undoEditAction(Activity activity) {
- for (ProcessorOutputPortBinding binding : portBindings)
- binding.setParent(null);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddChildEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddChildEdit.java b/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddChildEdit.java
deleted file mode 100644
index f8c7bc5..0000000
--- a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddChildEdit.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflow.edits;
-
-import org.apache.taverna.scufl2.api.common.Child;
-import org.apache.taverna.scufl2.api.common.WorkflowBean;
-
-/**
- * Adds a child to a parent.
- *
- * @author David Withers
- */
-public class AddChildEdit<T extends WorkflowBean> extends AbstractEdit<T> {
- private Child<T> child;
-
- public AddChildEdit(T parent, Child<T> child) {
- super(parent);
- this.child = child;
- }
-
- @Override
- protected void doEditAction(T parent) {
- child.setParent(parent);
- }
-
- @Override
- protected void undoEditAction(T parent) {
- child.setParent(null);
- }
-
- public Child<T> getChild() {
- return child;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddDataLinkEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddDataLinkEdit.java b/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddDataLinkEdit.java
deleted file mode 100644
index 4126aae..0000000
--- a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddDataLinkEdit.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflow.edits;
-
-import java.util.List;
-
-import org.apache.taverna.scufl2.api.core.DataLink;
-import org.apache.taverna.scufl2.api.core.Workflow;
-import org.apache.taverna.scufl2.api.iterationstrategy.CrossProduct;
-import org.apache.taverna.scufl2.api.iterationstrategy.DotProduct;
-import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyParent;
-import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyTopNode;
-import org.apache.taverna.scufl2.api.iterationstrategy.PortNode;
-import org.apache.taverna.scufl2.api.port.InputProcessorPort;
-import org.apache.taverna.scufl2.api.port.ReceiverPort;
-
-/**
- * Adds a DataLink to a Workflow.
- * <p>
- * Handles setting the merge position of all dataLinks with the same receiver port.
- * <p>
- * Modifies the processor's iteration strategy or when the first DataLink is added.
- *
- * @author David Withers
- */
-public class AddDataLinkEdit extends AbstractEdit<Workflow> {
- private DataLink dataLink;
- private PortNode portNode;
-
- public AddDataLinkEdit(Workflow workflow, DataLink dataLink) {
- super(workflow);
- this.dataLink = dataLink;
- }
-
- @Override
- protected void doEditAction(Workflow workflow) {
- ReceiverPort sink = dataLink.getSendsTo();
- List<DataLink> datalinksTo = scufl2Tools.datalinksTo(sink);
- if (datalinksTo.size() > 0) {
- if (datalinksTo.size() == 1)
- datalinksTo.get(0).setMergePosition(0);
- dataLink.setMergePosition(datalinksTo.size());
- } else {
- dataLink.setMergePosition(null);
- if (sink instanceof InputProcessorPort) {
- InputProcessorPort inputProcessorPort = (InputProcessorPort) sink;
- for (IterationStrategyTopNode node : inputProcessorPort.getParent().getIterationStrategyStack()) {
- portNode = new PortNode(node, inputProcessorPort);
- portNode.setDesiredDepth(inputProcessorPort.getDepth());
- break;
- }
- }
- }
- dataLink.setParent(workflow);
- }
-
- @Override
- protected void undoEditAction(Workflow workflow) {
- dataLink.setParent(null);
- ReceiverPort sink = dataLink.getSendsTo();
- List<DataLink> datalinksTo = scufl2Tools.datalinksTo(sink);
- if (datalinksTo.size() == 1)
- datalinksTo.get(0).setMergePosition(null);
- else if (datalinksTo.isEmpty()&&portNode != null) {
- IterationStrategyParent parent = portNode.getParent();
- if (parent instanceof DotProduct)
- ((DotProduct) parent).remove(portNode);
- else if (parent instanceof CrossProduct)
- ((CrossProduct) parent).remove(portNode);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddIterationStrategyEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddIterationStrategyEdit.java b/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddIterationStrategyEdit.java
deleted file mode 100644
index 1644c31..0000000
--- a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddIterationStrategyEdit.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2011 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflow.edits;
-
-import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyStack;
-import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyTopNode;
-
-/**
- * Adds an IterationStrategyTopNode to an IterationStrategyStack.
- *
- * @author David Withers
- */
-public class AddIterationStrategyEdit extends AbstractEdit<IterationStrategyStack> {
- private final IterationStrategyTopNode iterationStrategyTopNode;
-
- public AddIterationStrategyEdit(IterationStrategyStack iterationStrategyStack,
- IterationStrategyTopNode iterationStrategyTopNode) {
- super(iterationStrategyStack);
- this.iterationStrategyTopNode = iterationStrategyTopNode;
- }
-
- @Override
- public void doEditAction(IterationStrategyStack iterationStrategyStack) {
- iterationStrategyStack.add(iterationStrategyTopNode);
- }
-
- @Override
- public void undoEditAction(IterationStrategyStack iterationStrategyStack) {
- iterationStrategyStack.remove(iterationStrategyTopNode);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddIterationStrategyInputPortEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddIterationStrategyInputPortEdit.java b/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddIterationStrategyInputPortEdit.java
deleted file mode 100644
index 0d0fca5..0000000
--- a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddIterationStrategyInputPortEdit.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2011 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflow.edits;
-
-import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyStack;
-import org.apache.taverna.scufl2.api.iterationstrategy.PortNode;
-
-/**
- * Adds an iteration strategy input port node to an iteration strategy.
- *
- * @author David Withers
- */
-public class AddIterationStrategyInputPortEdit extends
- AbstractEdit<IterationStrategyStack> {
- private final PortNode portNode;
-
- public AddIterationStrategyInputPortEdit(
- IterationStrategyStack iterationStrategy, PortNode portNode) {
- super(iterationStrategy);
- this.portNode = portNode;
- }
-
- @Override
- public void doEditAction(IterationStrategyStack iterationStrategy) {
- portNode.setParent(iterationStrategy.get(0));
- }
-
- @Override
- public void undoEditAction(IterationStrategyStack iterationStrategy) {
- portNode.setParent(null);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddProcessorEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddProcessorEdit.java b/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddProcessorEdit.java
deleted file mode 100644
index facc975..0000000
--- a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddProcessorEdit.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflow.edits;
-
-import org.apache.taverna.scufl2.api.core.Processor;
-import org.apache.taverna.scufl2.api.core.Workflow;
-
-/**
- * Adds a Processor to a Workflow.
- *
- * @author Stuart Owen
- * @author David Withers
- */
-public class AddProcessorEdit extends AddChildEdit<Workflow> {
- private Processor processor;
-
- public AddProcessorEdit(Workflow workflow, Processor processor) {
- super(workflow, processor);
- this.processor = processor;
- }
-
- @Override
- protected void doEditAction(Workflow workflow) {
- getSubject().getProcessors().addWithUniqueName(processor);
- super.doEditAction(workflow);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddProcessorInputPortEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddProcessorInputPortEdit.java b/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddProcessorInputPortEdit.java
deleted file mode 100644
index 87575d4..0000000
--- a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddProcessorInputPortEdit.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflow.edits;
-
-import org.apache.taverna.scufl2.api.core.Processor;
-import org.apache.taverna.scufl2.api.port.InputProcessorPort;
-
-/**
- * Adds an input port to a processor.
- *
- * @author Tom Oinn
- * @author David Withers
- */
-public class AddProcessorInputPortEdit extends AddChildEdit<Processor> {
- private final InputProcessorPort port;
-
- public AddProcessorInputPortEdit(Processor processor, InputProcessorPort port) {
- super(processor, port);
- this.port = port;
- }
-
- @Override
- protected void doEditAction(Processor processor) {
- processor.getInputPorts().addWithUniqueName(port);
- super.doEditAction(processor);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddProcessorOutputPortEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddProcessorOutputPortEdit.java b/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddProcessorOutputPortEdit.java
deleted file mode 100644
index 1a01972..0000000
--- a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddProcessorOutputPortEdit.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflow.edits;
-
-import org.apache.taverna.scufl2.api.core.Processor;
-import org.apache.taverna.scufl2.api.port.OutputProcessorPort;
-
-/**
- * Adds an output port to a processor.
- *
- * @author Tom Oinn
- * @author David Withers
- */
-public class AddProcessorOutputPortEdit extends AddChildEdit<Processor> {
- private final OutputProcessorPort port;
-
- public AddProcessorOutputPortEdit(Processor processor,
- OutputProcessorPort port) {
- super(processor, port);
- this.port = port;
- }
-
- @Override
- protected void doEditAction(Processor processor) {
- processor.getOutputPorts().addWithUniqueName(port);
- super.doEditAction(processor);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddWorkflowInputPortEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddWorkflowInputPortEdit.java b/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddWorkflowInputPortEdit.java
deleted file mode 100644
index 46c72a2..0000000
--- a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddWorkflowInputPortEdit.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2013 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflow.edits;
-
-import static org.apache.taverna.scufl2.api.common.Scufl2Tools.NESTED_WORKFLOW;
-
-import java.util.List;
-
-import net.sf.taverna.t2.workbench.edits.CompoundEdit;
-import net.sf.taverna.t2.workbench.edits.Edit;
-import net.sf.taverna.t2.workbench.edits.EditException;
-import org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.scufl2.api.configurations.Configuration;
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.taverna.scufl2.api.core.Processor;
-import org.apache.taverna.scufl2.api.core.Workflow;
-import org.apache.taverna.scufl2.api.port.InputActivityPort;
-import org.apache.taverna.scufl2.api.port.InputProcessorPort;
-import org.apache.taverna.scufl2.api.port.InputWorkflowPort;
-import org.apache.taverna.scufl2.api.profiles.ProcessorBinding;
-import org.apache.taverna.scufl2.api.profiles.ProcessorInputPortBinding;
-import org.apache.taverna.scufl2.api.profiles.Profile;
-
-import com.fasterxml.jackson.databind.JsonNode;
-
-/**
- * Adds an input port to a workflow.
- *
- * @author David Withers
- */
-public class AddWorkflowInputPortEdit extends AbstractEdit<Workflow> {
- private final InputWorkflowPort port;
- private final CompoundEdit nestedPortEdit = new CompoundEdit();
-
- public AddWorkflowInputPortEdit(Workflow workflow, InputWorkflowPort port) {
- super(workflow);
- this.port = port;
- WorkflowBundle workflowBundle = workflow.getParent();
- if (workflowBundle != null)
- for (Profile profile : workflowBundle.getProfiles())
- for (Activity activity : profile.getActivities())
- if (activity.getType().equals(NESTED_WORKFLOW))
- for (Configuration c : scufl2Tools.configurationsFor(
- activity, profile))
- defineEditsForOneConfiguration(workflow, port,
- workflowBundle, activity, c);
- }
-
- private void defineEditsForOneConfiguration(Workflow workflow,
- InputWorkflowPort port, WorkflowBundle workflowBundle,
- Activity activity, Configuration c) {
- List<Edit<?>> edits = nestedPortEdit.getChildEdits();
- JsonNode nested = c.getJson().get("nestedWorkflow");
- Workflow nestedWorkflow = workflowBundle.getWorkflows().getByName(
- nested.asText());
-
- if (nestedWorkflow == workflow) {
- InputActivityPort activityPort = new InputActivityPort();
- activityPort.setName(port.getName());
- activityPort.setDepth(port.getDepth());
- edits.add(new AddChildEdit<>(activity, activityPort));
-
- for (ProcessorBinding binding : scufl2Tools
- .processorBindingsToActivity(activity)) {
- Processor processor = binding.getBoundProcessor();
- InputProcessorPort processorPort = new InputProcessorPort();
- processorPort.setName(port.getName());
- processorPort.setDepth(port.getDepth());
- edits.add(new AddProcessorInputPortEdit(processor,
- processorPort));
-
- ProcessorInputPortBinding portBinding = new ProcessorInputPortBinding();
- portBinding.setBoundProcessorPort(processorPort);
- portBinding.setBoundActivityPort(activityPort);
- edits.add(new AddChildEdit<>(binding, portBinding));
- }
- }
- }
-
- @Override
- protected void doEditAction(Workflow workflow) throws EditException {
- workflow.getInputPorts().addWithUniqueName(port);
- port.setParent(workflow);
- nestedPortEdit.doEdit();
- }
-
- @Override
- protected void undoEditAction(Workflow workflow) {
- port.setParent(null);
- nestedPortEdit.undo();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddWorkflowOutputPortEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddWorkflowOutputPortEdit.java b/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddWorkflowOutputPortEdit.java
deleted file mode 100644
index b5d8b99..0000000
--- a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddWorkflowOutputPortEdit.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2013 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflow.edits;
-
-import static org.apache.taverna.scufl2.api.common.Scufl2Tools.NESTED_WORKFLOW;
-
-import java.util.List;
-
-import net.sf.taverna.t2.workbench.edits.CompoundEdit;
-import net.sf.taverna.t2.workbench.edits.Edit;
-import net.sf.taverna.t2.workbench.edits.EditException;
-import org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.scufl2.api.configurations.Configuration;
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.taverna.scufl2.api.core.Processor;
-import org.apache.taverna.scufl2.api.core.Workflow;
-import org.apache.taverna.scufl2.api.port.OutputActivityPort;
-import org.apache.taverna.scufl2.api.port.OutputProcessorPort;
-import org.apache.taverna.scufl2.api.port.OutputWorkflowPort;
-import org.apache.taverna.scufl2.api.profiles.ProcessorBinding;
-import org.apache.taverna.scufl2.api.profiles.ProcessorOutputPortBinding;
-import org.apache.taverna.scufl2.api.profiles.Profile;
-
-import com.fasterxml.jackson.databind.JsonNode;
-
-/**
- * Adds an output port to a workflow.
- *
- * @author David Withers
- */
-public class AddWorkflowOutputPortEdit extends AbstractEdit<Workflow> {
- private final OutputWorkflowPort port;
- private final CompoundEdit nestedPortEdit = new CompoundEdit();
-
- public AddWorkflowOutputPortEdit(Workflow workflow, OutputWorkflowPort port) {
- super(workflow);
- this.port = port;
- WorkflowBundle workflowBundle = workflow.getParent();
- if (workflowBundle != null)
- for (Profile profile : workflowBundle.getProfiles())
- for (Activity activity : profile.getActivities())
- if (activity.getType().equals(NESTED_WORKFLOW))
- for (Configuration c : scufl2Tools.configurationsFor(
- activity, profile))
- defineEditsForOneConfiguration(workflow, port,
- workflowBundle, activity, c);
- }
-
- private void defineEditsForOneConfiguration(Workflow workflow,
- OutputWorkflowPort port, WorkflowBundle workflowBundle,
- Activity activity, Configuration c) {
- List<Edit<?>> edits = nestedPortEdit.getChildEdits();
- JsonNode nested = c.getJson().get("nestedWorkflow");
- Workflow nestedWorkflow = workflowBundle.getWorkflows().getByName(
- nested.asText());
- if (nestedWorkflow == workflow) {
- OutputActivityPort activityPort = new OutputActivityPort();
- activityPort.setName(port.getName());
- activityPort.setDepth(0);
- activityPort.setGranularDepth(0);
- edits.add(new AddChildEdit<>(activity, activityPort));
-
- for (ProcessorBinding binding : scufl2Tools
- .processorBindingsToActivity(activity)) {
- Processor processor = binding.getBoundProcessor();
- OutputProcessorPort processorPort = new OutputProcessorPort();
- processorPort.setName(port.getName());
- processorPort.setDepth(0);
- processorPort.setGranularDepth(0);
- edits.add(new AddProcessorOutputPortEdit(processor,
- processorPort));
-
- ProcessorOutputPortBinding portBinding = new ProcessorOutputPortBinding();
- portBinding.setBoundProcessorPort(processorPort);
- portBinding.setBoundActivityPort(activityPort);
- edits.add(new AddChildEdit<>(binding, portBinding));
- }
- }
- }
-
- @Override
- protected void doEditAction(Workflow workflow) throws EditException {
- workflow.getOutputPorts().addWithUniqueName(port);
- port.setParent(workflow);
- nestedPortEdit.doEdit();
- }
-
- @Override
- protected void undoEditAction(Workflow workflow) {
- port.setParent(null);
- nestedPortEdit.undo();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/ChangeDepthEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/ChangeDepthEdit.java b/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/ChangeDepthEdit.java
deleted file mode 100644
index 19c606e..0000000
--- a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/ChangeDepthEdit.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflow.edits;
-
-import static org.apache.taverna.scufl2.api.common.Scufl2Tools.NESTED_WORKFLOW;
-import org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.scufl2.api.configurations.Configuration;
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.taverna.scufl2.api.core.Workflow;
-import org.apache.taverna.scufl2.api.port.ActivityPort;
-import org.apache.taverna.scufl2.api.port.DepthPort;
-import org.apache.taverna.scufl2.api.port.InputProcessorPort;
-import org.apache.taverna.scufl2.api.port.InputWorkflowPort;
-import org.apache.taverna.scufl2.api.profiles.ProcessorBinding;
-import org.apache.taverna.scufl2.api.profiles.ProcessorInputPortBinding;
-import org.apache.taverna.scufl2.api.profiles.Profile;
-
-import com.fasterxml.jackson.databind.JsonNode;
-
-/**
- * Changes the depth of a port.
- *
- * @author David Withers
- */
-public class ChangeDepthEdit<T extends DepthPort> extends AbstractEdit<T> {
- private Integer newDepth, oldDepth;
-
- public ChangeDepthEdit(T depthPort, Integer newDepth) {
- super(depthPort);
- this.newDepth = newDepth;
- oldDepth = depthPort.getDepth();
- }
-
- @Override
- protected void doEditAction(T depthPort) {
- depthPort.setDepth(newDepth);
- if (depthPort instanceof InputWorkflowPort)
- checkNestedPortDepths((InputWorkflowPort) depthPort, newDepth);
- }
-
- @Override
- protected void undoEditAction(T depthPort) {
- depthPort.setDepth(oldDepth);
- if (depthPort instanceof InputWorkflowPort)
- checkNestedPortDepths((InputWorkflowPort) depthPort, oldDepth);
- }
-
- private void checkNestedPortDepths(InputWorkflowPort workflowPort,
- Integer depth) {
- Workflow workflow = workflowPort.getParent();
- if (workflow != null) {
- WorkflowBundle workflowBundle = workflow.getParent();
- if (workflowBundle != null)
- for (Profile profile : workflowBundle.getProfiles())
- for (Activity activity : profile.getActivities())
- if (activity.getType().equals(NESTED_WORKFLOW))
- for (Configuration c : scufl2Tools
- .configurationsFor(activity, profile))
- checkOneConfiguration(workflowPort, depth,
- workflow, workflowBundle, activity, c);
- }
- }
-
- private void checkOneConfiguration(InputWorkflowPort workflowPort,
- Integer depth, Workflow workflow, WorkflowBundle workflowBundle,
- Activity activity, Configuration c) {
- JsonNode nested = c.getJson().get("nestedWorkflow");
- Workflow nestedWorkflow = workflowBundle.getWorkflows().getByName(
- nested.asText());
- if (nestedWorkflow != workflow)
- return;
-
- ActivityPort activityPort = activity.getInputPorts().getByName(
- workflowPort.getName());
- activityPort.setDepth(depth);
- for (ProcessorBinding binding : scufl2Tools
- .processorBindingsToActivity(activity))
- for (ProcessorInputPortBinding portBinding : binding
- .getInputPortBindings())
- if (portBinding.getBoundActivityPort() == activityPort) {
- InputProcessorPort processorPort = portBinding
- .getBoundProcessorPort();
- processorPort.setDepth(depth);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/ChangeGranularDepthEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/ChangeGranularDepthEdit.java b/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/ChangeGranularDepthEdit.java
deleted file mode 100644
index 2122478..0000000
--- a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/ChangeGranularDepthEdit.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflow.edits;
-
-import org.apache.taverna.scufl2.api.port.GranularDepthPort;
-
-/**
- * Changes the granular depth of a port.
- *
- * @author David Withers
- */
-public class ChangeGranularDepthEdit<T extends GranularDepthPort> extends
- AbstractEdit<T> {
- private Integer newGranularDepth, oldGranularDepth;
-
- public ChangeGranularDepthEdit(T granularDepthPort, Integer newGranularDepth) {
- super(granularDepthPort);
- this.newGranularDepth = newGranularDepth;
- oldGranularDepth = granularDepthPort.getGranularDepth();
- }
-
- @Override
- protected void doEditAction(T granularDepthPort) {
- granularDepthPort.setGranularDepth(newGranularDepth);
- }
-
- @Override
- protected void undoEditAction(T granularDepthPort) {
- granularDepthPort.setGranularDepth(oldGranularDepth);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/ChangeJsonEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/ChangeJsonEdit.java b/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/ChangeJsonEdit.java
deleted file mode 100644
index 652f18f..0000000
--- a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/ChangeJsonEdit.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflow.edits;
-
-import org.apache.taverna.scufl2.api.configurations.Configuration;
-
-import com.fasterxml.jackson.databind.JsonNode;
-
-/**
- * Changes the JSON of a configuration.
- *
- * @author David Withers
- */
-public class ChangeJsonEdit extends AbstractEdit<Configuration> {
- private JsonNode oldJson, newJson;
-
- public ChangeJsonEdit(Configuration configuration, JsonNode newJson) {
- super(configuration);
- this.newJson = newJson;
- newJson = configuration.getJson();
- }
-
- @Override
- protected void doEditAction(Configuration configuration) {
- configuration.setJson(newJson);
- }
-
- @Override
- protected void undoEditAction(Configuration configuration) {
- configuration.setJson(oldJson);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/ClearIterationStrategyStackEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/ClearIterationStrategyStackEdit.java b/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/ClearIterationStrategyStackEdit.java
deleted file mode 100644
index aa5abe8..0000000
--- a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/ClearIterationStrategyStackEdit.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2011 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflow.edits;
-
-import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyStack;
-
-/**
- * Removes all the iteration strategies from an iteration strategy stack.
- *
- * @author David Withers
- */
-public class ClearIterationStrategyStackEdit extends
- AbstractEdit<IterationStrategyStack> {
- private IterationStrategyStack oldIterationStrategyStack;
-
- public ClearIterationStrategyStackEdit(
- IterationStrategyStack iterationStrategyStack) {
- super(iterationStrategyStack);
- }
-
- @Override
- protected void doEditAction(IterationStrategyStack iterationStrategyStack) {
- oldIterationStrategyStack = new IterationStrategyStack();
- oldIterationStrategyStack.addAll(iterationStrategyStack);
- iterationStrategyStack.clear();
- }
-
- @Override
- public void undoEditAction(IterationStrategyStack iterationStrategyStack) {
- iterationStrategyStack.addAll(oldIterationStrategyStack);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/ConfigureEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/ConfigureEdit.java b/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/ConfigureEdit.java
deleted file mode 100644
index dbad345..0000000
--- a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/ConfigureEdit.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflow.edits;
-
-import org.apache.taverna.scufl2.api.common.Configurable;
-import org.apache.taverna.scufl2.api.configurations.Configuration;
-
-/**
- * An Edit that configures a {@link Configurable} with a given
- * {@link Configuration}.
- *
- * @author David Withers
- */
-public class ConfigureEdit<ConfigurableType extends Configurable> extends
- AbstractEdit<ConfigurableType> {
- private final Configuration oldConfiguration;
- private final Configuration newConfiguration;
-
- public ConfigureEdit(ConfigurableType configurable,
- Configuration oldConfiguration, Configuration newConfiguration) {
- super(configurable);
- this.oldConfiguration = oldConfiguration;
- this.newConfiguration = newConfiguration;
- }
-
- @Override
- protected void doEditAction(ConfigurableType configurable) {
- oldConfiguration.setConfigures(null);
- newConfiguration.setConfigures(configurable);
- }
-
- @Override
- protected void undoEditAction(ConfigurableType configurable) {
- oldConfiguration.setConfigures(configurable);
- newConfiguration.setConfigures(null);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/RemoveActivityEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/RemoveActivityEdit.java b/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/RemoveActivityEdit.java
deleted file mode 100644
index 88c5936..0000000
--- a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/RemoveActivityEdit.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflow.edits;
-
-import org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.scufl2.api.core.Processor;
-import org.apache.taverna.scufl2.api.profiles.ProcessorBinding;
-
-/**
- * Remove an Activity from a Processor.
- *
- * @author alanrw
- */
-public class RemoveActivityEdit extends AbstractEdit<Processor> {
- private Activity activityToRemove;
- private ProcessorBinding removedProcessorBinding;
-
- public RemoveActivityEdit(Processor processor, Activity activity) {
- super(processor);
- this.activityToRemove = activity;
- }
-
- @Override
- protected void doEditAction(Processor processor) {
- for (ProcessorBinding binding : scufl2Tools
- .processorBindingsToActivity(activityToRemove))
- if (binding.getBoundProcessor().equals(processor)) {
- removedProcessorBinding = binding;
- removedProcessorBinding.setParent(null);
- }
- }
-
- @Override
- protected void undoEditAction(Processor processor) {
- removedProcessorBinding.setParent(activityToRemove.getParent());
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/RemoveActivityInputPortMappingEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/RemoveActivityInputPortMappingEdit.java b/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/RemoveActivityInputPortMappingEdit.java
deleted file mode 100644
index aa9ff63..0000000
--- a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/RemoveActivityInputPortMappingEdit.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflow.edits;
-
-import org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.scufl2.api.port.InputActivityPort;
-import org.apache.taverna.scufl2.api.profiles.ProcessorBinding;
-import org.apache.taverna.scufl2.api.profiles.ProcessorInputPortBinding;
-
-public class RemoveActivityInputPortMappingEdit extends AbstractEdit<Activity> {
- private final InputActivityPort inputActivityPort;
- private ProcessorInputPortBinding removedPortBinding;
- private ProcessorBinding processorBinding;
-
- public RemoveActivityInputPortMappingEdit(Activity activity,
- InputActivityPort inputActivityPort) {
- super(activity);
- this.inputActivityPort = inputActivityPort;
- }
-
- @Override
- protected void doEditAction(Activity activity) {
- removedPortBinding = scufl2Tools.processorPortBindingForPort(
- inputActivityPort, activity.getParent());
- processorBinding = removedPortBinding.getParent();
- removedPortBinding.setParent(null);
- }
-
- @Override
- protected void undoEditAction(Activity activity) {
- removedPortBinding.setParent(processorBinding);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/RemoveActivityOutputPortMappingEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/RemoveActivityOutputPortMappingEdit.java b/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/RemoveActivityOutputPortMappingEdit.java
deleted file mode 100644
index 7430e83..0000000
--- a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/RemoveActivityOutputPortMappingEdit.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflow.edits;
-
-import org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.scufl2.api.port.OutputActivityPort;
-import org.apache.taverna.scufl2.api.profiles.ProcessorBinding;
-import org.apache.taverna.scufl2.api.profiles.ProcessorOutputPortBinding;
-
-public class RemoveActivityOutputPortMappingEdit extends AbstractEdit<Activity> {
- private final OutputActivityPort outputActivityPort;
- private ProcessorOutputPortBinding removedPortBinding;
- private ProcessorBinding processorBinding;
-
- public RemoveActivityOutputPortMappingEdit(Activity activity,
- OutputActivityPort outputActivityPort) {
- super(activity);
- this.outputActivityPort = outputActivityPort;
- }
-
- @Override
- protected void doEditAction(Activity activity) {
- removedPortBinding = scufl2Tools.processorPortBindingForPort(
- outputActivityPort, activity.getParent());
- processorBinding = removedPortBinding.getParent();
- removedPortBinding.setParent(null);
- }
-
- @Override
- protected void undoEditAction(Activity activity) {
- removedPortBinding.setParent(processorBinding);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/RemoveChildEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/RemoveChildEdit.java b/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/RemoveChildEdit.java
deleted file mode 100644
index 6a0ee64..0000000
--- a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/RemoveChildEdit.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflow.edits;
-
-import org.apache.taverna.scufl2.api.common.Child;
-import org.apache.taverna.scufl2.api.common.WorkflowBean;
-
-/**
- * Removes a child from a parent.
- *
- * @author David Withers
- */
-public class RemoveChildEdit<T extends WorkflowBean> extends AbstractEdit<T> {
- private Child<T> child;
-
- public RemoveChildEdit(T parent, Child<T> child) {
- super(parent);
- this.child = child;
- }
-
- @Override
- protected void doEditAction(T parent) {
- child.setParent(null);
- }
-
- @Override
- protected void undoEditAction(T parent) {
- child.setParent(parent);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/RemoveDataLinkEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/RemoveDataLinkEdit.java b/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/RemoveDataLinkEdit.java
deleted file mode 100644
index 4072d12..0000000
--- a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/RemoveDataLinkEdit.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflow.edits;
-
-import java.util.List;
-
-import org.apache.taverna.scufl2.api.core.DataLink;
-import org.apache.taverna.scufl2.api.core.Workflow;
-import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyNode;
-import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyParent;
-import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyTopNode;
-import org.apache.taverna.scufl2.api.iterationstrategy.PortNode;
-import org.apache.taverna.scufl2.api.port.InputProcessorPort;
-import org.apache.taverna.scufl2.api.port.ReceiverPort;
-
-/**
- * Remove a DataLink from a Workflow.
- * <p>
- * Handles setting the merge position of all dataLinks with the same receiver port.
- *
- * @author David Withers
- */
-public class RemoveDataLinkEdit extends AbstractEdit<Workflow> {
- private final DataLink dataLink;
- private PortNode portNode;
- private int portPosition;
- private IterationStrategyTopNode parent;
-
- public RemoveDataLinkEdit(Workflow workflow, DataLink dataLink) {
- super(workflow);
- this.dataLink = dataLink;
- }
-
- @Override
- protected void doEditAction(Workflow workflow) {
- dataLink.setParent(null);
- ReceiverPort sink = dataLink.getSendsTo();
- List<DataLink> datalinksTo = scufl2Tools.datalinksTo(sink);
- if (datalinksTo.isEmpty()) {
- if (sink instanceof InputProcessorPort) {
- InputProcessorPort port = (InputProcessorPort) sink;
- for (IterationStrategyTopNode topNode : port.getParent().getIterationStrategyStack()) {
- portNode = findPortNode(topNode, port);
- if (portNode != null) {
- IterationStrategyParent parentNode = portNode.getParent();
- if (parentNode instanceof IterationStrategyTopNode) {
- parent = (IterationStrategyTopNode) parentNode;
- portPosition = parent.indexOf(portNode);
- parent.remove(portNode);
- }
- break;
- }
- }
- }
- } else if (datalinksTo.size() == 1) {
- datalinksTo.get(0).setMergePosition(null);
- } else {
- for (int i = 0; i < datalinksTo.size(); i++)
- datalinksTo.get(i).setMergePosition(i);
- }
- }
-
- @Override
- protected void undoEditAction(Workflow workflow) {
- ReceiverPort sink = dataLink.getSendsTo();
- List<DataLink> datalinksTo = scufl2Tools.datalinksTo(sink);
- if (dataLink.getMergePosition() != null)
- for (int i = dataLink.getMergePosition(); i < datalinksTo.size(); i++)
- datalinksTo.get(i).setMergePosition(i + 1);
- if (portNode != null) {
- parent.add(portPosition, portNode);
- portNode.setParent(parent);
- }
- dataLink.setParent(workflow);
- }
-
- private PortNode findPortNode(IterationStrategyTopNode topNode,
- InputProcessorPort port) {
- for (IterationStrategyNode node : topNode) {
- if (node instanceof PortNode) {
- PortNode portNode = (PortNode) node;
- if (port.equals(portNode.getInputProcessorPort()))
- return portNode;
- } else if (node instanceof IterationStrategyTopNode) {
- IterationStrategyTopNode iterationStrategyTopNode = (IterationStrategyTopNode) node;
- PortNode result = findPortNode(iterationStrategyTopNode, port);
- if (result != null)
- return result;
- }
- }
- return null;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/RemoveProcessorInputPortEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/RemoveProcessorInputPortEdit.java b/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/RemoveProcessorInputPortEdit.java
deleted file mode 100644
index 3464cbb..0000000
--- a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/RemoveProcessorInputPortEdit.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflow.edits;
-
-import org.apache.taverna.scufl2.api.core.Processor;
-import org.apache.taverna.scufl2.api.port.InputProcessorPort;
-
-public class RemoveProcessorInputPortEdit extends RemoveChildEdit<Processor> {
- public RemoveProcessorInputPortEdit(Processor processor,
- InputProcessorPort port) {
- super(processor, port);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/RemoveProcessorOutputPortEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/RemoveProcessorOutputPortEdit.java b/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/RemoveProcessorOutputPortEdit.java
deleted file mode 100644
index 888eb77..0000000
--- a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/RemoveProcessorOutputPortEdit.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflow.edits;
-
-import org.apache.taverna.scufl2.api.core.Processor;
-import org.apache.taverna.scufl2.api.port.OutputProcessorPort;
-
-public class RemoveProcessorOutputPortEdit extends RemoveChildEdit<Processor> {
- public RemoveProcessorOutputPortEdit(Processor processor,
- OutputProcessorPort port) {
- super(processor, port);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/RemoveWorkflowInputPortEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/RemoveWorkflowInputPortEdit.java b/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/RemoveWorkflowInputPortEdit.java
deleted file mode 100644
index 8da256b..0000000
--- a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/RemoveWorkflowInputPortEdit.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2013 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflow.edits;
-
-import static org.apache.taverna.scufl2.api.common.Scufl2Tools.NESTED_WORKFLOW;
-
-import java.util.List;
-
-import net.sf.taverna.t2.workbench.edits.CompoundEdit;
-import net.sf.taverna.t2.workbench.edits.Edit;
-import net.sf.taverna.t2.workbench.edits.EditException;
-import org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.scufl2.api.configurations.Configuration;
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.taverna.scufl2.api.core.Processor;
-import org.apache.taverna.scufl2.api.core.Workflow;
-import org.apache.taverna.scufl2.api.port.InputActivityPort;
-import org.apache.taverna.scufl2.api.port.InputProcessorPort;
-import org.apache.taverna.scufl2.api.port.InputWorkflowPort;
-import org.apache.taverna.scufl2.api.profiles.ProcessorBinding;
-import org.apache.taverna.scufl2.api.profiles.ProcessorInputPortBinding;
-import org.apache.taverna.scufl2.api.profiles.Profile;
-
-import com.fasterxml.jackson.databind.JsonNode;
-
-/**
- * Removes an input port from a workflow.
- *
- * @author David Withers
- */
-public class RemoveWorkflowInputPortEdit extends AbstractEdit<Workflow> {
- private final InputWorkflowPort port;
- private final CompoundEdit nestedPortEdit = new CompoundEdit();
-
- public RemoveWorkflowInputPortEdit(Workflow workflow, InputWorkflowPort port) {
- super(workflow);
- this.port = port;
- WorkflowBundle workflowBundle = workflow.getParent();
- if (workflowBundle != null)
- for (Profile profile : workflowBundle.getProfiles())
- for (Activity activity : profile.getActivities())
- if (activity.getType().equals(NESTED_WORKFLOW))
- for (Configuration c : scufl2Tools.configurationsFor(
- activity, profile))
- defineEditsForConfiguration(workflow, port,
- workflowBundle, activity, c);
- }
-
- private void defineEditsForConfiguration(Workflow workflow,
- InputWorkflowPort port, WorkflowBundle workflowBundle,
- Activity activity, Configuration c) {
- List<Edit<?>> edits = nestedPortEdit.getChildEdits();
- JsonNode nested = c.getJson().get("nestedWorkflow");
- Workflow nestedWorkflow = workflowBundle.getWorkflows().getByName(
- nested.asText());
- if (nestedWorkflow != workflow)
- return;
-
- InputActivityPort activityPort = activity.getInputPorts().getByName(
- port.getName());
- edits.add(new RemoveChildEdit<>(activity, activityPort));
-
- for (ProcessorBinding binding : scufl2Tools
- .processorBindingsToActivity(activity)) {
- Processor processor = binding.getBoundProcessor();
- for (ProcessorInputPortBinding portBinding : binding
- .getInputPortBindings())
- if (portBinding.getBoundActivityPort() == activityPort) {
- InputProcessorPort processorPort = portBinding
- .getBoundProcessorPort();
- edits.add(new RemoveProcessorInputPortEdit(processor,
- processorPort));
- edits.add(new RemoveChildEdit<>(binding, portBinding));
- }
- }
- }
-
- @Override
- protected void doEditAction(Workflow workflow) throws EditException {
- port.setParent(null);
- nestedPortEdit.doEdit();
- }
-
- @Override
- protected void undoEditAction(Workflow workflow) {
- port.setParent(workflow);
- nestedPortEdit.undo();
- }
-}