-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
35 changed files
with
458 additions
and
254 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
.../src/main/java/edu/isi/karma/controller/command/transformation/AddColumnConsolidator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package edu.isi.karma.controller.command.transformation; | ||
|
||
import java.util.Iterator; | ||
import java.util.List; | ||
|
||
import org.apache.commons.lang3.tuple.ImmutablePair; | ||
import org.apache.commons.lang3.tuple.Pair; | ||
import org.json.JSONArray; | ||
|
||
import edu.isi.karma.controller.command.Command; | ||
import edu.isi.karma.controller.command.ICommand; | ||
import edu.isi.karma.controller.command.worksheet.AddColumnCommand; | ||
import edu.isi.karma.controller.history.CommandConsolidator; | ||
import edu.isi.karma.controller.history.HistoryJsonUtil; | ||
import edu.isi.karma.rep.Workspace; | ||
|
||
public class AddColumnConsolidator extends CommandConsolidator { | ||
|
||
@Override | ||
public Pair<ICommand, Object> consolidateCommand(List<ICommand> commands, | ||
ICommand newCommand, Workspace workspace) { | ||
if (newCommand instanceof SubmitPythonTransformationCommand) { | ||
String model = newCommand.getModel(); | ||
|
||
Iterator<ICommand> itr = commands.iterator(); | ||
while(itr.hasNext()) { | ||
ICommand tmp = itr.next(); | ||
if (((Command)tmp).getOutputColumns().equals(((Command)newCommand).getOutputColumns()) | ||
&& tmp.getModel().equals(model) | ||
&& (tmp instanceof AddColumnCommand)) { | ||
SubmitPythonTransformationCommand py = ((SubmitPythonTransformationCommand)newCommand); | ||
JSONArray inputJSON = new JSONArray(py.getInputParameterJson()); | ||
|
||
JSONArray tmpInputJSON = new JSONArray(tmp.getInputParameterJson()); | ||
String hNodeId = HistoryJsonUtil.getStringValue("hNodeId", tmpInputJSON); | ||
|
||
HistoryJsonUtil.setArgumentValue("hNodeId", hNodeId, inputJSON); | ||
py.setInputParameterJson(inputJSON.toString()); | ||
|
||
return new ImmutablePair<>(tmp, (Object)py); | ||
} | ||
} | ||
} | ||
return null; | ||
} | ||
|
||
} |
17 changes: 7 additions & 10 deletions
17
...rc/main/java/edu/isi/karma/controller/command/transformation/PyTransformConsolidator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.