Package org.waveprotocol.wave.model.document

Examples of org.waveprotocol.wave.model.document.ObservableDocument


  public static void copyDocument(Wavelet sourceWavelet, Wavelet destWavelet, String docId) {
    Document document = sourceWavelet.getDocument(docId);
    DocInitialization docInit = document.toInitialization();
    // TODO(user): add a createDocument method to Wavelet so that we can push this ugliness
    // down the stack.
    ObservableDocument destDoc = destWavelet.getDocument(docId);
    destDoc.hackConsume(Nindo.fromDocOp(docInit, false /* don't remove skip */));
  }
View Full Code Here


  }

  @Override
  protected WaveletBasedConversation mirrorConversation(ObservableConversation toMirror) {
    WaveletBasedConversation backer = (WaveletBasedConversation) toMirror;
    ObservableDocument backerManifestDoc = WaveletBasedConversation.getManifestDocument(
        backer.getWavelet());
    ObservableManifest manifest = backerManifestDoc.with(
        new ObservableMutableDocument.Method<ObservableManifest>() {
          @Override
          public <N, E extends N, T extends N> ObservableManifest exec(
              ObservableMutableDocument<N, E, T> doc) {
            E top = DocHelper.expectAndGetFirstTopLevelElement(doc,
View Full Code Here

        }});
      tags.processInitialState();
    }

    // Add the participant roles.
    ObservableDocument rolesDocument = wavelet.getDocument(IdConstants.ROLES_DATA_DOC_ID);
    if (rolesDocument != null) {
      DocumentBasedRoles roles = DocumentBasedRoles.create(rolesDocument);
      for (ParticipantId participantId : wavelet.getParticipantIds()) {
        waveletData.setParticipantRole(participantId.getAddress(),
            roles.getRole(participantId).name());
View Full Code Here

*/

public class DocumentBasedRolesTest extends ObservableRolesTestBase {

  public void testOnlyPersistsChangedRole() {
    ObservableDocument doc = BasicFactories.observableDocumentProvider().parse("");
    DocumentBasedRoles permissions = DocumentBasedRoles.create(doc);
    permissions.assign(p("public@a.gwave.com"), Role.READ_ONLY);
    assertEquals("<assign address=\"public@a.gwave.com\" role=\"READ_ONLY\"/>", doc.toXmlString());
  }
View Full Code Here

    permissions.assign(p("public@a.gwave.com"), Role.READ_ONLY);
    assertEquals("<assign address=\"public@a.gwave.com\" role=\"READ_ONLY\"/>", doc.toXmlString());
  }

  public void testPersistNothingWhenSettingDefaultRole() {
    ObservableDocument doc = BasicFactories.observableDocumentProvider().parse("");
    DocumentBasedRoles permissions = DocumentBasedRoles.create(doc);
    permissions.assign(p("joe@example.com"), Role.FULL);
    assertEquals("", doc.toXmlString());
  }
View Full Code Here

    assertEquals("", doc.toXmlString());
  }

  @Override
  protected ObservableRoles getRoles() {
    ObservableDocument doc = BasicFactories.observableDocumentProvider().parse("");
    DocumentBasedRoles permissions = DocumentBasedRoles.create(doc);
    return permissions;
  }
View Full Code Here

  DocumentBasedIndexability indexability;
  ObservableDocument doc;

  @Override
  protected MutableIndexability getIndexability() {
    ObservableDocument doc =
        BasicFactories.createDocument(AccountSchemas.INDEXABILITY_SCHEMA_CONSTRAINTS);
    DefaultDocEventRouter router = DefaultDocEventRouter.create(doc);
    return DocumentBasedIndexability.create(router);
  }
View Full Code Here

  public void setUp() {
    initFromDoc("");
  }

  private void initFromDoc(final String content) {
    ObservableDocument doc =
        BasicFactories.createDocument(AccountSchemas.INDEXABILITY_SCHEMA_CONSTRAINTS, content);
    DefaultDocEventRouter router = DefaultDocEventRouter.create(doc);
    indexability = DocumentBasedIndexability.create(router);
  }
View Full Code Here

    folders = fungeCreateFolders(userData.getDocument(FOLDERS_DOCUMENT));
    muted = fungeCreateMuted(userData.getDocument(MUTED_DOCUMENT));
    waveletArchiveVersions = fungeCreateWaveletArchiveState(
        userData.getDocument(ARCHIVING_DOCUMENT));
    archiveCleared = fungeCreateCleared(userData.getDocument(CLEARED_DOCUMENT));
    ObservableDocument readState = userData.getDocument(READSTATE_DOCUMENT);
    read = fungeCreateReadState(readState, forwardingListener);
    collapsed = fungeCreateCollapsedState(
        userData.getDocument(PRESENTATION_DOCUMENT), forwardingListener);
    abuseStore = fungeCreateAbuseStore(userData.getDocument(ABUSE_DOCUMENT));
    seenVersion = fungeCreateSeenVersion(userData.getDocument(SEEN_DOCUMENT));
View Full Code Here

  /**
   * Creates and stores a conversation container. If the container has a
   * conversation then initializes that too.
   */
  private ConversationContainer createContainer(ObservableWavelet wavelet) {
    ObservableDocument manifestDoc = wavelet.getDocument(IdConstants.MANIFEST_DOCUMENT_ID);
    DocEventRouter router = DefaultDocEventRouter.create(manifestDoc);
    ObservableSingleton<DocumentBasedManifest, Void> manifestContainer =
        DocumentBasedSingleton.create(router, manifestDoc.getDocumentElement(),
           DocumentBasedManifest.MANIFEST_TOP_TAG, DocumentBasedManifest.FACTORY);
    ConversationContainer container = new ConversationContainer(wavelet, manifestContainer);
    manifestContainer.addListener(container);
    containers.put(wavelet, container);

View Full Code Here

TOP

Related Classes of org.waveprotocol.wave.model.document.ObservableDocument

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.