Performs the update, selecting the appropriate API action depending on
the nature of the change.

@return the new document after update with the API
@throws MediaWikiApiErrorException
@throws IOException
184028
public StatementDocument performEdit(WbEditingAction action, boolean editAsBot, String summary)
			throws IOException, MediaWikiApiErrorException {
		if (isEmptyEdit()) {
			return currentDocument;
		} else if (toDelete.isEmpty() && getUpdatedStatements().size() == 1) {
			// we can use "wbsetclaim" because we only have one statement to change
			List<Statement> statements = getUpdatedStatements();
			Statement statement = statements.get(0);
			
			if (statement.getStatementId() == null || statement.getStatementId().isEmpty()) {
				statement = statement.withStatementId(guidGenerator.freshStatementId(currentDocument.getEntityId().getId()));

			}
			
			JsonNode response = action.wbSetClaim(
						JsonSerializer.getJsonString(statement), editAsBot,
						currentDocument.getRevisionId(), summary);
			
			StatementImpl.PreStatement preStatement = getDatamodelObjectFromResponse(response, Collections.singletonList("claim"), StatementImpl.PreStatement.class);
			Statement returnedStatement = preStatement.withSubject(statement.getClaim().getSubject());
			long revisionId = getRevisionIdFromResponse(response);
			
			return currentDocument.withStatement(returnedStatement).withRevisionId(revisionId);
		} else if (!toDelete.isEmpty() && getUpdatedStatements().size() == toDelete.size() && toDelete.size() <= 50) {
			// we can use "wbremoveclaims" because we are only removing statements
			
			JsonNode response = action.wbRemoveClaims(toDelete, editAsBot, currentDocument.getRevisionId(), summary);
			
			long revisionId = getRevisionIdFromResponse(response);
			
			return currentDocument.withoutStatementIds(new HashSet<>(toDelete)).withRevisionId(revisionId);
		} else {
			return (StatementDocument) action.wbEditEntity(currentDocument
				.getEntityId().getId(), null, null, null, getJsonUpdateString(),
				false, editAsBot, currentDocument
				.getRevisionId(), summary);
		}
	}
1230727
def update(self):
        
        res = True  # An update was successful
        if self.source:
            _keys = self._keys  # just in case

            # reread everything
            self._keys = []

            try:
                if self.remote is False:
                    if self.fileformat in ["jwks", "jwk"]:
                        self.do_local_jwk(self.source)
                    elif self.fileformat == "der":
                        self.do_local_der(self.source, self.keytype,
                                          self.keyusage)
                else:
                    res = self.do_remote()
            except Exception as err:
                logger.error('Key bundle update failed: {}'.format(err))
                self._keys = _keys  # restore
                return False

            now = time.time()
            for _key in _keys:
                if _key not in self._keys:
                    if not _key.inactive_since:  # If already marked don't mess
                        _key.inactive_since = now
                    self._keys.append(_key)

        return res
688155
public void updateMpNews(String mediaId, int index, MpArticle article) {
        String url = WxEndpoint.get("url.material.mpnews.update");
        Map<String, Object> request = new HashMap<>();

        request.put("media_id", mediaId);
        request.put("index", index);
        request.put("articles", article);

        String json = JsonMapper.nonEmptyMapper().toJson(request);
        logger.info("update mpnews: {}", json);
        wxClient.post(url, json);
    }
747830
def update(self, uid):
        '''
        
        '''
        if self.userinfo.role[0] > '0':
            pass
        else:
            return False

        post_data = self.get_post_data()
        post_data['user_name'] = self.userinfo.user_name if self.userinfo else ''
        cur_info = MWiki.get_by_uid(uid)
        MWikiHist.create_wiki_history(cur_info)
        MWiki.update_cnt(uid, post_data)
        if cur_info.kind == '1':
            self.redirect('/wiki/{0}'.format(cur_info.title))
        elif cur_info.kind == '2':
            self.redirect('/page/{0}.html'.format(cur_info.uid))
913541
@Deprecated
 	public void update(String projectKey, WikiPageDetail detail) throws RedmineException {
        String urlSafeTitle = WikiPageDetail.getUrlSafeString(detail.getTitle());
        transport.updateChildEntry(Project.class, projectKey, detail, urlSafeTitle);
 	}
1253789
@SuppressWarnings("unchecked")
  public Paging<TrackSimplified> execute() throws
          IOException,
          SpotifyWebApiException {
    return new TrackSimplified.JsonUtil().createModelObjectPaging(getJson());
  }
574976
public PostUpdate<Entity<T>> getOrCreatePostUpdate()
   {
      Node node = childNode.getOrCreate("post-update");
      PostUpdate<Entity<T>> postUpdate = new PostUpdateImpl<Entity<T>>(this, "post-update", childNode, node);
      return postUpdate;
   }
495123
public function update()
    {
        $this->exitIfModelNotSet();

        if (!$this->model->exists) {
            throw new \Exception('Model not persisted yet');
        }

        $document = $this->model->getDocumentData();

        $params = [
            'id'    => $this->model->getKey(),
            'type'  => $this->model->getDocumentType(),
            'index' => $this->model->getDocumentIndex(),
            'body'  => [
                'doc' => $document,
            ],
        ];

        return $this->connection->updateStatement($params);
    }
147118
@TaskAction
    public void download() throws IOException {
        action.execute();
        
        // handle 'upToDate'
        try {
            if (action.isUpToDate()) {
                Method getState = this.getClass().getMethod("getState");
                Object state = getState.invoke(this);
                try {
                    // prior to Gradle 3.2 we needed to do this
                    Method upToDate = state.getClass().getMethod("upToDate");
                    upToDate.invoke(state);
                } catch (NoSuchMethodException e) {
                    // since Gradle 3.2 we need to do this
                    Method setDidWork = state.getClass().getMethod(
                            "setDidWork", boolean.class);
                    setDidWork.invoke(state, false);
                }
            }
        } catch (Exception e) {
            //just ignore
        }
    }
604975
public UpdateOptions copy() {
        return new UpdateOptions()
            .bypassDocumentValidation(getBypassDocumentValidation())
            .collation(getCollation())
            .multi(isMulti())
            .upsert(isUpsert())
            .writeConcern(getWriteConcern());
    }
1351831
@Override
    public void update() throws ProponoException {
        if (partial) {
            throw new ProponoException("ERROR: attempt to update partial entry");
        }
        EntityEnclosingMethod method = null;
        final Content updateContent = getContents().get(0);
        try {
            if (getMediaLinkURI() != null && getBytes() != null) {
                // existing media entry and new file, so PUT file to edit-media URI
                method = new PutMethod(getMediaLinkURI());
                if (inputStream != null) {
                    method.setRequestEntity(new InputStreamRequestEntity(inputStream));
                } else {
                    method.setRequestEntity(new InputStreamRequestEntity(new ByteArrayInputStream(getBytes())));
                }

                method.setRequestHeader("Content-type", updateContent.getType());
            } else if (getEditURI() != null) {
                // existing media entry and NO new file, so PUT entry to edit URI
                method = new PutMethod(getEditURI());
                final StringWriter sw = new StringWriter();
                Atom10Generator.serializeEntry(this, sw);
                method.setRequestEntity(new StringRequestEntity(sw.toString(), null, null));
                method.setRequestHeader("Content-type", "application/atom+xml; charset=utf8");
            } else {
                throw new ProponoException("ERROR: media entry has no edit URI or media-link URI");
            }
            getCollection().addAuthentication(method);
            method.addRequestHeader("Title", getTitle());
            getCollection().getHttpClient().executeMethod(method);
            if (inputStream != null) {
                inputStream.close();
            }
            final InputStream is = method.getResponseBodyAsStream();
            if (method.getStatusCode() != 200 && method.getStatusCode() != 201) {
                throw new ProponoException("ERROR HTTP status=" + method.getStatusCode() + " : " + Utilities.streamToString(is));
            }

        } catch (final Exception e) {
            throw new ProponoException("ERROR: saving media entry");
        }
        if (method.getStatusCode() != 201) {
            throw new ProponoException("ERROR HTTP status=" + method.getStatusCode());
        }
    }
1153134
def add(self, media, filepath, overwrite=True):
        
        with open(filepath, 'rb') as fhandler:
            self._dokuwiki.send('wiki.putAttachment', media,
                                Binary(fhandler.read()), ow=overwrite)
290093
public ApiResponse updateTransformation(String transformation, Map updates, Map options) throws Exception {
        if (options == null) options = ObjectUtils.emptyMap();
        return callApi(HttpMethod.PUT, Arrays.asList("transformations", transformation), updates, options);
    }
966919
public void generate()
		throws WikiApiException
	{
		Indexer data = null;
		try {
			data = new Indexer(config);

			System.out.println("GENERATING INDEX STARTED");

			long bufferSize = config.getBufferSize();
			Revision rev;
			long count = 0;
			long last = 0, now, start = System.currentTimeMillis();

			Iterator<Revision> it = new IndexIterator(config);
			while (it.hasNext()) {

				if (++count % bufferSize == 0) {
					now = System.currentTimeMillis() - start;
					System.out.println(Time.toClock(now) + "\t" + (now - last)
							+ "\tINDEXING " + count);
					last = now;
				}

				rev = it.next();
				data.index(rev);
			}

			System.out.println("GENERATING INDEX ENDED + ("
					+ Time.toClock(System.currentTimeMillis() - start) + ")");

		}
		catch (Exception e) {

			throw new WikiApiException(e);

		}
		finally {
			if (data != null) {
				data.close();
			}
		}
	}
817472
@Override
  public boolean commit() {
    final CoreRemoteMongoCollection<DocumentT> collection = getCollection();
    final List<WriteModel<DocumentT>> writeModels = getBulkWriteModels();

    // define success as any one operation succeeding for now
    boolean success = true;
    for (final WriteModel<DocumentT> write : writeModels) {
      if (write instanceof ReplaceOneModel) {
        final ReplaceOneModel<DocumentT> replaceModel = ((ReplaceOneModel) write);
        final RemoteUpdateResult result =
            collection.updateOne(replaceModel.getFilter(), (Bson) replaceModel.getReplacement());
        success = success
            && (result != null && result.getModifiedCount() == result.getMatchedCount());
      } else if (write instanceof UpdateOneModel) {
        final UpdateOneModel<DocumentT> updateModel = ((UpdateOneModel) write);
        final RemoteUpdateResult result =
            collection.updateOne(updateModel.getFilter(), updateModel.getUpdate());
        success = success
            && (result != null && result.getModifiedCount() == result.getMatchedCount());
      } else if (write instanceof UpdateManyModel) {
        final UpdateManyModel<DocumentT> updateModel = ((UpdateManyModel) write);
        final RemoteUpdateResult result =
            collection.updateMany(updateModel.getFilter(), updateModel.getUpdate());
        success = success
            && (result != null && result.getModifiedCount() == result.getMatchedCount());
      }
    }
    return success;
  }
293585
public void endUpdate() throws IOException {
        ResponseWriter writer = getWrapped();
        writer.endCDATA();
        writer.endElement("update");
        inUpdate = false;
    }
771030
public Response update(String id, Object document) {
        Misc.checkNotNullOrEmpty(id, "id");
        Misc.checkNotNull(document, "Document");

        // Get the latest rev, will throw if doc doesn't exist
        getDocumentRev(id);

        return putUpdate(id, document);
    }