Examples of InputException


Examples of evolaris.framework.sys.business.exception.InputException

    SmsDbManager smsDbManager = new SmsDbManager(locale,session);
   
    Invocation invocation = smsDbManager.getInvocation(invocationId);
   
    if (invocation == null){
      throw new InputException(getResources(req).getMessage(locale, "sys.entryNotAvailable"),"id = " + executionForm.getId(),null,null);
    }

    LOGGER.info("processing sms service event #" + executionForm.getId() + " (Keyword: " + invocation.getKeywords() + "; group: " + invocation.getGroup().getGroupname() + ")");
   
    String msisdn = "";
View Full Code Here

Examples of evolaris.framework.sys.business.exception.InputException

   */
  public void createGroup(Group group) {
    // check for existing group and create a reasonable exception if necessary
    if (getGroup(group.getGroupname()) != null){
        ResourceBundle messages = ResourceBundle.getBundle("UserManagement", locale);
      throw new InputException(messages.getString("groupExists"));
    }
    Calendar cal = Calendar.getInstance();
    group.setCreationdate(cal.getTime());
    session.save(group);
  }
View Full Code Here

Examples of evolaris.framework.sys.business.exception.InputException

   
    // owning user
    UserManager userManager = new UserManager(locale, session);
    User owningUser = userManager.getUserDetails(f.getOwningUserId());
    if (owningUser == null){
      throw new InputException(resources.getMessage(locale,"smssvc.AnEntryNotAvailable"));
    }
    timerEvent.setOwningUser(owningUser);

    // apply to
    if (f.getApplyToSelection() == 1) { // user
      User requestingUser = userManager.getUserDetails(f.getRequestingUserId());
      if (requestingUser == null){
        throw new InputException(resources.getMessage(locale,"smssvc.AnEntryNotAvailable"));
      }
      timerEvent.setRequestingUser(requestingUser);
      timerEvent.setRequestingUserSet(null);
    } else {
      if (f.getApplyToSelection() != 2) { // user set
        throw new BugException("invalid apply-to flag: " + f.getApplyToSelection());
      }
      UserSetManager userSetManager = new UserSetManager(locale,session);
      timerEvent.setRequestingUser(null);
      UserSet requestingUserSet = userSetManager.getUserSet(f.getRequestingUserSetId());
      if (requestingUserSet == null){
        throw new InputException(resources.getMessage(locale,"smssvc.AnEntryNotAvailable"));
      }
      timerEvent.setRequestingUserSet(requestingUserSet);
    }
   
    // repetition
View Full Code Here

Examples of evolaris.framework.sys.business.exception.InputException

  }

  private ActionForward changeCommentStatus(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse resp, int newStatus) {
   
    if(!req.isUserInRole("blog_reviewer")){
      throw new InputException(getLocalizedMessage("BloggingWeb", "blog.insufficientRights"));
    }
   
    BlogManager blogMgr = new BlogManager(locale, session);
    String idParam = req.getParameter("id")!=null ? req.getParameter("id") : (String)req.getSession().getAttribute("id");
   
    Comment comment = blogMgr.getComment(Long.parseLong(idParam));
    if (comment == null) {
      throw new InputException(getLocalizedMessage("BloggingWeb", "blog.CommentNotFound", idParam));
    }
   
    Blog blog = blogMgr.getBlog(comment.getArticle().getBlog().getId());
    Set<Long> permissions = getPermissions(blog, webUser);
    if (!permissions.contains(PermissionManager.READ_PERMISSION)) {
      throw new InputException(getLocalizedMessage("BloggingWeb", "blog.insufficientRights"));
    }
   
   
    comment.setReviewStatus(newStatus);
    blogMgr.modifyComment(comment);
View Full Code Here

Examples of evolaris.framework.sys.business.exception.InputException

  }
 
  private ActionForward changeArticleStatus(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse resp, int newStatus) {
   
    if(!req.isUserInRole("blog_reviewer")){
      throw new InputException(getLocalizedMessage("BloggingWeb", "blog.insufficientRights"));
    }
   
    BlogManager blogMgr = new BlogManager(locale, session);
    String idParam = req.getParameter("id")!=null ? req.getParameter("id") : (String)req.getSession().getAttribute("id");
   
    Article article = blogMgr.getArticle(Long.parseLong(idParam));
    if (article == null) {
      throw new InputException(getLocalizedMessage("BloggingWeb", "blog.ArticleNotFound", idParam));
    }
   
    Set<Long> permissions = getPermissions(article.getBlog(), webUser);
    if (!permissions.contains(PermissionManager.READ_PERMISSION)) {
      throw new InputException(getLocalizedMessage("BloggingWeb", "blog.insufficientRights"));
    }
   
    
    article.setReviewStatus(newStatus);
    blogMgr.modifyArticle(article);
View Full Code Here

Examples of evolaris.framework.sys.business.exception.InputException

    BlogManager blogMgr = new BlogManager(locale, session);
    String idParam = req.getParameter("id");
    Article article = blogMgr.getArticle(Long.parseLong(idParam));
   
    if (article == null) {
      throw new InputException(getLocalizedMessage("BloggingWeb", "blog.ArticleNotFound", idParam));
    }
    Blog blog = blogMgr.getBlog(article.getBlog().getId());
    Set<Long> permissions = getPermissions(blog, webUser);
    if (!permissions.contains(PermissionManager.READ_PERMISSION)) {
      throw new InputException(getLocalizedMessage("BloggingWeb", "blog.insufficientRights"));
    }
    req.setAttribute("blog", blog);
    req.getSession().setAttribute("blogCode", blog.getCode())// for fckeditor ...
    DisplayableArticle da = new DisplayableArticle(article, true);
    if (da.getTitle() == null || da.getTitle().trim().length()==0) {
View Full Code Here

Examples of evolaris.framework.sys.business.exception.InputException

  public ActionForward addComment(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse resp) {
    BlogArticleCommentForm f = (BlogArticleCommentForm)form;
    BlogManager blogMgr = new BlogManager(locale, session);
    Article article = blogMgr.getArticle(f.getArticleId());
    if (article == null) {
      throw new InputException(getLocalizedMessage("BloggingWeb", "blog.ArticleNotFound", f.getArticleId()));
    }
    Set<Long> permissions = getPermissions(article.getBlog(), webUser);
    if (!permissions.contains(PermissionManager.ADD_COMMENT_PERMISSION)) {
      throw new InputException(getLocalizedMessage("BloggingWeb", "blog.insufficientRights"));
    }   
    if (f.getContent() != null && f.getContent().trim().length() > 0) {
      Comment comment = blogMgr.addComment(article, f.getContent(), webUser);
      LOGGER.info("User "+UserManagerBase.toString(webUser)+" added comment #"+comment.getId()+" to article #"+article.getId()+" ("+article.getTitle()+") of blog #"+article.getBlog().getId()+" ("+article.getBlog().getName()+")");
    }
View Full Code Here

Examples of evolaris.framework.sys.business.exception.InputException

    return fwd;
  }
 
  public ActionForward deleteComment(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse resp) {
    if (webUser == null){
      throw new InputException(getResources(req).getMessage(locale, "blog.AnonymousEditingNotAllowed"));
    }
    BlogManager blogMgr = new BlogManager(locale, session);
    String idParam = req.getParameter("id");
    Comment comment = blogMgr.getComment(Long.parseLong(idParam));
    if (comment == null) {
      throw new InputException(getLocalizedMessage("BloggingWeb", "blog.CommentNotFound", idParam));
    }
    Set<Long> permissions = getPermissions(comment.getArticle().getBlog(), webUser);
    if (!permissions.contains(PermissionManager.WRITE_PERMISSION)) {
      throw new InputException(getLocalizedMessage("BloggingWeb", "blog.insufficientRights"));
    }
    Long id = comment.getArticle().getId();
    blogMgr.deleteComment(comment);
    LOGGER.info("User "+UserManagerBase.toString(webUser)+" deleted comment #"+comment.getId()+" ("+comment.getContent()+") of article #"+comment.getArticle().getId()+" ("+comment.getArticle().getTitle()+") of blog #"+comment.getArticle().getBlog().getId()+" ("+comment.getArticle().getBlog().getName()+")");   
    return injectId(mapping.findForward("deleted"), id);
View Full Code Here

Examples of evolaris.framework.sys.business.exception.InputException

      long[] selectedUserIds = f.getSelectedUserIds();
      for (int i = 0; i < sourceUserIds.length; i++){
        long sourceUserId = sourceUserIds[i];
        User sourceUser = userManager.getUserDetails(sourceUserId);
        if (sourceUser == null){
          throw new InputException(getResources(req).getMessage(locale, "smssvc.SourceUserNotAvailableAnymore"),"user #" + sourceUserId + " not found",null,null);
        }
        checkAccessRights(req,sourceUser.getGroup());
        long selectedUserId = selectedUserIds[i];
        if (selectedUserId <= 0){
          throw new InputException(getResources(req).getMessage(locale, "smssvc.UserMappingSelectionMissing"),"sourceUserId = " + sourceUserId,null,null);
        }
        User selectedUser = userManager.getUserDetails(selectedUserId);
        if (selectedUser == null){
          throw new InputException(getResources(req).getMessage(locale, "smssvc.SelectedUserNotAvaliableAnymore"),"user #" + selectedUserId + " not found",null,null);
        }
        checkAccessRights(req,selectedUser.getGroup());
        mappingSet.add(new Entry(sourceUser), new Entry(selectedUser));
      }
    }
   
    // user sets
   
    UserSetManager userSetManager = new UserSetManager(locale,session);
    long[] sourceUserSetIds = f.getSourceUserSetIds();
    if (sourceUserSetIds != null){
      long[] selectedUserSetIds = f.getSelectedUserSetIds();
      for (int i = 0; i < sourceUserSetIds.length; i++){
        long sourceUserSetId = sourceUserSetIds[i];
        UserSet sourceUserSet = userSetManager.getUserSet(sourceUserSetId);
        if (sourceUserSet == null){
          throw new InputException(getResources(req).getMessage(locale, "smssvc.SourceUserSetNotAvailableAnymore"),"user set #" + sourceUserSetId + " not found",null,null);
        }
        checkAccessRights(req,sourceUserSet.getGroup());
        long selectedUserSetId = selectedUserSetIds[i];
        if (selectedUserSetId >= 1){  // mapping entry => assign; no entry => create
          UserSet selectedUserSet = userSetManager.getUserSet(selectedUserSetId);
          if (selectedUserSet == null){
            throw new InputException(getResources(req).getMessage(locale, "smssvc.SelectedUserSetNotAvaliableAnymore"),"user set #" + selectedUserSetId + " not found",null,null);
          }
          checkAccessRights(req,selectedUserSet.getGroup());
          mappingSet.add(new Entry(sourceUserSet), new Entry(selectedUserSet));
        }
      }
    }
   
    // senders
   
    SmsSenderManager senderManager = new SmsSenderManager(locale,session);
    long[] sourceSenderIds = f.getSourceSenderIds();
    if (sourceSenderIds != null){  // at least one mapping
      long[] selectedSenderIds = f.getSelectedSenderIds();
      for (int i = 0; i < sourceSenderIds.length; i++){
        long sourceSenderId = sourceSenderIds[i];
        Sender sourceSender = senderManager.getSmsSenderById(sourceSenderId);
        if (sourceSender == null){
          throw new InputException(getResources(req).getMessage(locale, "smssvc.SourceSenderNotAvailableAnymore"),"sender #" + sourceSenderId + " not found",null,null);
        }
        if (!req.isUserInRole(UserManagerBase.ADMINISTRATOR) && !senderManager.isValidForGroup(sourceSender,webUser.getGroup())) {
          throw new InputException(getResources(req).getMessage(locale, "smssvc.insufficientRights"));
        }
        long selectedSenderId = selectedSenderIds[i];
        if (selectedSenderId >= 1){  // mapping entry => assign; no entry => add to group
          Sender selectedSender = senderManager.getSmsSenderById(selectedSenderId);
          if (selectedSender == null){
            throw new InputException(getResources(req).getMessage(locale, "smssvc.SelectedSenderNotAvaliableAnymore"),"sender #" + selectedSenderId + " not found",null,null);
          }
          if (!req.isUserInRole(UserManagerBase.ADMINISTRATOR) && !senderManager.isValidForGroup(selectedSender,webUser.getGroup())) {
            throw new InputException(getResources(req).getMessage(locale, "smssvc.insufficientRights"));
          }
          mappingSet.add(new Entry(sourceSender), new Entry(selectedSender));
        }
      }
    }

    // blogs

    BlogManager blogManager = new BlogManager(locale, session);
    long[] sourceBlogIds = f.getSourceBlogIds();
    if (sourceBlogIds != null) {  // at least one mapping
      Blog personalBlog = new Blog();
      personalBlog.setId(-99);
      personalBlog.setName(this.getResources(req).getMessage("smssvc.personalBlog"));
      long[] selectedBlogIds = f.getSelectedBlogIds();
      for (int i = 0; i < sourceBlogIds.length; i++){
        long sourceBlogId = sourceBlogIds[i];
        Blog sourceBlog = sourceBlogId == -99 ? personalBlog : blogManager.getBlog(sourceBlogId);
        if (sourceBlog == null){
          throw new InputException(getResources(req).getMessage(locale, "smssvc.SourceBlogNotAvailableAnymore"),"blog #" + sourceBlogId + " not found",null,null);
        }
        if (sourceBlog.getId() != -99) {
          checkAccessRights(req, sourceBlog.getGroup());
        }
        long selectedBlogId = selectedBlogIds[i];
        if (selectedBlogId != -99 && selectedBlogId <= 0) {
          throw new InputException(getResources(req).getMessage(locale, "smssvc.BlogMappingSelectionMissing"),"sourceBlogId = " + sourceBlogId,null,null);
        }
        Blog selectedBlog = selectedBlogId == -99 ? personalBlog : blogManager.getBlog(selectedBlogId);
        if (selectedBlog == null) {
          throw new InputException(getResources(req).getMessage(locale, "smssvc.SelectedBlogNotAvaliableAnymore"),"blog #" + selectedBlogId + " not found",null,null);
        }
        if (selectedBlogId != -1) {
          checkAccessRights(req,selectedBlog.getGroup());
        }
        mappingSet.add(new Entry(sourceBlog), new Entry(selectedBlog));
      }
    }       
   
    // fragments
   
    SmsDbManager smsDbManager = new SmsDbManager(locale,session);
    long[] sourceFragmentIds = f.getSourceFragmentIds();
    if (sourceFragmentIds != null){  // at least one mapping
      long[] selectedFragmentIds = f.getSelectedFragmentIds();
      for (int i = 0; i < sourceFragmentIds.length; i++){
        long sourceFragmentId = sourceFragmentIds[i];
        Fragment sourceFragment = smsDbManager.getFragment(sourceFragmentId);
        if (sourceFragment == null){
          throw new InputException(getResources(req).getMessage(locale, "smssvc.SourceFragmentNotAvailableAnymore"),"fragment #" + sourceFragmentId + " not found",null,null);
        }
        checkAccessRights(req,sourceFragment.getGroup());
        long selectedFragmentId = selectedFragmentIds[i];
        if (selectedFragmentId <= 0){
          throw new InputException(getResources(req).getMessage(locale, "smssvc.FragmentMappingSelectionMissing"),"sourceFragmentId = " + sourceFragmentId,null,null);
        }
        Fragment selectedFragment = smsDbManager.getFragment(selectedFragmentId);
        if (selectedFragment == null){
          throw new InputException(getResources(req).getMessage(locale, "smssvc.SelectedFragmentNotAvaliableAnymore"),"fragment #" + selectedFragmentId + " not found",null,null);
        }
        checkAccessRights(req,selectedFragment.getGroup());
        mappingSet.add(new Entry(sourceFragment), new Entry(selectedFragment));
      }
    }
View Full Code Here

Examples of evolaris.framework.sys.business.exception.InputException

    if (entry == null){
      entry = new IterateCommandEntry();
    }
    entry.setGroup(group);
    if (f.getSortLabel() == null ||  f.getSortLabel().equals("")){
      throw new InputException(resources.getMessage(locale, "smssvc.labelMustBeProvided"));
    }
    entry.setSortLabel(f.getSortLabel());

    UserSetManager userSetManager = new UserSetManager(locale, session);
    Set<UserSet> userSets = new HashSet<UserSet>();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.