@Override public void transmitOperationList(final List<VdcOperation<?, ?>> operations) { // Operations can be either actions or queries. Both require different handling so lets // Split them out into two lists so we can process them independently. List<VdcOperation<?, ?>> queriesList = new ArrayList<>(); Map<ActionType, List<VdcOperation<?, ?>>> actionsMap = new HashMap<>(); for (VdcOperation<?, ?> operation: operations) { if (operation.isAction()) { List<VdcOperation<?, ?>> actionsList = actionsMap.get(operation.getOperation()); if (actionsList == null) { actionsList = new ArrayList<>(); actionsMap.put((ActionType) operation.getOperation(), actionsList); } actionsList.add(operation); } else { queriesList.add(operation); } } if (!actionsMap.isEmpty()) { // We have some actions, call method to send actions. transmitMultipleActions(actionsMap); } if (!queriesList.isEmpty()) { // We have some queries, call method to send queries. transmitMultipleQueries(queriesList); } }
@Override public void serviceFound(GenericApiGWTServiceAsync service) { service.runPublicQuery((QueryType) operation.getOperation(), (QueryParametersBase) operation.getParameter(), new AsyncCallback<QueryReturnValue>() { @Override public void onFailure(final Throwable exception) { operation.getCallback().onFailure(operation, exception); } @Override public void onSuccess(final QueryReturnValue result) { operation.getCallback().onSuccess(operation, result); } }); }
@Override public void serviceFound(GenericApiGWTServiceAsync service) { service.runQuery((QueryType) operation.getOperation(), (QueryParametersBase) operation.getParameter(), new AsyncCallback<QueryReturnValue>() { @Override public void onFailure(final Throwable exception) { //Clear out the token, and let the retry mechanism try again. xsrfRequestBuilder.setXsrfToken(null); operation.getCallback().onFailure(operation, exception); } @Override public void onSuccess(final QueryReturnValue result) { operation.getCallback().onSuccess(operation, result); } }); }
@Override public void serviceFound(GenericApiGWTServiceAsync service) { service.runAction((ActionType) operation.getOperation(), (ActionParametersBase) operation.getParameter(), new AsyncCallback<ActionReturnValue>() { @Override public void onFailure(final Throwable exception) { //Clear out the token, and let the retry mechanism try again. xsrfRequestBuilder.setXsrfToken(null); operation.getCallback().onFailure(operation, exception); } @Override public void onSuccess(final ActionReturnValue result) { operation.getCallback().onSuccess(operation, result); } }); }
/** * Copy constructor that allows for a different callback. * @param sourceOperation The source {@code VdcOperation} object. * @param callback The new callback method. */ public VdcOperation(final VdcOperation<T, P> sourceOperation, final VdcOperationCallback<?, ?> callback) { this(sourceOperation.getOperation(), sourceOperation.getParameter(), callback, sourceOperation, sourceOperation.isPublic(), sourceOperation.isFromList, sourceOperation.isRunOnlyIfAllValidationPass()); }
runPublicQuery(operation); } else { queryTypes.add((QueryType) operation.getOperation()); parameters.add((QueryParametersBase) operation.getParameter());