Package evolaris.framework.sys.business.exception

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


   
    List<String> permissionValues = new ArrayList<String>();
   
    AccessControlledEntry entry = permissionMgr.getAccessControlledEntry(Long.parseLong(idParam));
    if (entry == null) {
      throw new InputException(getResources(req).getMessage(locale, "um.AccessControlledEntryNotFound", idParam));
    }
    LOGGER.debug("preparing editing of permissions for AccessControlledEntry #`"+entry.getId()+"`");
    req.setAttribute("entry", entry);
    req.setAttribute("name", nameParam);
   
    LOGGER.debug("about to fetch list of permissions for AccessControlledClass `"+entry.getAccessControlledClass().getName()+"`...");
    List<Permission> permissions = permissionMgr.getPermissions(entry.getAccessControlledClass().getName());
    LOGGER.debug("successfully fetched list of permissions.");
    LOGGER.debug("about to prepare for display...");

    List<KeyValueContainer> displayablePermissions = new ArrayList<KeyValueContainer>();
    for (Permission p : permissions) {
      try {
        String s = this.getResources(req).getMessage(locale,"um.AccessPermission_"+p.getValue());
         displayablePermissions.add(new KeyValueContainer(p.getId(), s));
         LOGGER.debug("added displayable permission `"+s+"`");
      } catch (Exception e) {
        String msg = getResources(req).getMessage(locale,"um.missingAccessPermissionName", p.getValue());
        throw new ConfigurationException(msg);
      }
    }
    req.setAttribute("permissions", displayablePermissions);

    LOGGER.debug("about to fetch anonymous permissions...");
    /* anonymous permissions */
    Set<Long> anonymousPermissions = permissionMgr.getAnonymousPermissions(entry);   
    for (Permission p : permissions) {
      if (anonymousPermissions.contains(p.getId())) {
        permissionValues.add("anonymous_"+p.getId());
      }
    }
    LOGGER.debug("successfully fetched anonymous permissions.");

    LOGGER.debug("about to fetch role permissions...");
    /* role permissions */
    UserManager userMgr = new UserManager(locale,session);
    Role[] roles = null;
    if (req.isUserInRole(UserManagerBase.ADMINISTRATOR)) {
      roles = userMgr.getRoles();
    } else  if (req.isUserInRole(UserManagerBase.GROUP_ADMINISTRATOR)) {
      roles = webUser.getRoles().toArray(new Role[0])// only show the own roles
    } else {
      LOGGER.error("insufficient rights - user must be GROUP_ADMINISTRATOR or ADMINISTRATOR to edit permissions.");
      throw new InputException(getResources(req).getMessage(locale, "um.insufficientRights"));
    }   
    req.setAttribute("roles", roles);
    for (Role r : roles) {
      Set<Long> rolePermissions = permissionMgr.getRolePermissions(entry, r);   
      for (Permission p : permissions) {
View Full Code Here


    return mapping.findForward("edit");
  }

  public ActionForward modify(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse resp) {
    if (! (req.isUserInRole(UserManagerBase.ADMINISTRATOR) || req.isUserInRole(UserManagerBase.GROUP_ADMINISTRATOR))) {
      throw new InputException(getResources(req).getMessage(locale, "um.insufficientRights"));
    }
    PermissionForm permissionForm = (PermissionForm)form;
    PermissionManager permissionMgr = new PermissionManager(locale, session);

    AccessControlledEntry entry = permissionMgr.getAccessControlledEntry(permissionForm.getId());
    if (entry == null) {
      throw new InputException(getResources(req).getMessage(locale, "um.AccessControlledEntryNotFound", permissionForm.getId()));
    }
   
    Set<Long> anonymousPermissions = new HashSet<Long>();
    Map<Long, Set<Long>> rolePermissions = new HashMap<Long, Set<Long>>();
    Map<Long, Set<Long>> userSetPermissions = new HashMap<Long, Set<Long>>();
View Full Code Here

    Group group = groupMgr.getGroup(f.getGroupId());
    invocation.setGroup(group);

    // "logical" validations
    if (invocation.getBeginAt() != null && invocation.getEndAt() != null && invocation.getBeginAt().after(invocation.getEndAt())) {
      throw new InputException(resources.getMessage("admin.keywordBeginDateMustBeBeforeEndDate"));     
    }
    return invocation;
  }
View Full Code Here

        return null;
      }
     
    } catch(ParseException e) {
      LOGGER.error("begin or end date couldn't be parsed",e);
      throw new InputException(resources.getMessage(locale, "admin.invalidDateFormat"));
    }
  } 
View Full Code Here

    // client project
    GroupManager groupMgm = new GroupManager(locale,session);
    ClientProject clientProject = groupMgm.getClientProject(clientProjectId);
    if (clientProject == null){
      throw new InputException(resources.getMessage(locale,"um.clientProjectDeleted"));
    }
    group.setClientProject(clientProject);

    // default application
    Application defaultApplication = null;
    if (defaultApplicationId != null && defaultApplicationId >= 1){
      ApplicationManager applicationManager = new ApplicationManager(locale,session);
      Application selectedDefaultApplication = applicationManager.getApplication(defaultApplicationId);
      if (selectedDefaultApplication != null && selectedDefaultApplication.getGroup() == group){
        defaultApplication = selectedDefaultApplication;
      }
    }
    group.setDefaultApplication(defaultApplication);
   
    // logo
    // only modify the logo, if the user selected one
    if (logo != null && logo.getFileName() != null && logo.getFileName().length() != 0){
      try {
        byte[] fileData = logo.getFileData();
        if (fileData == null || fileData.length <= 0){  // this also happens if the file does not exist => no precise error message possible
          throw new InputException(resources.getMessage(locale, "um.couldNotReadFile",logo.getFileName()));
        }
        Blob logoBlob = Hibernate.createBlob(fileData);
        group.setLogo(logoBlob);
      } catch (FileNotFoundException e){
        throw new InputException(resources.getMessage(locale, "um.fileNotFound",logo.getFileName()),e);
      } catch (IOException e) {
        throw new InputException(resources.getMessage(locale, "um.couldNotReadFile",logo.getFileName()),e);
      }
    }
   
    // senders (change only if flag set)
    if (modifySenders){
View Full Code Here

    UserSet userSet = userSetManager.getUserSet(userSetAssignmentListForm.getUserSetId());
    if (userSet == null) {
      String msg = getResources(req).getMessage("um.userSetNotFound", req.getParameter("id"));
      LOGGER.error(msg);
      throw new InputException(msg);
    }
    if (!userSet.getGroup().equals(getCurrentGroup(req))) {
      // due to global group selection, userset should be in current group
      throw new InputException(getResources(req).getMessage("um.userSetNotInCurrentGroup"));
    }
    checkAccessRights(req, userSet.getGroup());
    Group currentGroup = getCurrentGroup(req);
   
    // fetch the list of users
View Full Code Here

    Set<UserSet> userSets = new HashSet<UserSet>();
    if (f.getUserSets() != null) {
      for (Long id : f.getUserSets()) {
        UserSet userSet = userSetMgr.getUserSet(id);
        if (userSet == null || userSet.getGroup() != group) {
          throw new InputException(resources.getMessage("um.userSetNotFound", id));         
        }
        userSets.add(userSet);
      }
    }
    user.setUserSets(userSets)
View Full Code Here

    UserSetEnterOrEditForm userSetEnterOrEditForm = (UserSetEnterOrEditForm) form;
    long originalUserSetId = userSetEnterOrEditForm.getOriginalId();
    UserSetManager userSetManager = new UserSetManager(locale,session);
    UserSet originalUserSet = userSetManager.getUserSet(originalUserSetId);
    if (originalUserSet == null){
      throw new InputException(getResources(req).getMessage(locale, "um.userSetNotFound",  originalUserSetId));
    }
    checkAccessRights(req, originalUserSet.getGroup());
    Group group = new GroupManager(locale,session).getGroup(userSetEnterOrEditForm.getGroupId());
    boolean differentGroup = group != originalUserSet.getGroup();
    if (includeUserAssignments && differentGroup && !userSetEnterOrEditForm.isConfirmationPending() && originalUserSet.getUsers().size() >= 1){
View Full Code Here

    if (entry == null){
      entry = new AccessCheckCommandEntry();
    }
    entry.setGroup(group);
    if (f.getSortLabel() == null ||  f.getSortLabel().equals("")){
      throw new InputException(resources.getMessage(locale, "smssvc.labelMustBeProvided"));
    }
    entry.setSortLabel(f.getSortLabel());
   
    // at least one restriction must be provided
    boolean timeSpanProvided = !((f.getBeginDate() == null || f.getBeginDate().equals("") && (f.getEndDate() == null || f.getEndDate().equals(""))));
    boolean minimumAgeProvided = f.getMinimumAge() != null && f.getMinimumAge().length() >= 1;
    boolean maximumAgeProvided = f.getMaximumAge() != null && f.getMaximumAge().length() >= 1;
    boolean messageCountProvided = (f.getInteractionLogMessage() != null && f.getInteractionLogMessage().length() >= 1) && (f.getInteractionLogMessageCount() != null && f.getInteractionLogMessageCount().length() >= 1);
    if (! (timeSpanProvided || minimumAgeProvided || maximumAgeProvided || f.isHasBirthday() || messageCountProvided)) {
      throw new InputException(resources.getMessage(locale, "smssvc.noRestrictionProvided"));
    }
    Date beginDateTime = getDateTime(f.getBeginDate(), f.getBeginTime(), true, resources,locale);
    Date endDateTime = getDateTime(f.getEndDate(), f.getEndTime(), false, resources,locale);
    if(beginDateTime != null && endDateTime != null && beginDateTime.after(endDateTime)){
      throw new InputException(resources.getMessage(locale, "smssvc.endDateIsBeforeBeginDate"));
    }
    entry.setBeginAt(timeSpanProvided ? beginDateTime : null);
    entry.setEndAt(timeSpanProvided ? endDateTime : null);
    entry.setMinimumAge(minimumAgeProvided ? Integer.parseInt(f.getMinimumAge()) : null);
    entry.setMaximumAge(maximumAgeProvided ? Integer.parseInt(f.getMaximumAge()) : null);
View Full Code Here

    if (!userSetEnterOrEditForm.isConfirmationPending()){
      String idParameter = req.getParameter("id");
      long id = Long.valueOf(idParameter);
      UserSet userSet = userSetManager.getUserSet(id);
      if (userSet == null){
        throw new InputException(getResources(req).getMessage(locale, "um.userSetNotFound",  id));
      }
      checkAccessRights(req,userSet.getGroup());
      userSetEnterOrEditForm.setOriginalId(id);
      userSetEnterOrEditForm.setId(id);
      userSetEnterOrEditForm.setDescription(userSet.getDescription());
View Full Code Here

TOP

Related Classes of evolaris.framework.sys.business.exception.InputException

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.