Example #1
0
  @Test
  /**
   * Name of a versioned node is available in the parent history. Translator takes care of this when
   * hippo:paths is present on the node, with the parent as one of its values.
   */
  public void testVersionedNode() throws Exception {
    Node parent = session.getRootNode().addNode("test", "nt:unstructured");
    parent.addMixin("mix:versionable");
    Node child = parent.addNode("child", "nt:unstructured");
    child.addMixin("mix:versionable");
    child.setProperty("hippo:paths", new String[] {child.getUUID(), parent.getUUID()});
    session.save();
    child.checkin();
    parent.checkin();

    VersionHistory vh = child.getVersionHistory();

    parent.checkout();
    child.remove();
    session.save();
    parent.checkin();

    VersionIterator versionIter = vh.getAllVersions();
    versionIter.nextVersion(); // ignore root
    Version version = versionIter.nextVersion();

    NodeTranslator nt = new NodeTranslator(new JcrNodeModel(version.getNode("jcr:frozenNode")));
    assertEquals("child", nt.getNodeName().getObject());
    assertTrue(version.getNode("jcr:frozenNode").isNodeType("mix:referenceable"));
  }
Example #2
0
  /** Makes sure nobody tampers with root node UUID. */
  public void testRootUUID() throws Exception {
    Node nd = m_session.getRootNode();

    assertTrue("uuid missing", nd.hasProperty("jcr:uuid"));

    assertEquals("uuid value", "93b885ad-fe0d-3089-8df6-34904fd59f71", nd.getUUID());
  }
  /** TODO: Not fully implemented SEE: DirectSearchModule.getKeywordMapLive() */
  public static synchronized void refreshUserDocKeywords(Session session)
      throws RepositoryException {
    log.info("refreshUserDocKeywords({})", session);
    String statement = "/jcr:root/" + Repository.ROOT + "/element(*,okm:document)";

    try {
      Workspace workspace = session.getWorkspace();
      QueryManager queryManager = workspace.getQueryManager();
      Query query = queryManager.createQuery(statement, Query.XPATH);
      javax.jcr.query.QueryResult qResult = query.execute();
      Map<String, Set<String>> userDocKeywords = new HashMap<String, Set<String>>();

      for (NodeIterator nit = qResult.getNodes(); nit.hasNext(); ) {
        Node docNode = nit.nextNode();
        Value[] keywords = docNode.getProperty(Property.KEYWORDS).getValues();
        Set<String> keywordSet = new HashSet<String>();

        for (int i = 0; i < keywords.length; i++) {
          keywordSet.add(keywords[i].getString());
        }

        userDocKeywords.put(docNode.getUUID(), keywordSet);
      }

      // userDocumentKeywordsMgr.put(session.getUserID(), userDocKeywords);
    } catch (javax.jcr.RepositoryException e) {
      log.error(e.getMessage(), e);
      throw new RepositoryException(e.getMessage(), e);
    }

    log.info("refreshUserDocKeywords: void");
  }
 /* (non-Javadoc)
  * @see org.exoplatform.services.wcm.link.LiveLinkManagerService#getBrokenLinks(javax.jcr.Node)
  */
 public List<String> getBrokenLinks(Node webContent) throws Exception {
   List<String> listBrokenUrls = (List<String>) brokenLinksCache.get(webContent.getUUID());
   if (listBrokenUrls == null || listBrokenUrls.size() == 0) {
     listBrokenUrls = new ArrayList<String>();
     if (webContent.hasProperty("exo:links")) {
       for (Value value : webContent.getProperty("exo:links").getValues()) {
         String link = value.getString();
         LinkBean linkBean = LinkBean.parse(link);
         if (linkBean.isBroken()) {
           listBrokenUrls.add(linkBean.getUrl());
         }
       }
       brokenLinksCache.put(webContent.getUUID(), listBrokenUrls);
     }
   }
   return listBrokenUrls;
 }
  @Override
  @Managed
  @ManagedDescription("Manual to start run miguration data of profiles from JCR to RDBMS.")
  public void doMigration() throws Exception {
    boolean begunTx = startTx();
    MigrationCounter counter = MigrationCounter.builder().threshold(LIMIT_THRESHOLD).build();
    counter.newTotalAndWatch();
    try {
      if (profileDAO.count() > 0) {
        MigrationContext.setProfileDone(true);
        return;
      }

      LOG.info("| \\ START::Profile migration ---------------------------------");
      NodeIterator it = getIdentityNodes(counter.getTotal(), LIMIT_THRESHOLD);
      if (it == null) return;
      Identity owner = null;
      Node node = null;

      try {
        while (it.hasNext()) {
          node = (Node) it.next();
          owner = identityStorage.findIdentityById(node.getUUID());
          counter.newBatchAndWatch();
          counter.getAndIncrementTotal();
          LOG.info(
              String.format(
                  "|  \\ START::user number: %s (%s user)",
                  counter.getTotal(), owner.getRemoteId()));
          ProfileUtils.createOrUpdateProfile(owner.getProfile(), false);
          LOG.info(
              String.format(
                  "|  / END::user number %s (%s user) consumed %s(ms)",
                  counter.getTotal(), owner.getRemoteId(), counter.endBatchWatch()));

          //
          if (counter.isPersistPoint()) {
            endTx(begunTx);
            RequestLifeCycle.end();
            RequestLifeCycle.begin(PortalContainer.getInstance());
            begunTx = startTx();
            it = getIdentityNodes(counter.getTotal(), LIMIT_THRESHOLD);
          }
        }
      } catch (Exception e) {
        LOG.error("Failed to migration for Profile.", e);
      }
    } finally {
      endTx(begunTx);
      RequestLifeCycle.end();
      RequestLifeCycle.begin(PortalContainer.getInstance());
      LOG.info(
          String.format(
              "| / END::Profile migration for (%s) user(s) consumed %s(ms)",
              counter.getTotal(), counter.endTotalWatch()));
    }
  }
Example #6
0
  public static Map<String, String> populateActivityData(
      Node node,
      String activityOwnerId,
      String activityMsgBundleKey,
      boolean isSystemComment,
      String systemComment)
      throws Exception {
    /** The date formatter. */
    DateFormat dateFormatter = null;
    dateFormatter = new SimpleDateFormat(ISO8601.SIMPLE_DATETIME_FORMAT);

    // get activity data
    String repository =
        ((ManageableRepository) node.getSession().getRepository()).getConfiguration().getName();
    String workspace = node.getSession().getWorkspace().getName();

    String illustrationImg = Utils.getIllustrativeImage(node);
    String strDateCreated = "";
    if (node.hasProperty(NodetypeConstant.EXO_DATE_CREATED)) {
      Calendar dateCreated = node.getProperty(NodetypeConstant.EXO_DATE_CREATED).getDate();
      strDateCreated = dateFormatter.format(dateCreated.getTime());
    }
    String strLastModified = "";
    if (node.hasNode(NodetypeConstant.JCR_CONTENT)) {
      Node contentNode = node.getNode(NodetypeConstant.JCR_CONTENT);
      if (contentNode.hasProperty(NodetypeConstant.JCR_LAST_MODIFIED)) {
        Calendar lastModified =
            contentNode.getProperty(NodetypeConstant.JCR_LAST_MODIFIED).getDate();
        strLastModified = dateFormatter.format(lastModified.getTime());
      }
    }

    activityOwnerId = activityOwnerId != null ? activityOwnerId : "";

    // populate data to map object
    Map<String, String> activityParams = new HashMap<String, String>();
    activityParams.put(ContentUIActivity.CONTENT_NAME, node.getName());
    activityParams.put(ContentUIActivity.AUTHOR, activityOwnerId);
    activityParams.put(ContentUIActivity.DATE_CREATED, strDateCreated);
    activityParams.put(ContentUIActivity.LAST_MODIFIED, strLastModified);
    activityParams.put(ContentUIActivity.CONTENT_LINK, getContentLink(node));
    activityParams.put(
        ContentUIActivity.ID,
        node.isNodeType(NodetypeConstant.MIX_REFERENCEABLE) ? node.getUUID() : "");
    activityParams.put(ContentUIActivity.REPOSITORY, repository);
    activityParams.put(ContentUIActivity.WORKSPACE, workspace);
    activityParams.put(ContentUIActivity.MESSAGE, activityMsgBundleKey);
    activityParams.put(ContentUIActivity.MIME_TYPE, getMimeType(node));
    activityParams.put(ContentUIActivity.IMAGE_PATH, illustrationImg);
    activityParams.put(ContentUIActivity.IMAGE_PATH, illustrationImg);
    if (isSystemComment) {
      activityParams.put(ContentUIActivity.IS_SYSTEM_COMMENT, String.valueOf(isSystemComment));
      activityParams.put(ContentUIActivity.SYSTEM_COMMENT, systemComment);
    }
    return activityParams;
  }
  /**
   * A repository implementation may make its workspace root nodes mix:referenceable. If so, then
   * the root node of all workspaces must be referenceable, and all must have the same UUID.
   */
  public void testReferenceableRootNode() throws RepositoryException, NotExecutableException {
    // compare UUID of default workspace and a second workspace
    Node rootNode = session.getRootNode();
    if (rootNode.isNodeType(mixReferenceable)) {

      // check if root node in second workspace is referenceable too
      Node rootNodeW2 = sessionW2.getRootNode();
      if (!rootNodeW2.isNodeType(mixReferenceable)) {
        fail("Root node in second workspace is not referenceable.");
      }

      // check if all root nodes have the same UUID
      assertEquals(
          "Referenceable root nodes of different workspaces must have same UUID.",
          rootNode.getUUID(),
          rootNodeW2.getUUID());
    } else {
      throw new NotExecutableException("Root node is not referenceable");
    }
  }
  /**
   * Creates the node strucure is it not already created
   *
   * @throws ServletException if error
   */
  private void createNodeStructure() throws ServletException {

    try {

      Node rootNode = session.getRootNode();
      Node admin = null;

      // creates the root node of the system if not already created
      if (!rootNode.hasNode("blogRoot")) {
        Node blogRoot = rootNode.addNode("blogRoot", "nt:folder");

        // Adding the admin user
        admin = blogRoot.addNode("admin", "blog:user");
        admin.setProperty("blog:nickname", "admin");
        admin.setProperty("blog:email", "*****@*****.**");
        admin.setProperty("blog:password", "admin");
        session.save();

        // Adding the guest user
        Node guest = blogRoot.addNode("guest", "blog:user");
        guest.setProperty("blog:nickname", "guest");

        // These properties will never be used by the system
        guest.setProperty("blog:email", "*****@*****.**");
        guest.setProperty("blog:password", "guest");
      }

      // Created the library node if not already created
      if (!rootNode.hasNode("library")) {
        rootNode.addNode("library", "nt:folder");
      }

      if (!rootNode.hasNode("wiki")) {
        Node wiki = rootNode.addNode("wiki", "nt:folder");
        Node frontPage = wiki.addNode("frontPage", "wiki:wikiPage");

        frontPage.setProperty("wiki:title", "Front Page");
        frontPage.setProperty("wiki:content", "Type the content here");
        frontPage.setProperty("wiki:savedBy", admin.getUUID());
      }

      session.save();

      log("JACKRABBIT-JCR-DEMO: Node Structure created ...");

    } catch (RepositoryException e) {
      throw new ServletException("Failed to create node structure ", e);
    }
  }
 /**
  * Update link status.
  *
  * @param session the session
  * @param queryCommand the query command
  * @throws Exception the exception
  */
 private void updateLinkStatus(Session session, String queryCommand) throws Exception {
   List<String> listBrokenLinks = new ArrayList<String>();
   ValueFactory valueFactory = session.getValueFactory();
   QueryManager queryManager = session.getWorkspace().getQueryManager();
   Query query = queryManager.createQuery(queryCommand, Query.SQL);
   QueryResult results = query.execute();
   NodeIterator iter = results.getNodes();
   for (; iter.hasNext(); ) {
     Node webContent = iter.nextNode();
     if (!webContent.isCheckedOut()
         || webContent.isLocked()
         || (webContent.isCheckedOut() && !webContent.getParent().isCheckedOut())) {
       continue;
     }
     Property links = webContent.getProperty("exo:links");
     Value[] oldValues = links.getValues();
     Value[] newValues = new Value[oldValues.length];
     for (int iValues = 0; iValues < oldValues.length; iValues++) {
       String oldLink = oldValues[iValues].getString();
       if (!oldLink.equals("")) {
         LinkBean linkBean = LinkBean.parse(oldLink);
         String oldUrl = linkBean.getUrl();
         String oldStatus = getLinkStatus(oldUrl);
         String updatedLink = new LinkBean(oldUrl, oldStatus).toString();
         if (LOG.isInfoEnabled()) {
           LOG.info(updatedLink);
         }
         newValues[iValues] = valueFactory.createValue(updatedLink);
         if (oldStatus.equals(LinkBean.STATUS_BROKEN)) {
           listBrokenLinks.add(oldUrl);
         }
       }
     }
     webContent.setProperty("exo:links", newValues);
     brokenLinksCache.put(webContent.getUUID(), listBrokenLinks);
   }
   session.save();
 }
 @Test
 public void ferrari_can_be_referenced() throws RepositoryException {
   Node ferrari = session.getNode("/cars/ferrari");
   assertThat(ferrari.getUUID(), notNullValue());
 }
Example #11
0
  /**
   * @param orgNode Processed node
   * @param propertyName which property used for editing
   * @param inputType input type for editing: TEXT, TEXTAREA, WYSIWYG
   * @param cssClass class name for CSS, should implement: cssClass, [cssClass]Title Edit[cssClass]
   *     as relative css Should create the function:
   *     InlineEditor.presentationRequestChange[cssClass] to request the rest-service
   * @param isGenericProperty set as true to use generic javascript function, other wise, must
   *     create the correctspond function InlineEditor.presentationRequestChange[cssClass]
   * @param arguments Extra parameter for Input component (toolbar, width, height,.. for
   *     CKEditor/TextArea)
   * @return String that can be put on groovy template
   * @throws Exception
   * @author vinh_nguyen
   */
  public static String getInlineEditingField(
      Node orgNode,
      String propertyName,
      String defaultValue,
      String inputType,
      String idGenerator,
      String cssClass,
      boolean isGenericProperty,
      String... arguments)
      throws Exception {
    HashMap<String, String> parsedArguments = parseArguments(arguments);
    String height = parsedArguments.get(HEIGHT);
    String bDirection = parsedArguments.get(BUTTON_DIR);
    String publishLink = parsedArguments.get(FAST_PUBLISH_LINK);

    Locale locale = WebuiRequestContext.getCurrentInstance().getLocale();
    String language = locale.getLanguage();
    ResourceBundleService resourceBundleService =
        WCMCoreUtils.getService(ResourceBundleService.class);
    ResourceBundle resourceBundle;
    resourceBundle = resourceBundleService.getResourceBundle(LOCALE_WEBUI_DMS, locale);

    PortletRequestContext portletRequestContext = WebuiRequestContext.getCurrentInstance();
    String draft = INLINE_DRAFT;
    String published = INLINE_PUBLISHED;
    try {
      draft =
          portletRequestContext.getApplicationResourceBundle().getString("PublicationStates.draft");
      published =
          portletRequestContext
              .getApplicationResourceBundle()
              .getString("PublicationStates.published");
    } catch (MissingResourceException ex) {
      if (LOG.isWarnEnabled()) {
        LOG.warn(ex.getMessage());
      }
    }

    String portletRealID =
        org.exoplatform.wcm.webui.Utils.getRealPortletId(
            (PortletRequestContext) WebuiRequestContext.getCurrentInstance());
    StringBuffer sb = new StringBuffer();
    StringBuffer actionsb = new StringBuffer();
    String repo =
        ((ManageableRepository) orgNode.getSession().getRepository()).getConfiguration().getName();
    String workspace = orgNode.getSession().getWorkspace().getName();
    String uuid = orgNode.getUUID();
    String strSuggestion = "";
    String acceptButton = "";
    String cancelButton = "";
    portletRealID = portletRealID.replace('-', '_');
    String showBlockId = "Current" + idGenerator + "_" + portletRealID;
    String editBlockEditorID = "Edit" + idGenerator + "_" + portletRealID;
    String editFormID = "Edit" + idGenerator + "Form_" + portletRealID;
    String newValueInputId = "new" + idGenerator + "_" + portletRealID;
    String currentValueID = "old" + idGenerator + "_" + portletRealID;
    String siteName =
        org.exoplatform.portal.webui.util.Util.getPortalRequestContext().getPortalOwner();
    String currentValue = StringUtils.replace(defaultValue, "{portalName}", siteName);
    try {
      strSuggestion = resourceBundle.getString("UIPresentation.label.EditingSuggestion");
      acceptButton = resourceBundle.getString("UIPresentation.title.AcceptButton");
      cancelButton = resourceBundle.getString("UIPresentation.title.CancelButton");
    } catch (MissingResourceException e) {
      if (LOG.isWarnEnabled()) {
        LOG.warn(e.getMessage());
      }
    }
    actionsb.append(" return InlineEditor.presentationRequestChange");

    if (isGenericProperty) {
      actionsb
          .append("Property")
          .append("('")
          .append("/property?', '")
          .append(propertyName)
          .append("', '");
    } else {
      actionsb.append(cssClass).append("('");
    }
    actionsb
        .append(currentValueID)
        .append("', '")
        .append(newValueInputId)
        .append("', '")
        .append(repo)
        .append("', '")
        .append(workspace)
        .append("', '")
        .append(uuid)
        .append("', '")
        .append(editBlockEditorID)
        .append("', '")
        .append(showBlockId)
        .append("', '")
        .append(siteName)
        .append("', '")
        .append(language);

    if (inputType.equals(INPUT_WYSIWYG)) {
      actionsb.append("', 1);");
    } else {
      actionsb.append("');");
    }
    String strAction = actionsb.toString();

    if (orgNode.hasProperty(propertyName)) {
      try {
        if (propertyName.equals(EXO_TITLE))
          return ContentReader.getXSSCompatibilityContent(
              orgNode.getProperty(propertyName).getString());
        if (org.exoplatform.wcm.webui.Utils.getCurrentMode().equals(WCMComposer.MODE_LIVE))
          return StringUtils.replace(
              orgNode.getProperty(propertyName).getString(), "{portalName}", siteName);
        else
          return "<div class=\"WCMInlineEditable\" contenteditable=\"true\" propertyName=\""
              + propertyName
              + "\" repo=\""
              + repo
              + "\" workspace=\""
              + workspace
              + "\""
              + " uuid=\""
              + uuid
              + "\" siteName=\""
              + siteName
              + "\" publishedMsg=\""
              + published
              + "\" draftMsg=\""
              + draft
              + "\" fastpublishlink=\""
              + publishLink
              + "\" language=\""
              + language
              + "\" >"
              + orgNode.getProperty(propertyName).getString()
              + "</div>";
      } catch (Exception e) {
        if (org.exoplatform.wcm.webui.Utils.getCurrentMode().equals(WCMComposer.MODE_LIVE))
          return currentValue;
        else
          return "<div class=\"WCMInlineEditable\" contenteditable=\"true\" propertyName=\""
              + propertyName
              + "\" repo=\""
              + repo
              + "\" workspace=\""
              + workspace
              + "\" "
              + "uuid=\""
              + uuid
              + "\" siteName=\""
              + siteName
              + "\" publishedMsg=\""
              + published
              + "\" draftMsg=\""
              + draft
              + "\" fastpublishlink=\""
              + publishLink
              + "\" language=\""
              + language
              + "\" >"
              + defaultValue
              + "</div>";
      }
    }

    sb.append("<div class=\"InlineEditing\" >\n");
    sb.append("\n<div rel=\"tooltip\" data-placement=\"bottom\" id=\"")
        .append(showBlockId)
        .append("\" Class=\"")
        .append(cssClass)
        .append("\"");
    sb.append("title=\"").append(strSuggestion).append("\"");
    sb.append(" onClick=\"InlineEditor.presentationSwitchBlock('")
        .append(showBlockId)
        .append("', '")
        .append(editBlockEditorID)
        .append("');\"");

    sb.append("onmouseout=\"this.className='")
        .append(cssClass)
        .append("';\" onblur=\"this.className='")
        .append(cssClass)
        .append("';\" onfocus=\"this.className='")
        .append(cssClass)
        .append("Hover")
        .append("';\" onmouseover=\"this.className='")
        .append(cssClass)
        .append("Hover';\">")
        .append(currentValue)
        .append("</div>\n");
    sb.append("\t<div id=\"")
        .append(editBlockEditorID)
        .append("\" class=\"Edit")
        .append(cssClass)
        .append("\">\n");
    sb.append("\t\t<form name=\"")
        .append(editFormID)
        .append("\" id=\"")
        .append(editFormID)
        .append("\" onSubmit=\"")
        .append(strAction)
        .append("\">\n");
    sb.append("<DIV style=\"display:none; visible:hidden\" id=\"")
        .append(currentValueID)
        .append("\" name=\"")
        .append(currentValueID)
        .append("\">")
        .append(currentValue)
        .append("</DIV>");

    if (bDirection != null && bDirection.equals(LEFT2RIGHT)) {
      sb.append("\t\t<a href=\"#\" rel=\"tooltip\" data-placement=\"bottom\"")
          .append(" class =\"AcceptButton\" style=\"float:left\" onclick=\"")
          .append(strAction)
          .append("\" title=\"" + acceptButton + "\">&nbsp;</a>\n");
      sb.append(
              "\t\t<a href=\"#\" rel=\"tooltip\" data-placement=\"bottom\" class =\"CancelButton\" style=\"float:left\" ")
          .append("onClick=\"InlineEditor.presentationSwitchBlock('");
      sb.append(editBlockEditorID)
          .append("', '")
          .append(showBlockId)
          .append("');\" title=\"" + cancelButton + "\">&nbsp;</a>\n");
    } else {
      sb.append(
              "\t\t<a href=\"#\" rel=\"tooltip\" data-placement=\"bottom\" class =\"CancelButton\" ")
          .append("onClick=\"InlineEditor.presentationSwitchBlock('");
      sb.append(editBlockEditorID)
          .append("', '")
          .append(showBlockId)
          .append("');\" title=\"" + cancelButton + "\">&nbsp;</a>\n");
      sb.append(
              "\t\t<a href=\"#\" rel=\"tooltip\" data-placement=\"bottom\" class =\"AcceptButton\" onclick=\"")
          .append(strAction)
          .append("\" title=\"" + acceptButton + "\">&nbsp;</a>\n");
    }
    sb.append("\t\t<div class=\"Edit").append(cssClass).append("Input\">\n ");

    sb.append("\n\t\t</div>\n\t</form>\n</div>\n\n</div>");
    return sb.toString();
  }
  @Override
  public void onPostActivity(
      PostContext postContext,
      UIComponent source,
      WebuiRequestContext requestContext,
      String postedMessage)
      throws Exception {
    if (!isDocumentReady) {
      requestContext
          .getUIApplication()
          .addMessage(
              new ApplicationMessage(
                  "UIComposer.msg.error.Must_select_file", null, ApplicationMessage.INFO));
    } else {
      Map<String, String> activityParams = new LinkedHashMap<String, String>();
      Node node = getDocNode(REPOSITORY, WORKSPACE, documentPath);

      activityParams.put(UIDocActivity.DOCNAME, documentName);
      activityParams.put(UIDocActivity.DOCLINK, documentRefLink);
      activityParams.put(UIDocActivity.DOCPATH, documentPath);
      activityParams.put(UIDocActivity.REPOSITORY, REPOSITORY);
      activityParams.put(UIDocActivity.WORKSPACE, WORKSPACE);
      activityParams.put(UIDocActivity.MESSAGE, postedMessage);
      activityParams.put(
          BaseActivityProcessorPlugin.TEMPLATE_PARAM_TO_PROCESS, UIDocActivity.MESSAGE);

      if (node.getPrimaryNodeType().getName().equals(NodetypeConstant.NT_FILE)) {
        String activityOwnerId = UIDocActivity.getActivityOwnerId(node);
        DateFormat dateFormatter = null;
        dateFormatter = new SimpleDateFormat(ISO8601.SIMPLE_DATETIME_FORMAT);

        String illustrationImg = UIDocActivity.getIllustrativeImage(node);
        String strDateCreated = "";
        if (node.hasProperty(NodetypeConstant.EXO_DATE_CREATED)) {
          Calendar dateCreated = node.getProperty(NodetypeConstant.EXO_DATE_CREATED).getDate();
          strDateCreated = dateFormatter.format(dateCreated.getTime());
        }
        String strLastModified = "";
        if (node.hasNode(NodetypeConstant.JCR_CONTENT)) {
          Node contentNode = node.getNode(NodetypeConstant.JCR_CONTENT);
          if (contentNode.hasProperty(NodetypeConstant.JCR_LAST_MODIFIED)) {
            Calendar lastModified =
                contentNode.getProperty(NodetypeConstant.JCR_LAST_MODIFIED).getDate();
            strLastModified = dateFormatter.format(lastModified.getTime());
          }
        }

        activityParams.put(
            UIDocActivity.ID,
            node.isNodeType(NodetypeConstant.MIX_REFERENCEABLE) ? node.getUUID() : "");
        activityParams.put(UIDocActivity.CONTENT_NAME, node.getName());
        activityParams.put(UIDocActivity.AUTHOR, activityOwnerId);
        activityParams.put(UIDocActivity.DATE_CREATED, strDateCreated);
        activityParams.put(UIDocActivity.LAST_MODIFIED, strLastModified);
        activityParams.put(UIDocActivity.CONTENT_LINK, UIDocActivity.getContentLink(node));
        activityParams.put(
            UIDocActivity.ID,
            node.isNodeType(NodetypeConstant.MIX_REFERENCEABLE) ? node.getUUID() : "");
        activityParams.put(UIDocActivity.MIME_TYPE, UIDocActivity.getMimeType(node));
        activityParams.put(UIDocActivity.IMAGE_PATH, illustrationImg);
      }

      if (postContext == UIComposer.PostContext.SPACE) {
        postActivityToSpace(source, requestContext, activityParams);
      } else if (postContext == UIComposer.PostContext.USER) {
        postActivityToUser(source, requestContext, activityParams);
      }
    }
    resetValues();
  }