// create new column command
String Msg = String.format("submit end, Time,%d, Worksheet,%s",
System.currentTimeMillis(), worksheetId);
logger.info(Msg);
String colnameString = "";
UpdateContainer c = new UpdateContainer();
HNodePath selectedPath = null;
try {
// obtain transformed results
HashMap<String, String> rows = new HashMap<String, String>();
colnameString = obtainTransformedResultsAndFindNewColumnName(
workspace, rows);
createAndExecuteNewAddColumnCommand(workspace, colnameString);
Worksheet wk = workspace.getWorksheet(worksheetId);
selectedPath = findPathForNewColumn(workspace, colnameString);
DataPreProcessor dpp = (DataPreProcessor) wk.getDpp();
if(dpp == null)
{
dpp = new DataPreProcessor(rows.values());
}
Messager msg = (Messager) wk.getMsg();
if(msg == null)
{
msg = new Messager();
}
RamblerTransformationOutput rtf = applyRamblerTransformation(rows,dpp,msg);
if (rtf.getTransformations().keySet().size() <= 0) {
c.append(WorksheetUpdateFactory
.createRegenerateWorksheetUpdates(worksheetId, getSuperSelection(workspace)));
c.add(new InfoUpdate("No Result Submitted"));
return c;
}
ValueCollection rvco = getValueCollectionFromRamblerTranformationOutput(rtf);
findNewHNodeIdAndHNodeAsDerived(workspace, selectedPath);
// create edit multiple cells command
createAndExecuteMultiCellCmd(workspace, selectedPath, rvco);
} catch (Exception e) {
logger.error("Unable to complete processing of cleaning command", e);
c.add(new ErrorUpdate(
"Unable to complete processing of cleaning command"));
// TODO do we need to clean up?
}
if (selectedPath != null) {
c.append(WorksheetUpdateFactory
.createRegenerateWorksheetUpdates(worksheetId, getSuperSelection(workspace)));
/** Add the alignment update **/
c.append(computeAlignmentAndSemanticTypesAndCreateUpdates(
workspace, selectedPath));
}
c.add(new InfoUpdate("Column transformation complete"));
return c;
}