This method contains the stream of actions that are applied on any update.
<p>
It will correctly handle addition of users into the DB and the execution of abilities and replies.

@param update the update received by Telegram's API
428635
public void onUpdateReceived(Update update) {
    BotLogger.info(format("New update [%s] received at %s", update.getUpdateId(), now()), format("%s - %s", TAG, botUsername));
    BotLogger.info(update.toString(), TAG);
    long millisStarted = System.currentTimeMillis();

    Stream.of(update)
        .filter(this::checkGlobalFlags)
        .filter(this::checkBlacklist)
        .map(this::addUser)
        .filter(this::filterReply)
        .map(this::getAbility)
        .filter(this::validateAbility)
        .filter(this::checkPrivacy)
        .filter(this::checkLocality)
        .filter(this::checkInput)
        .filter(this::checkMessageFlags)
        .map(this::getContext)
        .map(this::consumeUpdate)
        .forEach(this::postConsumption);

    long processingTime = System.currentTimeMillis() - millisStarted;
    BotLogger.info(format("Processing of update [%s] ended at %s%n---> Processing time: [%d ms] <---%n", update.getUpdateId(), now(), processingTime), format("%s - %s", TAG, botUsername));
  }
752048
public static User getUser(Update update) {
    if (MESSAGE.test(update)) {
      return update.getMessage().getFrom();
    } else if (CALLBACK_QUERY.test(update)) {
      return update.getCallbackQuery().getFrom();
    } else if (INLINE_QUERY.test(update)) {
      return update.getInlineQuery().getFrom();
    } else if (CHANNEL_POST.test(update)) {
      return update.getChannelPost().getFrom();
    } else if (EDITED_CHANNEL_POST.test(update)) {
      return update.getEditedChannelPost().getFrom();
    } else if (EDITED_MESSAGE.test(update)) {
      return update.getEditedMessage().getFrom();
    } else if (CHOSEN_INLINE_QUERY.test(update)) {
      return update.getChosenInlineQuery().getFrom();
    } else {
      throw new IllegalStateException("Could not retrieve originating user from update");
    }
  }
676420
public void onApplicationUpdate(ZWaveControllerContext context, ApplicationUpdate update) {
        switch (nodeState) {

            case NodeInfo:
                // if the application update failed to send, re-send it
                if (update.didInfoRequestFail()) {
                    if (stateRetries < 1) {
                        logger.trace("Application update failed for node {}; will retry", getNodeId());
                        sendDataFrame(context, new RequestNodeInfo(getNodeId()));
                        stateRetries++;
                    } else {
                        if (isListeningNode()) {
                            logger.trace("Node {} provided no node info after {} retries; should be listening so flagging as unavailable and started", getNodeId(), stateRetries);
                            available = false;
                            setState(context, ZWaveNodeState.Started);
                        } else {
                            logger.trace("Node {} provided no node info after {} retries; not flagged as listening so assuming it's asleep", getNodeId(), stateRetries);
                            available = true;
                            setState(context, ZWaveNodeState.Started);
                        }
                    }
                } else {
                    // check if there are optional command classes
                    byte[] commandClasses = update.getNodeInfo().getCommandClasses();
                    for (byte commandClassId : commandClasses) {
                        if (!hasCommandClass(commandClassId)) {
                            CommandClass cc = CommandClassFactory.createCommandClass(commandClassId);
                            if (cc != null) {
                                addCommandClass(commandClassId, cc);
                            } else {
                                logger.trace("Ignoring optional command class: {}", ByteUtil.createString(commandClassId));
                            }
                        }
                    }

                    // if this node has the Version command class, then we should retrieve version for information
                    // for all command classes it supports
                    if (getCommandClass(VersionCommandClass.ID) != null) {
                        setState(context, ZWaveNodeState.RetrieveVersionPending);
                        // otherwise, we assume all command classes are version 1 and move on
                    } else {
                        setState(context, ZWaveNodeState.RetrieveStatePending);
                    }
                }
                break;

            default:
                logger.trace("Unsolicited ApplicationUpdate received; refreshing node");
                refresh(false);
                break;
        }
    }
1125498
protected void performUpdate() {

        // Wrap a try-catch around everything, because an escaping exception would cancel the task from which this is called
        List<CmsWaitHandle> waitHandles = new ArrayList<>();
        try {
            ArrayList<Object> work = new ArrayList<>();
            m_workQueue.drainTo(work);
            Set<CmsUUID> updateIds = new HashSet<CmsUUID>();

            for (Object item : work) {
                if (item instanceof CmsUUID) {
                    updateIds.add((CmsUUID)item);
                } else if (item instanceof CmsWaitHandle) {
                    waitHandles.add((CmsWaitHandle)item);
                }
            }
            CmsADEConfigCacheState oldState = m_state;
            if (!updateIds.isEmpty() || (oldState == null)) {
                try {
                    // Although  the updates are performed in a scheduled task, it is still possible
                    // that the task is scheduled immediately after a configuration update event. So
                    // here we ensure that there is at least a small delay between the event and the
                    // actual update. This is required to prevent problems with other caches.
                    Thread.sleep(100);
                } catch (InterruptedException e) {
                    // ignore
                }
                if (updateIds.contains(ID_UPDATE_ALL) || (oldState == null)) {
                    m_state = readCompleteConfiguration();
                } else {
                    boolean updateModules = updateIds.remove(ID_UPDATE_MODULES);
                    boolean updateElementViews = updateIds.remove(ID_UPDATE_ELEMENT_VIEWS);
                    updateIds.remove(ID_UPDATE_FOLDERTYPES); // folder types are always updated when the update set is not empty, so at this point we don't care whether the id for folder type updates actually is in the update set
                    Map<CmsUUID, CmsADEConfigDataInternal> updateMap = Maps.newHashMap();
                    for (CmsUUID structureId : updateIds) {
                        CmsADEConfigDataInternal sitemapConfig = parseSitemapConfiguration(structureId);
                        // sitemapConfig may be null at this point
                        updateMap.put(structureId, sitemapConfig);
                    }
                    List<CmsADEConfigDataInternal> moduleConfigs = null;
                    if (updateModules) {
                        moduleConfigs = loadModuleConfiguration();
                    }
                    Map<CmsUUID, CmsElementView> elementViews = null;
                    if (updateElementViews) {
                        elementViews = loadElementViews();
                    }
                    m_state = oldState.createUpdatedCopy(updateMap, moduleConfigs, elementViews);
                }
            }

        } catch (Exception e) {
            LOG.error("Could not perform configuration cache update: " + e.getMessage(), e);
        } finally {
            for (CmsWaitHandle handle : waitHandles) {
                handle.release();
            }
        }
    }
1122705
protected void update() {
        putValue(Action.ACTION_COMMAND_KEY, command.getActionCommand());
        CommandFaceDescriptor face = command.getFaceDescriptor();
        if (face != null) {
            face.configure(this);
        }
        setEnabled(command.isEnabled());
    }
893146
public static base_response update(nitro_service client, appflowaction resource) throws Exception {
		appflowaction updateresource = new appflowaction();
		updateresource.name = resource.name;
		updateresource.collectors = resource.collectors;
		updateresource.comment = resource.comment;
		return updateresource.update_resource(client);
	}
547891
private void updateDetail(TrackMetadataUpdate update, WaveformDetail detail) {
        detailHotCache.put(DeckReference.getDeckReference(update.player, 0), detail);  // Main deck
        if (update.metadata.getCueList() != null) {  // Update the cache with any hot cues in this track as well
            for (CueList.Entry entry : update.metadata.getCueList().entries) {
                if (entry.hotCueNumber != 0) {
                    detailHotCache.put(DeckReference.getDeckReference(update.player, entry.hotCueNumber), detail);
                }
            }
        }
        deliverWaveformDetailUpdate(update.player, detail);
    }
594281
@Override
    public T update(T entity) {
        EntityManager entityManager = getEntityManager();
        T result = entityManager.merge(entity);
        return result;
    }
45445
public void commit(DBTransaction transaction) {
        try {
            applyUpdates(transaction);
        } catch (Exception e) {
            m_logger.error("Updates failed", e);
            throw e;
        } finally {
            transaction.clear();
        }
    }
3568
private void handleUpdate(final TrackMetadataUpdate update) {
        boolean foundInCache = false;

        if (update.metadata == null || update.metadata.trackType != CdjStatus.TrackType.REKORDBOX) {
            clearDeck(update);
        } else {
            // We can offer waveform information for this device; check if we've already looked it up. First, preview:
            final WaveformPreview lastPreview = previewHotCache.get(DeckReference.getDeckReference(update.player, 0));
            if (lastPreview == null || !lastPreview.dataReference.equals(update.metadata.trackReference)) {  // We have something new!

                // First see if we can find the new preview in the hot cache
                for (WaveformPreview cached : previewHotCache.values()) {
                    if (cached.dataReference.equals(update.metadata.trackReference)) {  // Found a hot cue hit, use it.
                        updatePreview(update, cached);
                        foundInCache = true;
                        break;
                    }
                }

                // If not found in the cache try actually retrieving it.
                if (!foundInCache && activePreviewRequests.add(update.player)) {
                    clearDeckPreview(update);  // We won't know what it is until our request completes.
                    // We had to make sure we were not already asking for this track.
                    new Thread(new Runnable() {
                        @Override
                        public void run() {
                            try {
                                WaveformPreview preview = requestPreviewInternal(update.metadata.trackReference, true);
                                if (preview != null) {
                                    updatePreview(update, preview);
                                }
                            } catch (Exception e) {
                                logger.warn("Problem requesting waveform preview from update" + update, e);
                            } finally {
                                activePreviewRequests.remove(update.player);
                            }
                        }
                    }).start();
                }
            }

            // Secondly, the detail.
            foundInCache = false;
            final WaveformDetail lastDetail = detailHotCache.get(DeckReference.getDeckReference(update.player, 0));
            if (isFindingDetails() && (lastDetail == null || !lastDetail.dataReference.equals(update.metadata.trackReference))) {  // We have something new!

                // First see if we can find the new detailed waveform in the hot cache
                for (WaveformDetail cached : detailHotCache.values()) {
                    if (cached.dataReference.equals(update.metadata.trackReference)) {  // Found a hot cue hit, use it.
                        updateDetail(update, cached);
                        foundInCache = true;
                        break;
                    }
                }

                // If not found in the cache try actually retrieving it.
                if (!foundInCache && activeDetailRequests.add(update.player)) {
                    clearDeckDetail(update);  // We won't know what it is until our request completes.
                    // We had to make sure we were not already asking for this track.
                    new Thread(new Runnable() {
                        @Override
                        public void run() {
                            try {
                                WaveformDetail detail = requestDetailInternal(update.metadata.trackReference, true);
                                if (detail != null) {
                                    updateDetail(update, detail);
                                }
                            } catch (Exception e) {
                                logger.warn("Problem requesting waveform detail from update" + update, e);
                            } finally {
                                activeDetailRequests.remove(update.player);
                            }
                        }
                    }).start();
                }
            }
        }
    }
669992
public T update() throws IOException, PlivoRestException {
    validate();
    Response<T> response = obtainCall().execute();

    handleResponse(response);

    return response.body();
  }
1269251
public void update(List<UninstallationProgressEvent> events) {
        if (!isVisible()) {
            if ((System.currentTimeMillis() - startTime) >= MS_TO_WAIT_BEFORE_SHOW) {
                if (!done && !setVisibleInvoked) {
                    setVisibleInvoked = true;
                    EventQueue.invokeLater(new Runnable() {

                        @Override
                        public void run() {
                            if (!done) {
                                UninstallationProgressDialogue.super.setVisible(true);
                            }
                        }
                    });
                }
            }
        }

        int totalAmount = 0;
        AddOn addOn = null;

        for (UninstallationProgressEvent event : events) {
            totalAmount += event.getAmount();
            if (UninstallationProgressEvent.Type.FINISHED_ADD_ON == event.getType()) {
                for (AddOnUninstallListener listener : listeners) {
                    failedUninstallations = !event.isUninstalled();
                    listener.addOnUninstalled(currentAddOn, update, event.isUninstalled());
                }
            } else if (UninstallationProgressEvent.Type.ADD_ON == event.getType()) {
                addOn = event.getAddOn();
                currentAddOn = addOn;
                update = event.isUpdate();

                for (AddOnUninstallListener listener : listeners) {
                    listener.uninstallingAddOn(addOn, update);
                }
            }
        }

        UninstallationProgressEvent last = events.get(events.size() - 1);

        if (addOn != null) {
            setCurrentAddOn(addOn);
        }

        if (totalAmount != 0) {
            incrementProgress(totalAmount);
        }

        if (currentType != last.getType()) {
            String keyMessage;
            switch (last.getType()) {
            case FILE:
                keyMessage = "cfu.uninstallation.progress.dialogue.uninstallingFile";
                break;
            case ACTIVE_RULE:
                keyMessage = "cfu.uninstallation.progress.dialogue.uninstallingActiveScanner";
                break;
            case PASSIVE_RULE:
                keyMessage = "cfu.uninstallation.progress.dialogue.uninstallingPassiveScanner";
                break;
            case EXTENSION:
                keyMessage = "cfu.uninstallation.progress.dialogue.uninstallingExtension";
                break;
            default:
                keyMessage = "";
                break;
            }
            currentType = last.getType();
            keyBaseStatusMessage = keyMessage;
        }

        if (keyBaseStatusMessage.isEmpty()) {
            setCustomMessage("");
        } else {
            setCustomMessage(
                    Constant.messages
                            .getString(keyBaseStatusMessage, last.getValue(), last.getMax()));
        }
    }
90874
public EKBCommit addUpdate(Object update) {
        if (update != null) {
            checkIfModel(update);
            updates.add((OpenEngSBModel) update);
        }
        return this;
    }
732456
public void update(String server, Transaction t, boolean deleteMissingChildren) {
        on(server).update(t, deleteMissingChildren);
    }
449772
public void put(@NonNull INDArray update) {
        try {
            lock.writeLock().lock();

            //if we're already in collapsed mode - we just insta-decompress
            if (collapsedMode.get()) {
                val lastUpdateIndex = collapsedIndex.get();
                val lastUpdate = updates.get(lastUpdateIndex);

                Preconditions.checkArgument(!lastUpdate.isCompressed(), "lastUpdate should NOT be compressed during collapse mode");

                smartDecompress(update, lastUpdate);

                // collapser only can work if all consumers are already introduced
            } else if (allowCollapse && positions.size() >= expectedConsumers) {
                // getting last added update
                val lastUpdateIndex = updatesCounter.get();

                // looking for max common non-applied update
                long maxIdx = firstNotAppliedIndexEverywhere();
                val array = Nd4j.create(shape);

                val delta = lastUpdateIndex - maxIdx;
                if (delta >= collapseThreshold) {
                    log.trace("Max delta to collapse: {}; Range: <{}...{}>", delta, maxIdx, lastUpdateIndex);
                    for (long e = maxIdx; e < lastUpdateIndex; e++) {
                        val u = updates.get(e);
                        if (u == null)
                            log.error("Failed on index {}", e);
                           // continue;

                        smartDecompress(u, array);

                        // removing updates array
                        updates.remove(e);
                    }

                    // decode latest update
                    smartDecompress(update, array);

                    // putting collapsed array back at last index
                    updates.put(lastUpdateIndex, array);
                    collapsedIndex.set(lastUpdateIndex);

                    // shift counter by 1
                    updatesCounter.getAndIncrement();

                    // we're saying that right now all updates within some range are collapsed into 1 update
                    collapsedMode.set(true);
                } else {
                    updates.put(updatesCounter.getAndIncrement(), update);
                }
            } else {
                updates.put(updatesCounter.getAndIncrement(), update);
            }
        } finally {
            lock.writeLock().unlock();
        }
    }
991475
@SuppressWarnings("unchecked")
    public <T extends IEntity> T update(T entity) throws FMSException {

        IntuitMessage intuitMessage = prepareUpdate(entity);

        //execute interceptors
        executeInterceptors(intuitMessage);

        return (T) retrieveEntity(intuitMessage);
    }
322385
@RequestMapping(value = "/update", method = RequestMethod.POST)
	public @ResponseBody
	void update(
			@RequestParam(value = "username", required = true) String username,
			@RequestParam(value = "name", required = false) String name,
			@RequestParam(value = "surname", required = false) String surname,
			@RequestParam(value = "telephoneNumber", required = false) String telephoneNumber) {
		logger.debug("Received request to update account");

		accountService.update(new Account(username, name, surname,
				telephoneNumber));

	}