Sets the current AJAX operation details.

@param operation the current AJAX operation.
@param trigger the current AJAX operation trigger and its context.
171359
public static void setCurrentOperationDetails(final AjaxOperation operation, final ComponentWithContext trigger) {
		if (operation == null) {
			THREAD_LOCAL_OPERATION.remove();
		} else {
			THREAD_LOCAL_OPERATION.set(operation);
		}

		if (trigger == null) {
			THREAD_LOCAL_COMPONENT_WITH_CONTEXT.remove();
		} else {
			THREAD_LOCAL_COMPONENT_WITH_CONTEXT.set(trigger);
		}
	}
1358232
public DataProviderContext on(final Trigger... triggers) {
        if (triggers != null) {
            Collections.addAll(registeredTriggers, triggers);
        }
        return this;
    }
1016095
public void trigger(Object event){

        Set<Class> eventTypes = getAllInheritedClasses(event.getClass());

        for (Class eventType : eventTypes) {
            if(observers.containsKey(eventType)){
                for (EventObserver eventObserver : observers.get(eventType)) {
                    executionQueue.get().add(new EventExecution(event, eventObserver));
                }
            }
        }

        triggerQueue();
    }
719939
@Override
	public void serviceRequest(final Request request) {
		// Get trigger id
		triggerId = request.getParameter(WServlet.AJAX_TRIGGER_PARAM_NAME);
		if (triggerId == null) {
			throw new SystemException("No AJAX trigger id to check step count");
		}

		// Get trigger and its context
		ComponentWithContext trigger = AjaxHelper.getCurrentTriggerAndContext();
		if (trigger == null) {
			throw new IllegalStateException(
					"No component/context available for AJAX trigger " + triggerId + ".");
		}

		// Get expected step count
		UIContext uic = UIContextHolder.getCurrent();
		int expected = uic.getEnvironment().getStep();

		// Step should already be set on the session
		if (expected == 0) {
			throw new SystemException(
					"Step count should already be set on the session before AJAX request.");
		}

		// Get step count on the request
		int got = StepCountUtil.getRequestStep(request);

		// Check we are on the current step
		if (expected == got) {
			// Process Service Request
			getBackingComponent().serviceRequest(request);
		} else { // Invalid step
			LOG.warn("AJAX: Wrong step detected. Expected step " + expected + " but got step " + got);
			// "GET" Ajax requests are just ignored and return an error code
			if ("GET".equals(request.getMethod())) {
				LOG.warn("Error code will be sent in the response for AJAX GET Request.");
				handleErrorCode();
				// Make sure the render phase is not processed
				throw new ActionEscape();
			} else if (StepCountUtil.isErrorRedirect()) { // Redirect to error page
				LOG.warn("User will be redirected to an error page.");
				redirectUrl = StepCountUtil.getErrorUrl();
			} else {  // Warp to the future by refreshing the page
				LOG.warn("Warp the user back to the future by refreshing the page.");
				handleWarpToTheFuture(uic);
				redirectUrl = buildApplicationUrl(uic);
			}
		}
	}
70702
private void processNewOperation(StorageOperation operation) {
        if (operation instanceof MergeSegmentOperation) {
            this.operations.add(operation);
            this.mergeTransactionCount.incrementAndGet();
        } else if (operation instanceof StreamSegmentSealOperation) {
            this.operations.add(operation);
            this.hasSealPending.set(true);
        } else if (operation instanceof StreamSegmentTruncateOperation) {
            this.operations.add(operation);
            this.truncateCount.incrementAndGet();
        } else if (operation instanceof CachedStreamSegmentAppendOperation) {
            // Aggregate the Append Operation.
            AggregatedAppendOperation aggregatedAppend = getOrCreateAggregatedAppend(
                    operation.getStreamSegmentOffset(), operation.getSequenceNumber());
            aggregateAppendOperation((CachedStreamSegmentAppendOperation) operation, aggregatedAppend);
        }
    }
927194
public void registerOngoingOperation(
			final K operationKey,
			final CompletableFuture<R> operationResultFuture) {
		final ResultAccessTracker<R> inProgress = ResultAccessTracker.inProgress();
		registeredOperationTriggers.put(operationKey, inProgress);
		operationResultFuture.whenComplete((result, error) -> {
			if (error == null) {
				completedOperations.put(operationKey, inProgress.finishOperation(Either.Right(result)));
			} else {
				completedOperations.put(operationKey, inProgress.finishOperation(Either.Left(error)));
			}
			registeredOperationTriggers.remove(operationKey);
		});
	}
898682
@Override
	public void handleRequest(final Request request) {
		// Check if this link was the AJAX Trigger
		AjaxOperation operation = AjaxHelper.getCurrentOperation();
		boolean pressed = (operation != null && getId().equals(operation.getTriggerId()));

		// Protect against client-side tampering of disabled/read-only fields.
		if (isDisabled() && pressed) {
			LOG.warn("A disabled link has been triggered. " + getText() + ". " + getId());
			return;
		}

		// If an action has been supplied then execute it, but only after
		// handle request has been performed on the entire component tree.
		final Action action = getAction();

		if (pressed && action != null) {
			final ActionEvent event = new ActionEvent(this, getActionCommand(), getActionObject());

			Runnable later = new Runnable() {
				@Override
				public void run() {
					action.execute(event);
				}
			};

			invokeLater(later);
		}
	}
225170
protected <T> T _executeTx(
                    final String operation,
                    final Class<? extends Persistable<?>> type,
                    final TransactionCallback<T> action
                    )
    {
        return _executeTx( operation, type, null, action );
    }
801756
public void setOperations(java.util.Collection<Operation> operations) {
        if (operations == null) {
            this.operations = null;
            return;
        }

        this.operations = new java.util.ArrayList<Operation>(operations);
    }
1044801
protected Object process(String operation, Object data){
        Closure<Object,Object> cl = operations.get(operation);
        if(cl!=null){
            return cl.call(data);
        }
        return true;
    }
1078099
public void setLogicalOperator(LogicalOperator operator) {
		switch (operator) {
			case AND:
				logicalOperatorRadio.setValue(I18nProvider.getSearch().radioOperatorAnd());
				break;
			case OR:
				logicalOperatorRadio.setValue(I18nProvider.getSearch().radioOperatorOr());
				break;
			default:
				throw new IllegalStateException("Unknown operator " + operator);
		}
	}
801312
private void addUpdateAttributesOperation(UpdateAttributesOperation operation) {
        if (!this.metadata.isSealedInStorage()) {
            // Only process the operation if the Segment is not sealed in Storage. If it is, then so is the Attribute Index,
            // and it means this operation has already been applied to the index.
            Map<UUID, Long> attributes = getExtendedAttributes(operation);
            if (!attributes.isEmpty()) {
                AggregatedAppendOperation aggregatedAppend = getOrCreateAggregatedAppend(this.metadata.getStorageLength(), operation.getSequenceNumber());
                aggregatedAppend.includeAttributes(attributes);
            }
        }
    }
975059
public void runQueryOperation(Object operation, SimpleCompletableFuture resultFuture) {
        long commitIndex = state.commitIndex();
        Object result = raftIntegration.runOperation(operation, commitIndex);
        resultFuture.setResult(result);
    }
1250608
public void setOperationInfos(JmxOperationInfo[] operationInfos) {
		if (this.operationInfos == null) {
			this.operationInfos = arrayToList(operationInfos);
		} else {
			for (JmxOperationInfo opertionInfo : operationInfos) {
				this.operationInfos.add(opertionInfo);
			}
		}
	}
444202
public void setTraces(Trace... traces) {
        if (this.httpClient instanceof DefaultHttpClient) {
            ((DefaultHttpClient)this.httpClient).setTraces(traces);
        }
        else
            throw new UnsupportedOperationException("Invalid operation for class " + this.httpClient.getClass());
    }
1015820
public void setTriggers(List<Trigger> triggers) {
        this.triggers.clear();
        if (triggers != null) {
            this.triggers.addAll(triggers);
        }
    }
935702
protected void validate(String operationType) throws Exception
	{
		super.validate(operationType);

		MPSInt polling_interval_validator = new MPSInt();
		polling_interval_validator.setConstraintMinValue(MPSConstants.GENERIC_CONSTRAINT, 1);
		polling_interval_validator.setConstraintMaxValue(MPSConstants.GENERIC_CONSTRAINT, 1000);
		polling_interval_validator.validate(operationType, polling_interval, "\"polling_interval\"");
		
		MPSString interval_unit_validator = new MPSString();
		interval_unit_validator.validate(operationType, interval_unit, "\"interval_unit\"");
		
	}