Package com.google.wave.api.impl

Examples of com.google.wave.api.impl.DocumentModifyAction


  }

  public void testFailOnMultipleWhereParams() throws Exception {
    OperationRequest operation =
        operationRequest(OperationType.DOCUMENT_MODIFY, rootBlipId,
            Parameter.of(ParamsProperty.MODIFY_ACTION, new DocumentModifyAction()),
            Parameter.of(ParamsProperty.RANGE, new Range(0, 1)),
            Parameter.of(ParamsProperty.INDEX, 0));

    try {
      service.execute(operation, helper.getContext(), ALEX);
View Full Code Here


  }

  public void testAnnotate() throws Exception {
    OperationRequest operation =
        operationRequest(OperationType.DOCUMENT_MODIFY, rootBlipId,
            Parameter.of(ParamsProperty.MODIFY_ACTION, new DocumentModifyAction(ModifyHow.ANNOTATE,
                Collections.singletonList(ANNOTATION_VALUE), ANNOTATION_KEY, NO_ELEMENTS,
                NO_BUNDLED_ANNOTATIONS, false)),
            Parameter.of(ParamsProperty.INDEX, CONTENT_START_TEXT));

    service.execute(operation, helper.getContext(), ALEX);
View Full Code Here

    assertEquals("Expected the text to be annotated", ANNOTATION_VALUE, annotation);

    OperationRequest operation =
      operationRequest(OperationType.DOCUMENT_MODIFY, rootBlipId,
            Parameter.of(ParamsProperty.MODIFY_ACTION,
                new DocumentModifyAction(ModifyHow.CLEAR_ANNOTATION, NO_VALUES, ANNOTATION_KEY,
                    NO_ELEMENTS, NO_BUNDLED_ANNOTATIONS, false)),
            Parameter.of(ParamsProperty.INDEX, CONTENT_START_TEXT));

    service.execute(operation, helper.getContext(), ALEX);
View Full Code Here

    elementsIn.add(new Gadget(properties));

    OperationRequest operation =
      operationRequest(OperationType.DOCUMENT_MODIFY, rootBlipId,
            Parameter.of(ParamsProperty.MODIFY_ACTION,
                new DocumentModifyAction(ModifyHow.INSERT, NO_VALUES, NO_ANNOTATION_KEY,
                    elementsIn, NO_BUNDLED_ANNOTATIONS, false)),
            Parameter.of(ParamsProperty.INDEX, CONTENT_START_TEXT));

    service.execute(operation, helper.getContext(), ALEX);
   
View Full Code Here

    updatedElementsIn.add(new Gadget(newProperties));

    OperationRequest updateOperation =
        operationRequest(OperationType.DOCUMENT_MODIFY, rootBlipId,
            Parameter.of(ParamsProperty.MODIFY_ACTION,
                new DocumentModifyAction(ModifyHow.UPDATE_ELEMENT,
                NO_VALUES, NO_ANNOTATION_KEY, updatedElementsIn, NO_BUNDLED_ANNOTATIONS, false)),
            Parameter.of(ParamsProperty.MODIFY_QUERY, new DocumentModifyQuery(ElementType.GADGET,
                ImmutableMap.of("url", gadgetUrl), 1)));

    service.execute(updateOperation, helper.getContext(), ALEX);
View Full Code Here

  public void testDelete() throws Exception {
    OperationRequest operation =
      operationRequest(OperationType.DOCUMENT_MODIFY, rootBlipId,
            Parameter.of(ParamsProperty.MODIFY_ACTION,
                new DocumentModifyAction(ModifyHow.DELETE, NO_VALUES, NO_ANNOTATION_KEY,
                    NO_ELEMENTS, NO_BUNDLED_ANNOTATIONS, false)),
            Parameter.of(ParamsProperty.INDEX, CONTENT_START_TEXT));

    service.execute(operation, helper.getContext(), ALEX);
View Full Code Here

    // Insert a new piece of annotated text before the current text.
    OperationRequest operation =
        operationRequest(OperationType.DOCUMENT_MODIFY, rootBlipId,
            Parameter.of(ParamsProperty.MODIFY_ACTION,
                new DocumentModifyAction(ModifyHow.INSERT, Collections.singletonList(toInsert),
                    NO_ANNOTATION_KEY, NO_ELEMENTS,
                    BundledAnnotation.listOf(ANNOTATION_KEY, ANNOTATION_VALUE), false)),
            Parameter.of(ParamsProperty.INDEX, CONTENT_START_TEXT));

    service.execute(operation, helper.getContext(), ALEX);
View Full Code Here

  public void testInsertAfter() throws Exception {
    String toInsert = "insertedText";
    OperationRequest operation =
        operationRequest(OperationType.DOCUMENT_MODIFY, rootBlipId,
            Parameter.of(ParamsProperty.MODIFY_ACTION,
                new DocumentModifyAction(ModifyHow.INSERT_AFTER,
                    Collections.singletonList(toInsert), NO_ANNOTATION_KEY, NO_ELEMENTS,
                    NO_BUNDLED_ANNOTATIONS, false)),
            Parameter.of(ParamsProperty.INDEX, CONTENT_START_TEXT));

    service.execute(operation, helper.getContext(), ALEX);
View Full Code Here

  public void testReplace() throws Exception {
    String replacement = "replacedText";
    OperationRequest operation =
        operationRequest(OperationType.DOCUMENT_MODIFY, rootBlipId,
            Parameter.of(ParamsProperty.MODIFY_ACTION,
                new DocumentModifyAction(ModifyHow.REPLACE, Collections.singletonList(replacement),
                    NO_ANNOTATION_KEY, NO_ELEMENTS, NO_BUNDLED_ANNOTATIONS, false)),
            Parameter.of(ParamsProperty.RANGE,
                new Range(CONTENT_START_TEXT, CONTENT_START_TEXT + INITIAL_CONTENT.length())));

    service.execute(operation, helper.getContext(), ALEX);
View Full Code Here

    Map<String, String> newProperties = new HashMap<String, String>();
    newProperties.put("url", "http://www.google.com/gadget.xml");
    blip.first(ElementType.GADGET).updateElement(newProperties);

    List<OperationRequest> ops = blip.getOperationQueue().getPendingOperations();
    DocumentModifyAction action = (DocumentModifyAction) ops.get(0).getParameter(
        ParamsProperty.MODIFY_ACTION);
    assertEquals("http://www.google.com/gadget.xml", action.getElement(0).getProperty("url"));
  }
View Full Code Here

TOP

Related Classes of com.google.wave.api.impl.DocumentModifyAction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.