Package ru.org.linux.user

Examples of ru.org.linux.user.UserErrorException


    if (voteid != poll.getId()) {
      throw new BadVoteException("голосовать можно только в текущий опрос");
    }

    if (votes==null || votes.length==0) {
      throw new UserErrorException("ничего не выбрано");
    }

    if (!poll.isMultiSelect() && votes.length!=1) {
      throw new BadVoteException("этот опрос допускает только один вариант ответа");
    }
View Full Code Here


    params.put("msgid", msgid);

    Comment comment = commentService.getById(msgid);

    if (comment.isDeleted()) {
      throw new UserErrorException("комментарий уже удален");
    }

    int topicId = comment.getTopicId();

    Topic topic = messageDao.getById(topicId);
View Full Code Here

    user.checkAnonymous();

    Comment comment = commentService.getById(msgid);

    if (comment.isDeleted()) {
      throw new UserErrorException("комментарий уже удален");
    }

    Topic topic = messageDao.getById(comment.getTopicId());

    final boolean haveAnswers = commentService.isHaveAnswers(comment);

    if (!permissionService.isCommentDeletableNow(comment, user, topic, haveAnswers)) {
      throw new UserErrorException("комментарий нельзя удалить");
    }

    if (!user.isModerator() || comment.getUserid() == user.getId()) {
      bonus = 0;
    }
View Full Code Here

    } else if ("remove".equals(time)) {
    } else if ("custom".equals(time)) {
      int days = ServletRequestUtils.getRequiredIntParameter(request, "ban_days");

      if (days <= 0 || days > 180) {
        throw new UserErrorException("Invalid days count");
      }

      calendar.add(Calendar.DAY_OF_MONTH, days);
    }
View Full Code Here

    }

    Topic msg = messageDao.getById(msgid);

    if (msg.isDeleted()) {
      throw new UserErrorException("Сообщение уже удалено");
    }

    if (!permissionService.isDeletable(msg, tmpl.getCurrentUser())) {
      throw new AccessViolationException("Вы не можете удалить это сообщение");
    }
View Full Code Here

    user.checkAnonymous();

    Topic message = messageDao.getById(msgid);

    if (message.isDeleted()) {
      throw new UserErrorException("Сообщение уже удалено");
    }

    if (!permissionService.isDeletable(message, user))  {
      throw new AccessViolationException("Вы не можете удалить это сообщение");
    }
View Full Code Here

    }

    Topic message = messageDao.getById(msgid);

    if (message.isCommited()) {
      throw new UserErrorException("Сообщение уже подтверждено");
    }

    PreparedTopic preparedMessage = prepareService.prepareTopic(message, request.isSecure(), tmpl.getCurrentUser());

    if (!preparedMessage.getSection().isPremoderated()) {
      throw new UserErrorException("Раздел не премодерируемый");
    }

    ModelAndView mv = prepareModel(
            preparedMessage,
            form,
View Full Code Here

    final String[] filterValues = {"all", "notalks", "tech"};
    final Set<String> filterValuesSet = new HashSet<>(Arrays.asList(filterValues));

    if (topicListForm.getFilter() != null && !filterValuesSet.contains(topicListForm.getFilter())) {
      throw new UserErrorException("Некорректное значение filter");
    }
    boolean notalks = topicListForm.getFilter() != null && "notalks".equals(topicListForm.getFilter());
    boolean tech = topicListForm.getFilter() != null && "tech".equals(topicListForm.getFilter());

View Full Code Here

  ) throws Exception {
    if (offset==null) {
      offset = 0;
    } else {
      if (offset<0 || offset>300) {
        throw new UserErrorException("Некорректное значение offset");
      }
    }

    Template tmpl = Template.getTemplate(request);

    TrackerFilterEnum defaultFilter = tmpl.getProf().getTrackerMode();

    TrackerFilterEnum trackerFilter = TrackerFilterEnum.getByValue(filterAction).or(defaultFilter);

    Map<String, Object> params = new HashMap<>();
    params.put("offset", offset);
    params.put("filter", trackerFilter.getValue());

    if (trackerFilter != defaultFilter) {
      params.put("addition_query", "&amp;filter=" + trackerFilter.getValue());
    } else {
      params.put("addition_query", "");
    }

    params.put("defaultFilter", defaultFilter);

    Date startDate;

    if (trackerFilter == TrackerFilterEnum.MINE) {
      startDate = DateTime.now().minusMonths(6).toDate();
    } else {
      startDate = DateTime.now().minusDays(1).toDate();
    }

    int messages = tmpl.getProf().getMessages();
    int topics = tmpl.getProf().getTopics();

    params.put("topics", topics);

    User user = tmpl.getCurrentUser();

    params.put("title", makeTitle(trackerFilter, defaultFilter));

    if (trackerFilter == TrackerFilterEnum.MINE && !tmpl.isSessionAuthorized()) {
      throw new UserErrorException("Not authorized");
    }

    params.put("msgs", trackerDao.getTrackAll(trackerFilter, user, startDate, topics, offset, messages));

    if (tmpl.isModeratorSession() && trackerFilter != TrackerFilterEnum.MINE) {
View Full Code Here

    if (!tmpl.isModeratorSession()) {
      throw new AccessViolationException("Not moderator");
    }

    if (postscore < TopicPermissionService.POSTSCORE_UNRESTRICTED) {
      throw new UserErrorException("invalid postscore " + postscore);
    }

    if (postscore > TopicPermissionService.POSTSCORE_UNRESTRICTED && postscore < TopicPermissionService.POSTSCORE_REGISTERED_ONLY) {
      throw new UserErrorException("invalid postscore " + postscore);
    }

    if (postscore > TopicPermissionService.POSTSCORE_MODERATORS_ONLY) {
      throw new UserErrorException("invalid postscore " + postscore);
    }

    User user = tmpl.getCurrentUser();
    user.checkCommit();
View Full Code Here

TOP

Related Classes of ru.org.linux.user.UserErrorException

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.