Update design document.

@param tableInfos
the table infos
549060
@Override
    protected void update(List<TableInfo> tableInfos)
    {
        try
        {
            HttpResponse response = null;

            createDatabaseIfNotExist(false);

            for (TableInfo tableInfo : tableInfos)
            {
                String id = CouchDBConstants.DESIGN + tableInfo.getTableName();
                CouchDBDesignDocument designDocument = getDesignDocument(id);
                designDocument.setLanguage(CouchDBConstants.LANGUAGE);
                Map<String, MapReduce> views = designDocument.getViews();
                if (views == null)
                {
                    views = new HashMap<String, MapReduce>();
                }
                for (IndexInfo indexInfo : tableInfo.getColumnsToBeIndexed())
                {
                    createViewIfNotExist(views, indexInfo.getColumnName());
                }

                // for id column.
                createViewIfNotExist(views, tableInfo.getIdColumnName());

                // for select all.
                createViewForSelectAllIfNotExist(tableInfo, views);

                // for selecting specific field
                createViewForSelectSpecificFields(views);

                designDocument.setViews(views);

                URI uri = null;
                if (designDocument.get_rev() == null)
                {
                    uri = new URI(CouchDBConstants.PROTOCOL, null, httpHost.getHostName(), httpHost.getPort(),
                            CouchDBConstants.URL_SEPARATOR + databaseName.toLowerCase()
                                    + CouchDBConstants.URL_SEPARATOR + id, null, null);
                }
                else
                {
                    StringBuilder builder = new StringBuilder("rev=");
                    builder.append(designDocument.get_rev());
                    uri = new URI(CouchDBConstants.PROTOCOL, null, httpHost.getHostName(), httpHost.getPort(),
                            CouchDBConstants.URL_SEPARATOR + databaseName.toLowerCase()
                                    + CouchDBConstants.URL_SEPARATOR + id, builder.toString(), null);
                }
                HttpPut put = new HttpPut(uri);

                String jsonObject = gson.toJson(designDocument);
                StringEntity entity = new StringEntity(jsonObject);
                put.setEntity(entity);
                try
                {
                    response = httpClient.execute(httpHost, put, CouchDBUtils.getContext(httpHost));
                }
                finally
                {
                    CouchDBUtils.closeContent(response);
                }
            }
            // creating views for various aggregations in the following
            // order:
            // -- COUNT SUM MAX MIN AVG
            // IMPORTANT: The aggregations does not support WHERE clause
            createDesignDocForAggregations();
        }
        catch (Exception e)
        {
            logger.error("Error while creating database, caused by {}.", e);
            throw new SchemaGenerationException("Error while creating database", e, "couchDB");
        }
    }
819268
protected void create(List<TableInfo> tableInfos)
    {
        try
        {
            if (admin.isTableAvailable(databaseName))
            {
                addColumnFamilies(tableInfos, admin.getTableDescriptor(databaseName.getBytes()), false);
            }
            else
            {
                createTable(tableInfos);
            }
            if (admin.isTableDisabled(databaseName))
            {
                admin.enableTable(databaseName);
            }
        }
        catch (TableNotFoundException e)
        {
            logger.info("creating table " + databaseName);
        }
        catch (IOException ioex)
        {
            logger.error("Either table isn't in enabled state or some network problem, Caused by: ", ioex);
            throw new SchemaGenerationException(ioex, "Hbase");
        }
    }
715895
protected void setTableWidget(final TableDescription tableDescription) {
		Assert.notNull(tableDescription);
		tableWidget = new CachedCallable<TableWidget>() {
			@Override
			protected TableWidget doCall() {
				TableWidget tableWidget = new GlazedListTableWidget(null,
						tableDescription);
				tableWidget.addSelectionObserver(tableSelectionObserver);
				return tableWidget;
			}
		};
	}
789543
public void setInfoStyle(java.lang.String infoStyle) {
        getStateHelper().put(PropertyKeys.infoStyle, infoStyle);
    }
424192
protected void setDynamicInfo(List<AdditionalInfoItem> info) {

        for (AdditionalInfoItem item : m_dynamicInfo) {
            item.removeFromParent();
        }
        for (AdditionalInfoItem item : info) {
            m_dynamicInfo.add(item);
            m_additionalInfo.add(item);
        }
        updateTruncation();
    }
335127
@Override
    protected void create(List<TableInfo> tableInfos)
    {
        StatementResult result = null;
        String statement = null;

        for (TableInfo tableInfo : tableInfos)
        {
            try
            {
                result = tableAPI.executeSync("DROP TABLE IF EXISTS " + tableInfo.getTableName());
                if (!result.isSuccessful())
                {
                    throw new SchemaGenerationException("Unable to DROP TABLE " + tableInfo.getTableName());
                }
                statement = buildCreateDDLQuery(tableInfo);
                result = tableAPI.executeSync(statement);
                if (!result.isSuccessful())
                {
                    throw new SchemaGenerationException("Unable to CREATE TABLE " + tableInfo.getTableName());
                }
                createIndexOnTable(tableInfo);
            }
            catch (IllegalArgumentException e)
            {
                logger.error("Invalid Statement. Caused By: ", e);
                throw new SchemaGenerationException(e, "Invalid Statement. Caused By: ");
            }
            catch (FaultException e)
            {
                logger.error("Statement couldn't be executed. Caused By: ", e);
                throw new SchemaGenerationException(e, "Statement couldn't be executed. Caused By: ");
            }
        }
    }
1247907
public void updateTabTitle (Tab tab) {
		TabButtonTable table = tabsButtonMap.get(tab);
		if (table == null) {
			throwNotBelongingTabException(tab);
		}
		table.button.setText(getTabTitle(tab));
	}
1242861
public void updateColumnMappings() {
        columnMapping = new HashMap<>();
        int realIdx = 0;
        int renderCol = 0;
        for (final SheetColumn column : getColumns()) {
            if (column.isRendered()) {
                columnMapping.put(renderCol, realIdx);
                renderCol++;
            }
            realIdx++;
        }
    }
658586
private void updateTable()
  {
    try
    {
      tableModel = new DefaultTableModel(new String[]
        {
          "name", "id", "text", "tokens", "source_path"
        }, 0);
      tableList.setModel(tableModel);

      List<Map<String, Object>> stats = corpusAdmin.listCorpusStats();

      for(Map<String, Object> map : stats)
      {
        String[] rowData = new String[tableModel.getColumnCount()];
        for(int j = 0; j < rowData.length; j++)
        {
          String cName = tableList.getColumnName(j);
          if(map.containsKey(cName))
          {
            rowData[j] = map.get(cName).toString();
          }
          else
          {
            rowData[j] = "";
          }
        }

        tableModel.addRow(rowData);
      }
    }
    catch(Exception ex)
    {
      ImportStatus importStatus = corpusAdmin.getAdministrationDao().initImportStatus();
      importStatus.addException("list corpora exception", ex);
      new ExceptionDialog(importStatus).setVisible(true);
    }
  }
341596
public void updateInfo(Info info) {
        BoxAPIConnection api = this.getAPI();
        URL url = COLLABORATION_URL_TEMPLATE.build(api.getBaseURL(), this.getID());

        BoxJSONRequest request = new BoxJSONRequest(api, url, "PUT");
        request.setBody(info.getPendingChanges());
        BoxAPIResponse boxAPIResponse = request.send();

        if (boxAPIResponse instanceof BoxJSONResponse) {
            BoxJSONResponse response = (BoxJSONResponse) boxAPIResponse;
            JsonObject jsonObject = JsonObject.readFrom(response.getJSON());
            info.update(jsonObject);
        }
    }
325805
@Override
	public void tableChanged(TableModelEvent e) {
		int rows = ((TableModel) e.getSource()).getRowCount();
		updateStatus(rows);
	}
501090
public void setDesignMode(boolean designMode) {
        this.designMode = designMode;
        
        for (ElementBase child : children) {
            child.setDesignMode(designMode);
        }
        
        updateState();
    }
156507
public void updateDesign(Design design){
        mDesign = design;
        if(mStyle != null) mStyle.applyDesign(mDesign, mThemeColor);
    }
295205
private void updateResultSetDesign( IResultSetMetaData md,
            DataSetDesign dataSetDesign ) 
        throws OdaException
	{
        ResultSetColumns columns = DesignSessionUtil.toResultSetColumnsDesign( md );

        ResultSetDefinition resultSetDefn = DesignFactory.eINSTANCE
                .createResultSetDefinition();
        // resultSetDefn.setName( value );  // result set name
        resultSetDefn.setResultSetColumns( columns );

        // no exception in conversion; go ahead and assign to specified dataSetDesign
        dataSetDesign.setPrimaryResultSet( resultSetDefn );
        dataSetDesign.getResultSets().setDerivedMetaData( true );
	}
1190714
private void updateFields() {
		if (featureInfo != null) {
			// Create a header field for each attribute definition:
			List<ListGridField> fields = new ArrayList<ListGridField>();
			if (idInTable) {
				ListGridField gridField = new ListGridField(ID_NAME, "ID");
				gridField.setAlign(Alignment.LEFT);
				gridField.setCanEdit(false);
				fields.add(gridField);
			}

			for (AttributeInfo attributeInfo : featureInfo.getAttributes()) {
				if (!attributeInfo.isHidden() && (attributeInfo.isIdentifying() || allAttributesDisplayed)) {
					fields.add(createAttributeGridField(attributeInfo));
				}
			}
			setFields(fields.toArray(new ListGridField[fields.size()]));
			setCanResizeFields(true);
		}
	}
11006
private void addJoinColumnToInfo(String joinColumn, TableInfo targetTableInfo, List<TableInfo> targetTableInfos,
            EntityMetadata m)
    {
        if (!joinColumn.equals(targetTableInfo.getIdColumnName()))
        {

            if (!targetTableInfos.isEmpty() && targetTableInfos.contains(targetTableInfo))
            {
                int idx = targetTableInfos.indexOf(targetTableInfo);
                targetTableInfo = targetTableInfos.get(idx);
                ColumnInfo columnInfoOfJoinColumn = getJoinColumn(targetTableInfo, joinColumn,
                        m.getIdAttribute().getBindableJavaType());
                if (!targetTableInfo.getColumnMetadatas().contains(columnInfoOfJoinColumn))
                {
                    targetTableInfo.addColumnInfo(columnInfoOfJoinColumn);
                }
            }
            else
            {
                ColumnInfo columnInfoOfJoinColumn = getJoinColumn(targetTableInfo, joinColumn,
                        m.getIdAttribute().getBindableJavaType());
                if (!targetTableInfo.getColumnMetadatas().contains(columnInfoOfJoinColumn))
                {
                    targetTableInfo.addColumnInfo(columnInfoOfJoinColumn);
                }
                targetTableInfos.add(targetTableInfo);
            }
        }
    }
815497
public static void update(CallInfo callInfo, DataSet data) {
    Table table = asTable(data.getSource()); 
    List<String> keyColumns = table.getKeyColumns();
    
    if (keyColumns.isEmpty()) {
      throw new InvalidOperationException("No key columns defined.");
    }

    List<String> tableColumns = table.getColumns();
    int columnCount = tableColumns.size();
    List<String> columnsToUpdate = new LinkedList<>();
    columnsToUpdate.addAll(tableColumns);
    columnsToUpdate.removeAll(keyColumns);

    if (columnsToUpdate.isEmpty()) {
      throw new InvalidOperationException("No columns to update.");
    }

    // Build SQL statement
    int[] paramIdx = new int[columnCount];
    int param = 0;
    StringBuilder sql = new StringBuilder("UPDATE ");
    Iterator<String> itr = columnsToUpdate.iterator();
    String col = itr.next();
    paramIdx[tableColumns.indexOf(col)] = ++param;
    sql.append(table.getName())
       .append(" SET ")
       .append(col)
       .append("=?");
    
    while (itr.hasNext()) {
      col = itr.next();
      paramIdx[tableColumns.indexOf(col)] = ++param;
      sql.append(',')
         .append(col)
         .append("=?");
    }
    
    itr = keyColumns.iterator();
    col = itr.next();
    paramIdx[tableColumns.indexOf(col)] = ++param;
    sql.append(WHERE_)
       .append(col)
       .append("=?");
    
    while (itr.hasNext()) {
      col = itr.next();
      paramIdx[tableColumns.indexOf(col)] = ++param;
      sql.append(AND_)
         .append(col)
         .append("=?");
    }
    
    table.setDirtyStatus(true);
    dataSetOperation(callInfo, table, data, sql.toString(), paramIdx);
  }