/**
  * delete the event activity
  *
  * @param event
  * @param calendarId
  * @param eventType
  */
 private void deleteActivity(CalendarEvent event, String calendarId, String eventType) {
   try {
     Class.forName("org.exoplatform.social.core.space.spi.SpaceService");
   } catch (ClassNotFoundException e) {
     if (LOG.isDebugEnabled()) {
       LOG.debug("eXo Social components not found!", e);
     }
     return;
   }
   if (calendarId == null
       || calendarId.indexOf(CalendarDataInitialize.SPACE_CALENDAR_ID_SUFFIX) < 0) {
     return;
   }
   try {
     ActivityManager activityM =
         (ActivityManager)
             PortalContainer.getInstance().getComponentInstanceOfType(ActivityManager.class);
     SpaceService spaceService =
         (SpaceService)
             PortalContainer.getInstance().getComponentInstanceOfType(SpaceService.class);
     String spaceGroupId = Utils.getSpaceGroupIdFromCalendarId(calendarId);
     Space space = spaceService.getSpaceByGroupId(spaceGroupId);
     if (space != null && event.getActivityId() != null) {
       activityM.deleteActivity(event.getActivityId());
     }
   } catch (ExoSocialException e) {
     if (LOG.isDebugEnabled())
       LOG.error("Can not delete Activity for space when event deleted ", e);
   }
 }
 @Override
 public void preSave(User user, boolean isNew) throws Exception {
   if (passwordEncrypter != null && user.getPassword() != null) {
     User persistedUser = organizationService.getUserHandler().findUserByName(user.getUserName());
     if (persistedUser == null || persistedUser.getPassword() == null) {
       if (LOG.isDebugEnabled()) {
         LOG.debug("Encrypting password for a new user " + user.getUserName());
       }
       String encodedPassword =
           new String(passwordEncrypter.encrypt(user.getPassword().getBytes()));
       user.setPassword(encodedPassword);
     } else if (!user.getPassword().equals(persistedUser.getPassword())) {
       if (LOG.isDebugEnabled()) {
         LOG.debug("Encrypting changed password for user " + user.getUserName());
       }
       String encodedPassword =
           new String(passwordEncrypter.encrypt(user.getPassword().getBytes()));
       user.setPassword(encodedPassword);
     } else {
       if (LOG.isDebugEnabled()) {
         LOG.debug("Nothing to encrypt for user " + user.getUserName() + ": password no changed.");
       }
     }
   }
 }
Example #3
0
  /** @see java.net.URLConnection#connect() */
  @Override
  public void connect() throws IOException {
    this.connected = true;
    String file = url.getFile();
    int index = file.indexOf("!/");
    if (index == -1) {
      // It is a direct file access
      this.directAccess = new File(file);
      if (!directAccess.exists())
        throw new FileNotFoundException("Cannot find the file at " + file);
      if (directAccess.isDirectory()) throw new IOException("A file was expected at " + file);
      return;
    }
    File f = new File(file.substring(0, index));
    if (!f.exists())
      throw new FileNotFoundException("Cannot find the file at " + f.getAbsolutePath());
    if (f.isDirectory()) throw new IOException("A zip file was expected at " + f.getAbsolutePath());
    this.zipFile = new ZipFile(f);
    try {
      int fromIndex = index + 2;
      index = file.indexOf("!/", fromIndex);
      String nameEntry;
      if (index == -1) nameEntry = file.substring(fromIndex);
      else nameEntry = file.substring(fromIndex, index);

      ZipEntry entry = zipFile.getEntry(nameEntry);
      if (entry == null)
        throw new FileNotFoundException(
            "Cannot find the file at " + file.substring(0, index == -1 ? file.length() : index));
      if (zipFile.getEntry(nameEntry + "/") != null)
        throw new IOException(
            "A "
                + (index == -1 ? "" : "zip")
                + " file was expected at "
                + file.substring(0, index == -1 ? file.length() : index));
      nameEntries = new ArrayList<String>();
      nameEntries.add(nameEntry);
      if (index == -1) {
        // there is no more entries
        return;
      }
      nameEntry = file.substring(index + 2);
      // We add it without checking if it exists to avoid reading twice the ZipInputStream
      nameEntries.add(nameEntry);
    } catch (IOException e) {
      try {
        zipFile.close();
      } catch (IOException e2) {
        LOG.debug("Could not close the zip file");
      }
      throw e;
    } catch (RuntimeException e) {
      try {
        zipFile.close();
      } catch (IOException e2) {
        LOG.debug("Could not close the zip file");
      }
      throw e;
    }
  }
Example #4
0
 protected void executeQuery(final Statement statement, final String sql) throws SQLException {
   try {
     long start = 0;
     if (LOG.isDebugEnabled()) {
       start = System.currentTimeMillis();
       LOG.debug("Execute script: \n[" + sql + "]");
     }
     SecurityHelper.doPrivilegedSQLExceptionAction(
         new PrivilegedExceptionAction<Object>() {
           public Object run() throws Exception {
             statement.executeUpdate(sql);
             return null;
           }
         });
     if (LOG.isDebugEnabled()) {
       LOG.debug(
           "Script "
               + sql
               + " executed in "
               + ((System.currentTimeMillis() - start) / 1000d)
               + " sec");
     }
   } catch (SQLException e) {
     LOG.error("Query execution \"" + sql + "\" failed: " + JDBCUtils.getFullMessage(e), e);
     throw e;
   }
 }
Example #5
0
  private void handleCookie(String set_cookie, boolean cookie2, RoRequest req, Response resp)
      throws ProtocolException {
    Cookie[] cookies;
    if (cookie2) cookies = Cookie2.parse(set_cookie, req);
    else cookies = Cookie.parse(set_cookie, req);

    if (LOG.isDebugEnabled()) {
      LOG.debug("Received and parsed " + cookies.length + " cookies:");
      for (int idx = 0; idx < cookies.length; idx++)
        LOG.debug("Cookie " + idx + ": " + cookies[idx]);
    }

    Hashtable cookie_list = Util.getList(cookie_cntxt_list, req.getConnection().getContext());
    synchronized (cookie_list) {
      for (int idx = 0; idx < cookies.length; idx++) {
        Cookie cookie = (Cookie) cookie_list.get(cookies[idx]);
        if (cookie != null && cookies[idx].hasExpired()) {
          if (LOG.isDebugEnabled())
            LOG.debug("Cookie has expired and is " + "being removed: " + cookie);

          cookie_list.remove(cookie); // expired, so remove
        } else if (!cookies[idx].hasExpired()) // new or replaced
        {
          if (cookie_handler == null || cookie_handler.acceptCookie(cookies[idx], req, resp))
            cookie_list.put(cookies[idx], cookies[idx]);
        }
      }
    }
  }
  @Override
  public void removeMessageAfterSent() throws Exception {
    final boolean stats =
        NotificationContextFactory.getInstance().getStatistics().isStatisticsEnabled();
    boolean created = NotificationSessionManager.createSystemProvider();
    SessionProvider sProvider = NotificationSessionManager.getSessionProvider();

    try {
      Node notificationHome = getNotificationHomeNode(sProvider, workspace);
      Session session = notificationHome.getSession();
      // remove all
      Set<String> listPaths = removeByCallBack.get(REMOVE_ALL);
      removeByCallBack.remove(REMOVE_ALL);
      if (listPaths != null && listPaths.size() > 0) {
        for (String nodePath : listPaths) {
          try {
            session.getItem(nodePath).remove();
            // record entity delete here
            if (stats) {
              NotificationContextFactory.getInstance()
                  .getStatisticsCollector()
                  .deleteEntity(NTF_MESSAGE);
            }

            LOG.debug("Remove NotificationMessage " + nodePath);
          } catch (Exception e) {
            LOG.warn(
                "Failed to remove node of NotificationMessage " + nodePath + "\n" + e.getMessage());
            LOG.debug("Remove NotificationMessage " + nodePath, e);
          }
        }
        session.save();
      }

      listPaths = removeByCallBack.get(REMOVE_DAILY);
      if (listPaths != null && listPaths.size() > 0) {
        for (String nodePath : listPaths) {
          try {
            Item item = session.getItem(nodePath);
            if (item.isNode()) {
              Node node = (Node) item;
              node.setProperty(NTF_SEND_TO_DAILY, new String[] {""});
            }
            LOG.debug("Remove SendToDaily property " + nodePath);
          } catch (Exception e) {
            LOG.warn(
                "Failed to remove SendToDaily property of " + nodePath + "\n" + e.getMessage());
            LOG.debug("Remove SendToDaily property " + nodePath, e);
          }
        }
        session.save();
      }
    } catch (Exception e) {
      LOG.warn("Failed to remove message after sent email notification", e);
    } finally {
      NotificationSessionManager.closeSessionProvider(created);
    }
  }
Example #7
0
 /** @see java.net.URLConnection#getInputStream() */
 @Override
 public InputStream getInputStream() throws IOException {
   if (!connected) connect();
   if (directAccess != null) return new FileInputStream(directAccess);
   if (zipFile == null) throw new IOException("no zip file defined");
   try {
     if (nameEntries == null || nameEntries.isEmpty())
       throw new IOException("no entry name specified");
     ZipEntry entry = zipFile.getEntry(nameEntries.get(0));
     if (entry == null)
       throw new FileNotFoundException("The entry " + nameEntries.get(0) + " could not be found");
     if (nameEntries.size() == 1) {
       return new ArchiveInputStream(zipFile.getInputStream(entry));
     }
     String nameEntry = nameEntries.get(1);
     ZipInputStream zis = new ZipInputStream(zipFile.getInputStream(entry));
     boolean closeZis = true;
     try {
       ZipEntry subZP;
       ZipEntry found = null;
       while ((subZP = zis.getNextEntry()) != null) {
         if (subZP.getName().equals(nameEntry) || subZP.getName().equals(nameEntry + "/")) {
           found = subZP;
           break;
         }
       }
       if (found == null)
         throw new FileNotFoundException("Cannot find the file at " + url.getFile());
       if (found.isDirectory()) throw new IOException("A file was expected at " + url.getFile());
       closeZis = false;
       return new ArchiveInputStream(zis);
     } finally {
       if (closeZis) {
         try {
           zis.close();
         } catch (IOException e) {
           LOG.debug("Could not close the zip input stream");
         }
       }
     }
   } catch (IOException e) {
     try {
       zipFile.close();
     } catch (IOException e2) {
       LOG.debug("Could not close the zip file");
     }
     throw e;
   } catch (RuntimeException e) {
     try {
       zipFile.close();
     } catch (IOException e2) {
       LOG.debug("Could not close the zip file");
     }
     throw e;
   }
 }
Example #8
0
  public GenericWebAppContext(
      ServletContext servletContext,
      HttpServletRequest request,
      HttpServletResponse response,
      SessionProvider sessionProvider,
      ManageableRepository repository) {

    initialize(servletContext, request, response);

    this.sessionProvider = sessionProvider;
    this.repository = repository;

    // log.info("WEb context ---------------");
    // initialize context with all props
    Enumeration en = servletContext.getInitParameterNames();
    while (en.hasMoreElements()) {
      String name = (String) en.nextElement();
      put(name, servletContext.getInitParameter(name));
      LOG.debug("ServletContext init param: " + name + "=" + servletContext.getInitParameter(name));
    }

    en = servletContext.getAttributeNames();
    while (en.hasMoreElements()) {
      String name = (String) en.nextElement();
      put(name, servletContext.getAttribute(name));
      LOG.debug("ServletContext: " + name + "=" + servletContext.getAttribute(name));
    }

    HttpSession session = request.getSession(false);
    if (session != null) {
      en = session.getAttributeNames();
      while (en.hasMoreElements()) {
        String name = (String) en.nextElement();
        put(name, session.getAttribute(name));
        LOG.debug("Session: " + name + "=" + session.getAttribute(name));
      }
    }

    en = request.getAttributeNames();
    while (en.hasMoreElements()) {
      String name = (String) en.nextElement();
      put(name, request.getAttribute(name));
    }

    en = request.getParameterNames();
    while (en.hasMoreElements()) {
      String name = (String) en.nextElement();
      put(name, request.getParameter(name));
      LOG.debug("Request: " + name + "=" + request.getParameter(name));
    }
  }
Example #9
0
 @Managed
 @ManagedDescription("Clean all templates in Composer")
 public void cleanTemplates() throws Exception {
   this.templatesFilter = null;
   getTemplatesSQLFilter();
   if (LOG.isDebugEnabled()) LOG.debug("WCMComposer templates have been cleaned !");
 }
Example #10
0
  public AbstractPageList<ResultNode> searchPageContents(
      SessionProvider sessionProvider,
      QueryCriteria queryCriteria,
      int pageSize,
      boolean isSearchContent)
      throws Exception {
    ManageableRepository currentRepository = repositoryService.getCurrentRepository();
    Session session = sessionProvider.getSession("portal-system", currentRepository);
    QueryManager queryManager = session.getWorkspace().getQueryManager();
    long startTime = System.currentTimeMillis();
    Query query = createSearchPageQuery(queryCriteria, queryManager);
    String suggestion = getSpellSuggestion(queryCriteria.getKeyword(), currentRepository);
    if (LOG.isDebugEnabled()) {
      LOG.debug("execute query: " + query.getStatement().toLowerCase());
    }
    AbstractPageList<ResultNode> pageList =
        PageListFactory.createPageList(
            query.getStatement(),
            session.getWorkspace().getName(),
            query.getLanguage(),
            true,
            new PageNodeFilter(),
            new PageDataCreator(),
            pageSize,
            0);

    long queryTime = System.currentTimeMillis() - startTime;
    pageList.setQueryTime(queryTime);
    pageList.setSpellSuggestion(suggestion);
    return pageList;
  }
Example #11
0
 /**
  * Find category which is already exist.<br>
  * for example: when you are standing in category D in path: Root\A\B\C\D, you do some action (add
  * new category, add question, go out to category C or B) but another moderator delete category C
  * (or B, A). Then this function will be use to find the nearest category with category D (which
  * is exist) and move you into this category.<br>
  * <u>Detail:</u><br>
  * the first, system get category C, if C is exist, you will be moved into C else jump to B and
  * test again.<br>
  * This processing is done until find a category already exist.
  *
  * @param faqService_ FAQ Service
  * @param fAQContainer UIAnswersContainer this component is used to updated data
  * @param sessionProvider SessionProvider
  * @throws Exception
  */
 public static void findCateExist(FAQService faqService_, UIAnswersContainer fAQContainer)
     throws Exception {
   UIBreadcumbs breadcumbs = fAQContainer.findFirstComponentOfType(UIBreadcumbs.class);
   String pathCate = "";
   for (String path : breadcumbs.pathList_.get(breadcumbs.pathList_.size() - 1).split("/")) {
     if (path.equals("FAQService")) {
       pathCate = path;
       continue;
     }
     try {
       faqService_.getCategoryById(path);
       if (pathCate.trim().length() > 0) pathCate += "/";
       pathCate += path;
     } catch (Exception pathExc) {
       UIQuestions questions = fAQContainer.findFirstComponentOfType(UIQuestions.class);
       try {
         breadcumbs.setUpdataPath(pathCate);
       } catch (Exception exc) {
         log.debug("Setting update path fail: " + exc.getMessage(), exc);
       }
       if (pathCate.indexOf("/") > 0) {
         questions.setCategoryId(pathCate.substring(pathCate.lastIndexOf("/") + 1));
       } else {
         questions.categoryId_ = null;
         questions.setListObject();
         // questions.setIsNotChangeLanguage() ;
       }
       fAQContainer.findFirstComponentOfType(UICategories.class).setPathCategory(pathCate);
       break;
     }
   }
 }
Example #12
0
  /**
   * Execute script on database. Set auto commit mode if needed.
   *
   * @param scripts the scripts for execution
   * @throws SQLException
   */
  protected void execute(List<String> scripts) throws SQLException {
    SecurityHelper.validateSecurityPermission(JCRRuntimePermissions.MANAGE_REPOSITORY_PERMISSION);

    // set needed auto commit mode
    boolean autoCommit = connection.getAutoCommit();
    if (autoCommit != this.autoCommit) {
      connection.setAutoCommit(this.autoCommit);
    }

    Statement st = connection.createStatement();
    try {
      for (String scr : scripts) {
        String sql = JDBCUtils.cleanWhitespaces(scr.trim());
        if (!sql.isEmpty()) {
          if (LOG.isDebugEnabled()) {
            LOG.debug("Execute script: \n[" + sql + "]");
          }

          executeQuery(st, sql);
        }
      }
    } finally {
      try {
        st.close();
      } catch (SQLException e) {
        LOG.error("Can't close the Statement." + e.getMessage());
      }

      // restore previous auto commit mode
      if (autoCommit != this.autoCommit) {
        connection.setAutoCommit(autoCommit);
      }
    }
  }
Example #13
0
 /** {@inheritDoc} */
 @Override
 public void spaceAvatarEdited(SpaceLifeCycleEvent event) {
   final String activityMessage = "Space has a new avatar.";
   Map<String, String> templateParams = new LinkedHashMap<String, String>();
   recordActivity(event, activityMessage, SPACE_AVATAR_EDITED_TITLE_ID, templateParams);
   LOG.debug("Space has a new avatar.");
 }
  public static ProcessContext createSpaceActivityRef(
      Identity owner, List<ExoSocialActivity> list) {
    //
    SocialServiceContext ctx = SocialServiceContextImpl.getInstance();
    StreamProcessContext processCtx =
        StreamProcessContext.getIntance(StreamProcessContext.LAZY_UPGRADE_STREAM_PROCESS, ctx);
    processCtx.identity(owner).activities(list);

    try {
      if (ctx.isAsync()) {
        //
        beforeAsync();
        ctx.getServiceExecutor().async(StreamProcessorFactory.createSpaceActivityRef(), processCtx);
      } else {
        //
        ctx.getServiceExecutor()
            .execute(StreamProcessorFactory.createSpaceActivityRef(), processCtx);
      }

    } finally {
      LOG.debug(processCtx.getTraceLog());
    }

    return processCtx;
  }
Example #15
0
 /** {@inheritDoc} */
 @Override
 public void applicationAdded(SpaceLifeCycleEvent event) {
   LOG.debug(
       "application <strong>"
           + event.getTarget()
           + "</strong> was added in space "
           + event.getSpace().getDisplayName());
 }
Example #16
0
 /** {@inheritDoc} */
 @Override
 public void applicationRemoved(SpaceLifeCycleEvent event) {
   LOG.debug(
       "application "
           + event.getTarget()
           + " was removed in space "
           + event.getSpace().getDisplayName());
 }
 /** As getTemplatePath() but it will return value NULL in case of exception. */
 public String getTemplate() {
   try {
     return getTemplatePath();
   } catch (Exception e) {
     if (LOG.isDebugEnabled())
       LOG.debug("Catch an exception when getting template, return value NULL.\n Cause by: ", e);
     return null;
   }
 }
Example #18
0
 public static boolean isUserExisted(OrganizationService orgSevice, String value) {
   try {
     return (!isEmpty(value) && orgSevice.getUserHandler().findUserByName(value) != null);
   } catch (Exception e) {
     if (log.isDebugEnabled()) {
       log.debug("Fail to check if user exist", e);
     }
     return false;
   }
 }
Example #19
0
  /** {@inheritDoc} */
  @Override
  public void joined(SpaceLifeCycleEvent event) {
    final String activityMessage = "Has joined the space.";
    Map<String, String> templateParams = new LinkedHashMap<String, String>();

    //
    recordActivity(event, activityMessage, USER_JOINED_TITLE_ID, templateParams);

    LOG.debug("user " + event.getTarget() + " joined space " + event.getSpace().getDisplayName());
  }
Example #20
0
 // save a default view type for Calendar Setting when cannot get the view type
 private static void resetViewInSetting(CalendarSetting calendarSetting) {
   try {
     calendarSetting.setViewType(CalendarSetting.DAY_VIEW);
     getCalendarService().saveCalendarSetting(getCurrentUser(), calendarSetting);
     setCurrentCalendarSetting(calendarSetting);
   } catch (Exception e) {
     if (log.isDebugEnabled()) {
       log.debug("Cant save Calendar Setting", e);
     }
   }
 }
 public void removeQuestion(String questionActivityId) {
   try {
     ExoContainer exoContainer = ExoContainerContext.getCurrentContainer();
     ActivityManager activityM =
         (ActivityManager) exoContainer.getComponentInstanceOfType(ActivityManager.class);
     ExoSocialActivity activity = activityM.getActivity(questionActivityId);
     activityM.deleteActivity(activity);
   } catch (Exception e) {
     LOG.debug("Fail to remove activity when remove question " + e.getMessage());
   }
 }
Example #22
0
 /** {@inheritDoc} */
 @Override
 public void spaceDescriptionEdited(SpaceLifeCycleEvent event) {
   final String activityMessage =
       "Description has been updated to: " + event.getSpace().getDescription();
   Map<String, String> templateParams = new LinkedHashMap<String, String>();
   templateParams.put(SPACE_DESCRIPTION_PARAM, event.getSpace().getDescription());
   templateParams.put(
       BaseActivityProcessorPlugin.TEMPLATE_PARAM_TO_PROCESS, SPACE_DESCRIPTION_PARAM);
   recordActivity(event, activityMessage, SPACE_DESCRIPTION_EDITED_TITLE_ID, templateParams);
   LOG.debug("Description has been updated ");
 }
Example #23
0
 public static String parseEmailAddress(String address) {
   try {
     InternetAddress[] iAdds = InternetAddress.parse(address, true);
     return iAdds[0].getAddress();
   } catch (AddressException e) {
     if (log.isDebugEnabled()) {
       log.debug("The mail address is not valid", e);
     }
     return null;
   }
 }
 public void removeComment(
     String questionActivityId, String commentActivityId, String questionPath) {
   try {
     ExoContainer exoContainer = ExoContainerContext.getCurrentContainer();
     ActivityManager activityM =
         (ActivityManager) exoContainer.getComponentInstanceOfType(ActivityManager.class);
     activityM.deleteComment(questionActivityId, commentActivityId);
     refreshActivity(questionPath, questionActivityId);
   } catch (Exception e) {
     LOG.debug("Fail to remove comment when remove question's comment " + e.getMessage());
   }
 }
Example #25
0
 public static String getUserAvatar(String userName) throws Exception {
   String url = "";
   try {
     FAQService service = getFAQService();
     FileAttachment avatar = service.getUserAvatar(userName);
     if (avatar != null) {
       url = CommonUtils.getImageUrl(avatar.getPath()) + "?size=" + avatar.getSize();
     }
   } catch (Exception e) {
     log.debug("Failed to get user avatar of user: " + userName, e);
   }
   return (isFieldEmpty(url)) ? org.exoplatform.faq.service.Utils.DEFAULT_AVATAR_URL : url;
 }
 private void removePublicData() throws Exception {
   try {
     log.info(
         String.format(
             "remove public datas..... \n  removing %s calendars.....", publicCalendar.size()));
     for (String calId : publicCalendar) {
       if (!isEmpty(calId)) {
         calService.removePublicCalendar(calId);
       }
     }
   } catch (Exception e) {
     log.debug("Failed to remove public injecter datas", e);
   }
 }
  public void unVoteQuestion(String questionId) {
    try {
      ExoContainer exoContainer = ExoContainerContext.getCurrentContainer();
      FAQService faqS = (FAQService) exoContainer.getComponentInstanceOfType(FAQService.class);
      Question question = faqS.getQuestionById(questionId);

      // No event is created because old and new values are equal but we must update the activity's
      // content
      question.setEditedQuestionRating(question.getMarkVote());
      saveQuestion(question, false);
    } catch (Exception e) {
      LOG.debug("Fail to unvote question " + e.getMessage());
    }
  }
 private void refreshActivity(String questionId, String questionActivityId) {
   try {
     ExoContainer exoContainer = ExoContainerContext.getCurrentContainer();
     FAQService faqS = (FAQService) exoContainer.getComponentInstanceOfType(FAQService.class);
     Question question = faqS.getQuestionById(questionId);
     ActivityManager activityM =
         (ActivityManager) exoContainer.getComponentInstanceOfType(ActivityManager.class);
     ExoSocialActivity activity = activityM.getActivity(questionActivityId);
     updateActivity(activity, question);
     activityM.updateActivity(activity);
   } catch (Exception e) {
     LOG.debug("Fail to refresh activity " + e.getMessage());
   }
 }
 public UISpaceSummaryInfoPortlet() throws Exception {
   iteratorAdministrators =
       createUIComponent(UIPageIterator.class, null, ITERATOR_ADMINISTRATORS_ID);
   addChild(iteratorAdministrators);
   SpaceService spaceService = getSpaceService();
   Space space = spaceService.getSpaceByUrl(SpaceUtils.getSpaceUrl());
   if (space != null) {
     isSpace = true;
   } else {
     if (LOG.isDebugEnabled()) {
       LOG.debug(
           "Can not add the portlet to this page navigation.\nSPACE_URL preference could not be set.");
     }
   }
 }
Example #30
0
  /** {@inheritDoc} */
  @Override
  public void spaceRenamed(SpaceLifeCycleEvent event) {
    final String activityMessage = "Name has been updated to: " + event.getSpace().getDisplayName();
    Map<String, String> templateParams = new LinkedHashMap<String, String>();
    templateParams.put(SPACE_DISPLAY_NAME_PARAM, event.getSpace().getDisplayName());
    templateParams.put(
        BaseActivityProcessorPlugin.TEMPLATE_PARAM_TO_PROCESS, SPACE_DISPLAY_NAME_PARAM);
    recordActivity(event, activityMessage, SPACE_RENAMED_TITLE_ID, templateParams);
    LOG.debug("Name has been updated ");

    // Update description at the same time of rename space
    if (UpdatedField.DESCRIPTION.equals(event.getSpace().getField())) {
      spaceDescriptionEdited(event);
    }
  }