Package com.google.wave.api

Examples of com.google.wave.api.OperationType


      // expected
    }
  }

  public void testRegister() throws Exception {
    OperationType operationType = OperationType.BLIP_CONTINUE_THREAD;
    DoNothingService doNothingService = DoNothingService.create();
    operationAccessor.register(operationType, doNothingService);
    OperationService service = operationAccessor.getServiceFor(operationType);
    assertEquals(doNothingService, service);
  }
View Full Code Here


    // Set up participant containers.
    List<String> participantsAdded = Lists.newArrayList();
    List<String> participantsRemoved = Lists.newArrayList();

    OperationType type = OperationUtil.getOperationType(operation);
    switch (type) {
      case WAVELET_ADD_PARTICIPANT_NEWSYNTAX:
        // Make sure targetParticipant is not already member.
        if (conversation.getParticipantIds().contains(targetParticipant)) {
          String message = targetParticipant.getAddress() + " is already a " + "member of wavelet";
          LOG.info(message);
          throw new InvalidRequestException(message, operation);
        }

        // Add participant to conversation and send event.
        conversation.addParticipant(targetParticipant);
        participantsAdded.add(targetParticipant.getAddress());
        event =
            new WaveletParticipantsChangedEvent(null, null, participant.getAddress(),
                System.currentTimeMillis(), rootBlipId, participantsAdded, participantsRemoved);
        break;
      case WAVELET_REMOVE_PARTICIPANT_NEWSYNTAX:
        // Make sure targetParticipant is already member.
        if (!conversation.getParticipantIds().contains(targetParticipant)) {
          // Not a member, throw invalid request.
          String message = targetParticipant.getAddress() + " is not a " + "member of wavelet";
          LOG.info(message);
          throw new InvalidRequestException(message, operation);
        }

        // Remove participant and send event.
        conversation.removeParticipant(targetParticipant);
        participantsRemoved.add(targetParticipant.getAddress());

        event =
            new WaveletParticipantsChangedEvent(null, null, participant.getAddress(),
                System.currentTimeMillis(), rootBlipId, participantsAdded, participantsRemoved);
        break;
      default:
        throw new UnsupportedOperationException(
            "This OperationService does not implement operation of type " + type.method());
    }

    // Process the participant event.
    context.processEvent(operation, event);
  }
View Full Code Here

    } catch (InvalidIdException e) {
      throw new InvalidRequestException("Invalid conversation id", operation, e);
    }
    ObservableConversation conversation = conversationView.getConversation(conversationId);

    OperationType type = OperationUtil.getOperationType(operation);
    switch (type) {
      case BLIP_CONTINUE_THREAD:
        continueThread(operation, context, participant, conversation);
        break;
      case BLIP_CREATE_CHILD:
        createChild(operation, context, participant, conversation);
        break;
      case WAVELET_APPEND_BLIP:
        appendBlip(operation, context, participant, conversation);
        break;
      case DOCUMENT_APPEND_INLINE_BLIP:
        appendInlineBlip(operation, context, participant, wavelet, conversation);
        break;
      case DOCUMENT_APPEND_MARKUP:
        appendMarkup(operation, context, participant, wavelet, conversation);
        break;
      case DOCUMENT_INSERT_INLINE_BLIP:
        insertInlineBlip(operation, context, participant, wavelet, conversation);
        break;
      case DOCUMENT_INSERT_INLINE_BLIP_AFTER_ELEMENT:
        insertInlineBlipAfterElement(operation, context, participant, wavelet, conversation);
        break;
      case BLIP_DELETE:
        delete(operation, context, participant, conversation);
        break;
      default:
        throw new UnsupportedOperationException(
            "This OperationService does not implement operation of type " + type.method());
    }
  }
View Full Code Here

    } catch (InvalidIdException e) {
      throw new InvalidRequestException("Invalid conversation id", operation, e);
    }
    ObservableConversation conversation = conversationView.getConversation(conversationId);

    OperationType type = OperationUtil.getOperationType(operation);
    switch (type) {
      case BLIP_CONTINUE_THREAD:
        continueThread(operation, context, participant, conversation);
        break;
      case BLIP_CREATE_CHILD:
        createChild(operation, context, participant, conversation);
        break;
      case WAVELET_APPEND_BLIP:
        appendBlip(operation, context, participant, conversation);
        break;
      case DOCUMENT_APPEND_INLINE_BLIP:
        appendInlineBlip(operation, context, participant, wavelet, conversation);
        break;
      case DOCUMENT_APPEND_MARKUP:
        appendMarkup(operation, context, participant, wavelet, conversation);
        break;
      case DOCUMENT_INSERT_INLINE_BLIP:
        insertInlineBlip(operation, context, participant, wavelet, conversation);
        break;
      case DOCUMENT_INSERT_INLINE_BLIP_AFTER_ELEMENT:
        insertInlineBlipAfterElement(operation, context, participant, wavelet, conversation);
        break;
      case BLIP_DELETE:
        delete(operation, context, participant, conversation);
        break;
      default:
        throw new UnsupportedOperationException(
            "This OperationService does not implement operation of type " + type.method());
    }
  }
View Full Code Here

    // Set up participant containers.
    List<String> participantsAdded = Lists.newArrayList();
    List<String> participantsRemoved = Lists.newArrayList();

    OperationType type = OperationUtil.getOperationType(operation);
    switch (type) {
      case WAVELET_ADD_PARTICIPANT_NEWSYNTAX:
        // Make sure targetParticipant is not already member.
        if (conversation.getParticipantIds().contains(targetParticipant)) {
          String message = targetParticipant.getAddress() + " is already a " + "member of wavelet";
          LOG.info(message);
          throw new InvalidRequestException(message, operation);
        }

        // Add participant to conversation and send event.
        conversation.addParticipant(targetParticipant);
        participantsAdded.add(targetParticipant.getAddress());
        event =
            new WaveletParticipantsChangedEvent(null, null, participant.getAddress(),
                System.currentTimeMillis(), rootBlipId, participantsAdded, participantsRemoved);
        break;
      case WAVELET_REMOVE_PARTICIPANT_NEWSYNTAX:
        // Make sure targetParticipant is already member.
        if (!conversation.getParticipantIds().contains(targetParticipant)) {
          // Not a member, throw invalid request.
          String message = targetParticipant.getAddress() + " is not a " + "member of wavelet";
          LOG.info(message);
          throw new InvalidRequestException(message, operation);
        }

        // Remove participant and send event.
        conversation.removeParticipant(targetParticipant);
        participantsRemoved.add(targetParticipant.getAddress());

        event =
            new WaveletParticipantsChangedEvent(null, null, participant.getAddress(),
                System.currentTimeMillis(), rootBlipId, participantsAdded, participantsRemoved);
        break;
      default:
        throw new UnsupportedOperationException(
            "This OperationService does not implement operation of type " + type.method());
    }

    // Process the participant event.
    context.processEvent(operation, event);
  }
View Full Code Here

TOP

Related Classes of com.google.wave.api.OperationType

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.