Made sure commands that create new columns check for duplicate column names.
git-svn-id: http://google-refine.googlecode.com/svn/trunk@1126 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
parent
4ad31ffcde
commit
965ef20790
@ -31,10 +31,14 @@ public class UndoRedoCommand extends Command {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean done = lastDoneID == -1 ||
|
try {
|
||||||
project.processManager.queueProcess(
|
boolean done = lastDoneID == -1 ||
|
||||||
new HistoryProcess(project, lastDoneID));
|
project.processManager.queueProcess(
|
||||||
|
new HistoryProcess(project, lastDoneID));
|
||||||
respond(response, "{ \"code\" : " + (done ? "\"ok\"" : "\"pending\"") + " }");
|
|
||||||
|
respond(response, "{ \"code\" : " + (done ? "\"ok\"" : "\"pending\"") + " }");
|
||||||
|
} catch (Exception e) {
|
||||||
|
respondException(response, e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -73,6 +73,12 @@ public class TransposeColumnsIntoRowsOperation extends AbstractOperation {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected HistoryEntry createHistoryEntry(Project project, long historyEntryID) throws Exception {
|
protected HistoryEntry createHistoryEntry(Project project, long historyEntryID) throws Exception {
|
||||||
|
if (_combinedColumnName != null &&
|
||||||
|
!_combinedColumnName.isEmpty() &&
|
||||||
|
project.columnModel.getColumnByName(_combinedColumnName) != null) {
|
||||||
|
throw new Exception("Another column already named " + _combinedColumnName);
|
||||||
|
}
|
||||||
|
|
||||||
List<Column> newColumns = new ArrayList<Column>();
|
List<Column> newColumns = new ArrayList<Column>();
|
||||||
List<Column> oldColumns = project.columnModel.columns;
|
List<Column> oldColumns = project.columnModel.columns;
|
||||||
|
|
||||||
|
@ -105,6 +105,9 @@ public class ColumnAdditionOperation extends EngineDependentOperation {
|
|||||||
if (column == null) {
|
if (column == null) {
|
||||||
throw new Exception("No column named " + _baseColumnName);
|
throw new Exception("No column named " + _baseColumnName);
|
||||||
}
|
}
|
||||||
|
if (project.columnModel.getColumnByName(_newColumnName) != null) {
|
||||||
|
throw new Exception("Another column already named " + _newColumnName);
|
||||||
|
}
|
||||||
|
|
||||||
List<CellAtRow> cellsAtRows = new ArrayList<CellAtRow>(project.rows.size());
|
List<CellAtRow> cellsAtRows = new ArrayList<CellAtRow>(project.rows.size());
|
||||||
|
|
||||||
|
@ -31,14 +31,9 @@ public class ProcessManager implements Jsonizable {
|
|||||||
writer.endObject();
|
writer.endObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
public HistoryEntry queueProcess(Process process) {
|
public HistoryEntry queueProcess(Process process) throws Exception {
|
||||||
if (process.isImmediate() && _processes.size() == 0) {
|
if (process.isImmediate() && _processes.size() == 0) {
|
||||||
try {
|
return process.performImmediate();
|
||||||
return process.performImmediate();
|
|
||||||
} catch (Exception e) {
|
|
||||||
// TODO: Not sure what to do yet
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
_processes.add(process);
|
_processes.add(process);
|
||||||
|
|
||||||
@ -47,14 +42,9 @@ public class ProcessManager implements Jsonizable {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean queueProcess(HistoryProcess process) {
|
public boolean queueProcess(HistoryProcess process) throws Exception {
|
||||||
if (process.isImmediate() && _processes.size() == 0) {
|
if (process.isImmediate() && _processes.size() == 0) {
|
||||||
try {
|
return process.performImmediate() != null;
|
||||||
return process.performImmediate() != null;
|
|
||||||
} catch (Exception e) {
|
|
||||||
// TODO: Not sure what to do yet
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
_processes.add(process);
|
_processes.add(process);
|
||||||
|
|
||||||
|
@ -243,6 +243,8 @@ Gridworks.postProcess = function(command, params, body, updateOptions, callbacks
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
Gridworks.reportException(e);
|
Gridworks.reportException(e);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
alert(o.message);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ("onDone" in callbacks) {
|
if ("onDone" in callbacks) {
|
||||||
|
Loading…
Reference in New Issue
Block a user