Package com.google.wave.api.impl

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


    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);

    Gadget gadget = null;
View Full Code Here


   */
  private DocumentHitIterator getDocumentHitIterator(OperationRequest operation, ApiView view)
      throws InvalidRequestException {
    Range range = OperationUtil.getOptionalParameter(operation, ParamsProperty.RANGE);
    Integer index = OperationUtil.getOptionalParameter(operation, ParamsProperty.INDEX);
    DocumentModifyQuery query =
        OperationUtil.getOptionalParameter(operation, ParamsProperty.MODIFY_QUERY);

    DocumentHitIterator hitIterator;
    if (range != null) {
      if (index != null || query != null) {
        throw new InvalidRequestException(
            "At most one parameter out of RANGE, INDEX and MODIFY_QUERY must be specified",
            operation);
      }
      // Use the specified range
      hitIterator = new DocumentHitIterator.Singleshot(range);
    } else if (index != null) {
      if (query != null) { // range is null.
        throw new InvalidRequestException(
            "At most one parameter out of RANGE, INDEX and MODIFY_QUERY must be specified",
            operation);
      }
      // Use exactly the location of the index
      hitIterator = new DocumentHitIterator.Singleshot(new Range(index, index + 1));
    } else if (query != null) { // range and index are both null.
      // Use the query
      hitIterator = new DocumentHitIterator.ElementMatcher(
          view, query.getElementMatch(), query.getRestrictions(), query.getMaxRes());
    } else {
      // Take entire document since nothing appropriate was specified
      hitIterator = new DocumentHitIterator.Singleshot(new Range(0, view.apiContents().length()));
    }
    return hitIterator;
View Full Code Here

   * @return an instance of blip references.
   */
  public static BlipContentRefs all(Blip blip, String target, int maxResult) {
    return new BlipContentRefs(blip,
        new BlipIterator.TextIterator(blip, target, maxResult),
        Parameter.of(ParamsProperty.MODIFY_QUERY, new DocumentModifyQuery(target, maxResult)));
  }
View Full Code Here

    }

    return new BlipContentRefs(blip,
        new BlipIterator.ElementIterator(blip, target, restrictionsAsMap, maxResult),
        Parameter.of(ParamsProperty.MODIFY_QUERY,
            new DocumentModifyQuery(target, restrictionsAsMap, maxResult)));
  }
View Full Code Here

   * @return an instance of blip references.
   */
  public static BlipContentRefs all(Blip blip, String target, int maxResult) {
    return new BlipContentRefs(blip,
        new BlipIterator.TextIterator(blip, target, maxResult),
        Parameter.of(ParamsProperty.MODIFY_QUERY, new DocumentModifyQuery(target, maxResult)));
  }
View Full Code Here

    }

    return new BlipContentRefs(blip,
        new BlipIterator.ElementIterator(blip, target, restrictionsAsMap, maxResult),
        Parameter.of(ParamsProperty.MODIFY_QUERY,
            new DocumentModifyQuery(target, restrictionsAsMap, maxResult)));
  }
View Full Code Here

   */
  private DocumentHitIterator getDocumentHitIterator(OperationRequest operation, ApiView view)
      throws InvalidRequestException {
    Range range = OperationUtil.getOptionalParameter(operation, ParamsProperty.RANGE);
    Integer index = OperationUtil.getOptionalParameter(operation, ParamsProperty.INDEX);
    DocumentModifyQuery query =
        OperationUtil.getOptionalParameter(operation, ParamsProperty.MODIFY_QUERY);

    DocumentHitIterator hitIterator;
    if (range != null) {
      if (index != null || query != null) {
        throw new InvalidRequestException(
            "At most one parameter out of RANGE, INDEX and MODIFY_QUERY must be specified",
            operation);
      }
      // Use the specified range
      hitIterator = new DocumentHitIterator.Singleshot(range);
    } else if (index != null) {
      if (query != null) { // range is null.
        throw new InvalidRequestException(
            "At most one parameter out of RANGE, INDEX and MODIFY_QUERY must be specified",
            operation);
      }
      // Use exactly the location of the index
      hitIterator = new DocumentHitIterator.Singleshot(new Range(index, index + 1));
    } else if (query != null) { // range and index are both null.
      // Use the query
      hitIterator = new DocumentHitIterator.ElementMatcher(
          view, query.getElementMatch(), query.getRestrictions(), query.getMaxRes());
    } else {
      // Take entire document since nothing appropriate was specified
      hitIterator = new DocumentHitIterator.Singleshot(new Range(0, view.apiContents().length()));
    }
    return hitIterator;
View Full Code Here

   * @return an instance of blip references.
   */
  public static BlipContentRefs all(Blip blip, String target, int maxResult) {
    return new BlipContentRefs(blip,
        new BlipIterator.TextIterator(blip, target, maxResult),
        Parameter.of(ParamsProperty.MODIFY_QUERY, new DocumentModifyQuery(target, maxResult)));
  }
View Full Code Here

    }

    return new BlipContentRefs(blip,
        new BlipIterator.ElementIterator(blip, target, restrictionsAsMap, maxResult),
        Parameter.of(ParamsProperty.MODIFY_QUERY,
            new DocumentModifyQuery(target, restrictionsAsMap, maxResult)));
  }
View Full Code Here

TOP

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

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.