private void groupByNestedTable(Worksheet oldws, Workspace workspace, HTable ht, List<String> hnodeIDs, List<HNode> keyhnodes, List<HNode> valuehnodes, RepFactory factory) { SuperSelection selection = getSuperSelection(oldws); HTable parentHT = ht.getParentHNode().getHTable(factory); List<Table> parentTables = new ArrayList<>();
private Worksheet groupByTopLevel(Worksheet oldws, Workspace workspace, List<String> hnodeIDs, List<HNode> keyhnodes, List<HNode> valuehnodes, RepFactory factory) { SuperSelection selection = getSuperSelection(oldws); Worksheet newws = factory.createWorksheet("GroupBy: " + oldws.getTitle(), workspace, oldws.getEncoding()); newws.getMetadataContainer().getWorksheetProperties().setPropertyValue(Property.sourceType, oldws.getMetadataContainer().getWorksheetProperties().getPropertyValue(Property.sourceType));
c.add(new WorksheetListUpdate()); if (newws == null) c.append(WorksheetUpdateFactory.createRegenerateWorksheetUpdates(oldws.getId(), getSuperSelection(oldws), workspace.getContextId())); if (newws != null) { c.append(WorksheetUpdateFactory.createRegenerateWorksheetUpdates(newws.getId(), SuperSelectionManager.DEFAULT_SELECTION, workspace.getContextId()));
@Override public UpdateContainer undoIt(Workspace workspace) { UpdateContainer c = new UpdateContainer(); if (this.newWorksheetId != null) { workspace.removeWorksheet(newWorksheetId); workspace.getFactory().removeWorksheet(newWorksheetId, workspace.getCommandHistory()); c.add(new WorksheetListUpdate()); c.add(new WorksheetDeleteUpdate(newWorksheetId)); } if (this.newHNodeId != null) { Worksheet worksheet = workspace.getWorksheet(worksheetId); HNode ndid = workspace.getFactory().getHNode(newHNodeId); HTable currentTable = workspace.getFactory().getHTable(ndid.getHTableId()); ndid.removeNestedTable(); //remove the new column currentTable.removeHNode(newHNodeId, worksheet); c.append(WorksheetUpdateFactory.createRegenerateWorksheetUpdates(worksheetId, getSuperSelection(worksheet), workspace.getContextId())); c.append(computeAlignmentAndSemanticTypesAndCreateUpdates(workspace)); } return c; }