@Override public OperationRequest deserialize(JsonElement json, Type type, JsonDeserializationContext ctx) throws JsonParseException { JsonObject jsonObject = json.getAsJsonObject(); JsonObject parameters = jsonObject.getAsJsonObject(RequestProperty.PARAMS.key()); OperationRequest request = new OperationRequest( jsonObject.get(RequestProperty.METHOD.key()).getAsString(), jsonObject.get(RequestProperty.ID.key()).getAsString(), getPropertyAsStringThenRemove(parameters, ParamsProperty.WAVE_ID), getPropertyAsStringThenRemove(parameters, ParamsProperty.WAVELET_ID), getPropertyAsStringThenRemove(parameters, ParamsProperty.BLIP_ID)); for (Entry<String, JsonElement> parameter : parameters.entrySet()) { ParamsProperty parameterType = ParamsProperty.fromKey(parameter.getKey()); if (parameterType != null) { Object object; if (parameterType == ParamsProperty.RAW_DELTAS) { object = ctx.deserialize(parameter.getValue(), GsonFactory.RAW_DELTAS_TYPE); } else { object = ctx.deserialize(parameter.getValue(), parameterType.clazz()); } request.addParameter(Parameter.of(parameterType, object)); } } return request; }
/** * Creates a new wavelet with an optional message. * * @param domain the domain to create the wavelet in. * @param participants the initial participants on this new wavelet. * @param message an optional payload that is returned with the corresponding * event. * @return an instance of {@link Wavelet} that represents the new wavelet. */ public Wavelet createWavelet(String domain, Set<String> participants, String message) { Wavelet newWavelet = newWavelet(domain, participants, this); OperationRequest operation = appendOperation(OperationType.ROBOT_CREATE_WAVELET, newWavelet, Parameter.of(ParamsProperty.WAVELET_DATA, newWavelet.serialize())); // Don't add the message if it's null or empty. if (message != null && !message.isEmpty()) { operation.addParameter(Parameter.of(ParamsProperty.MESSAGE, message)); } return newWavelet; }
operation.addParameter(Parameter.of(ParamsProperty.PROXYING_FOR, proxyForId));
op.addParameter(parameter); op.addParameter(Parameter.of(ParamsProperty.MODIFY_ACTION, new DocumentModifyAction( modifyHow, values, annotationName, elements, bundledAnnotations, useMarkup)));