public String navigateToCurrentUserPersonalWorkspace() {
    if (!initialized) {
      initialize();
    }
    String returnView = DOCUMENT_VIEW;

    // force return to Documents tab
    webActions.setCurrentTabId(WebActions.MAIN_TABS_CATEGORY, DOCUMENT_MANAGEMENT_ACTION);

    // Rux INA-221: separated links for going to workspaces
    DocumentModel currentUserPersonalWorkspace = getCurrentUserPersonalWorkspace();
    DocumentModel currentDocument = navigationContext.getCurrentDocument();
    if (!isShowingPersonalWorkspace()
        && currentDocument != null
        && currentDocument.getPath().segment(0) != null) {
      lastAccessedDocument =
          mainTabsActions.getDocumentFor(
              DOCUMENT_MANAGEMENT_ACTION, navigationContext.getCurrentDocument());
    }
    navigationContext.setCurrentDocument(currentUserPersonalWorkspace);
    showingPersonalWorkspace = true;

    Events.instance().raiseEvent(EventNames.GO_PERSONAL_WORKSPACE);

    return returnView;
  }
  /**
   * Processes the version selection row.
   *
   * @param versionModelSelection the version model selection
   * @throws ClientException the client exception
   */
  protected final void processVersionSelectRow(PageSelection<VersionModel> versionModelSelection)
      throws ClientException {

    DocumentModel currentDocument = navigationContext.getCurrentDocument();
    if (currentDocument == null) {
      throw new ClientException(
          "Cannot process version select row since current document is null.");
    }

    DocumentModel version =
        documentManager.getDocumentWithVersion(
            currentDocument.getRef(), versionModelSelection.getData());
    if (version == null) {
      throw new ClientException(
          "Cannot process version select row since selected version document is null.");
    }

    if (Boolean.TRUE.equals(versionModelSelection.isSelected())) {
      documentsListsManager.addToWorkingList(
          DocumentsListsManager.CURRENT_VERSION_SELECTION, version);
    } else {
      documentsListsManager.removeFromWorkingList(
          DocumentsListsManager.CURRENT_VERSION_SELECTION, version);
    }
  }
  @Factory(value = "isInsidePersonalWorkspace", scope = ScopeType.EVENT)
  public boolean isShowingPersonalWorkspace() {
    if (!initialized) {
      initialize();
    }

    // NXP-9813 : navigating to a tab different than Documents should not change
    // the value for showingPersonalWorkspace
    if (mainTabsActions.isOnMainTab(DOCUMENT_MANAGEMENT_ACTION)) {
      DocumentModel currentDoc = navigationContext.getCurrentDocument();

      if (currentDoc == null || currentDoc.getPath().segmentCount() < 2) {
        return false;
      }

      String rootChild = currentDoc.getPath().segment(1);
      String wsName = currentDoc.getPath().segment(2);
      showingPersonalWorkspace =
          rootChild != null
              && rootChild.startsWith(UserWorkspaceConstants.USERS_PERSONAL_WORKSPACES_ROOT)
              && wsName != null
              && wsName.equals(currentUser.getName());
    }
    return showingPersonalWorkspace;
  }
 /** @deprecated this information is now held by content views */
 @Deprecated
 @Factory(value = "currentAvailableListingLayoutNames", scope = EVENT)
 public List<String> getAvailableLayoutsForCurrentDocument() {
   if (currentAvailableListingLayoutNames == null) {
     DocumentModel currentDocument = navigationContext.getCurrentDocument();
     currentAvailableListingLayoutNames = getAvailableLayoutsForDocument(currentDocument);
   }
   return currentAvailableListingLayoutNames;
 }
 /** @deprecated this information is now held by content views */
 @Deprecated
 @Factory(value = "currentListingLayoutName", scope = EVENT)
 public String getLayoutForCurrentDocument() {
   if (currentListingLayoutName == null) {
     DocumentModel currentDocument = navigationContext.getCurrentDocument();
     currentListingLayoutName = getLayoutForDocument(currentDocument);
   }
   return currentListingLayoutName;
 }
 /**
  * Handle complete table selection event after having ensured that the navigation context stills
  * points to currentDocumentRef to protect against browsers' back button errors
  *
  * @throws ClientException if currentDocRef is not a valid document
  */
 public void checkCurrentDocAndProcessSelectPage(
     String contentViewName, String listName, Boolean selection, String currentDocRef)
     throws ClientException {
   DocumentRef currentDocumentRef = new IdRef(currentDocRef);
   if (!currentDocumentRef.equals(navigationContext.getCurrentDocument().getRef())) {
     navigationContext.navigateToRef(currentDocumentRef);
   }
   processSelectPage(contentViewName, listName, selection);
 }
Ejemplo n.º 7
0
 @Observer({NAVIGATE_TO_DOCUMENT})
 public void updateContextualDocument() {
   if (!shouldHandleRequest()) {
     return;
   }
   String currentMainTab = getCurrentMainTabFromRequest();
   if (currentMainTab == null) {
     currentMainTab = webActions.getCurrentTabId(WebActions.MAIN_TABS_CATEGORY);
   }
   DocumentModel currentDocument = navigationContext.getCurrentDocument();
   documentsByMainTabs.put(currentMainTab, currentDocument);
 }
Ejemplo n.º 8
0
  public String getViewFor(Action mainTabAction) {
    if (!mainTabAction.getId().equals(WebActions.DOCUMENTS_MAIN_TAB_ID)) {
      return mainTabAction.getLink();
    }

    DocumentModel doc =
        getDocumentFor(mainTabAction.getId(), navigationContext.getCurrentDocument());
    if (doc != null) {
      TypeInfo typeInfo = doc.getAdapter(TypeInfo.class);
      return typeInfo.getDefaultView();
    }
    return DEFAULT_VIEW;
  }
 public DocumentModel getCurrentUserPersonalWorkspace() {
   if (!initialized) {
     initialize();
   }
   // protection in case we have not yet chosen a repository. if not
   // repository, then there is no documentManager(session)
   if (documentManager == null) {
     return null; // this is ok because it eventually will be
     // dealt with by setCurrentDocument, which will deal with
     // the lack of a documentManager
   }
   return getUserWorkspaceService()
       .getCurrentUserPersonalWorkspace(documentManager, navigationContext.getCurrentDocument());
 }
  /**
   * Handle version row selection event after having ensured that the navigation context stills
   * points to currentDocumentRef to protect against browsers' back button errors.
   *
   * @param versionModelSelection the version model selection
   * @param requestedCurrentDocRef the requested current doc ref
   * @throws ClientException if currentDocRef is not a valid document
   * @since 5.6
   */
  public void checkCurrentDocAndProcessVersionSelectRow(
      PageSelection<VersionModel> versionModelSelection, String requestedCurrentDocRef)
      throws ClientException {

    DocumentRef requestedCurrentDocumentRef = new IdRef(requestedCurrentDocRef);
    DocumentRef currentDocumentRef = null;
    DocumentModel currentDocument = navigationContext.getCurrentDocument();
    if (currentDocument != null) {
      currentDocumentRef = currentDocument.getRef();
    }
    if (!requestedCurrentDocumentRef.equals(currentDocumentRef)) {
      navigationContext.navigateToRef(requestedCurrentDocumentRef);
    }
    processVersionSelectRow(versionModelSelection);
  }
 /**
  * Handle row selection event after having ensured that the navigation context stills points to
  * currentDocumentRef to protect against browsers' back button errors
  *
  * @throws ClientException if currentDocRef is not a valid document
  */
 public void checkCurrentDocAndProcessSelectRow(
     String docRef,
     String providerName,
     String listName,
     Boolean selection,
     String requestedCurrentDocRef)
     throws ClientException {
   DocumentRef requestedCurrentDocumentRef = new IdRef(requestedCurrentDocRef);
   DocumentRef currentDocumentRef = null;
   DocumentModel currentDocument = navigationContext.getCurrentDocument();
   if (currentDocument != null) {
     currentDocumentRef = currentDocument.getRef();
   }
   if (!requestedCurrentDocumentRef.equals(currentDocumentRef)) {
     navigationContext.navigateToRef(requestedCurrentDocumentRef);
   }
   processSelectRow(docRef, providerName, listName, selection);
 }
Ejemplo n.º 12
0
  public String checkCurrentInbox() {
    DocumentModel mailFolder = navigationContext.getCurrentDocument();

    try {
      MailCoreHelper.checkMail(mailFolder, documentManager);
    } catch (MessagingException e) {
      log.debug(e, e);
      facesMessages.add(
          StatusMessage.Severity.ERROR,
          resourcesAccessor.getMessages().get("feedback.check.mail.error") + e.getMessage());

      return CURRENT_PAGE;
    }

    facesMessages.add(
        StatusMessage.Severity.INFO,
        resourcesAccessor.getMessages().get("feedback.check.mail.success"));
    Events.instance().raiseEvent("documentChildrenChanged");

    return CURRENT_PAGE;
  }
 /** @deprecated this information is now held by content views */
 @Deprecated
 public void setLayoutForCurrentDocument(String layoutName) {
   DocumentModel currentDocument = navigationContext.getCurrentDocument();
   setLayoutForDocument(currentDocument, layoutName);
   currentListingLayoutName = layoutName;
 }
 // MODIFORI
 public List<StatementInfo> getOutgoingStatementsInfo() throws ClientException {
   DocumentModel currentDoc = navigationContext.getCurrentDocument();
   return getOutgoingStatementsInfo(currentDoc);
 }
Ejemplo n.º 15
0
 public List<Type> getTypesWithSchemaFile() {
   DocumentModel document = navigationContext.getCurrentDocument();
   return getTypesWithSchemaFile(document);
 }
Ejemplo n.º 16
0
 public boolean isMailFolder() {
   DocumentModel currentDocument = navigationContext.getCurrentDocument();
   return MAIL_FOLDER_TYPE.equals(currentDocument.getType());
 }
 // MODIFORI
 public String addStatement() throws ClientException {
   DocumentModel currentDoc = navigationContext.getCurrentDocument();
   return addStatement(currentDoc);
 }
Ejemplo n.º 18
0
 public List<Type> getNotSelectedTypes() {
   DocumentModel currentDoc = navigationContext.getCurrentDocument();
   return getNotSelectedTypes(currentDoc);
 }
Ejemplo n.º 19
0
 public DocumentModel getDocumentFor(String mainTabId) {
   return getDocumentFor(mainTabId, navigationContext.getCurrentDocument());
 }