Package evolaris.framework.um.datamodel

Examples of evolaris.framework.um.datamodel.Group


   *
   * fails if the group data couldn't be fetched
   */
  public void testGetGroup() {
    GroupManager groupManager = new GroupManager(Locale.GERMAN,session);
    Group group = groupManager.getGroup("administrator");
    assertNotNull(group);
  }
View Full Code Here


    }
   
    // ID, group
    timerEvent.setId(f.getId());
    GroupManager groupMgr = new GroupManager(locale, session);
    Group group = groupMgr.getGroup(f.getGroupId());
    timerEvent.setGroup(group);
   
    // owning user
    UserManager userManager = new UserManager(locale, session);
    User owningUser = userManager.getUserDetails(f.getOwningUserId());
View Full Code Here

    UserSetManager setMgr = new UserSetManager(Locale.GERMAN,session);
    GroupManager groupMgr = new GroupManager(Locale.GERMAN,session);
    UserManager userMgr = new UserManager(Locale.GERMAN,session);


    Group group = groupMgr.getGroup("Evolaris");
    long msisdn = 123456789l;

    // new user
    setMgr.assignUserToSet(msisdn,"AT_MOBILKOM","Nokia",group,"Java-Entwickler");
View Full Code Here

  }

  public void testGetUsers(){
    UserSetManager userSetMgr = new UserSetManager(Locale.GERMAN,session);
    GroupManager groupMgr = new GroupManager(Locale.GERMAN,session);
    Group group = groupMgr.getGroup("Evolaris");
    UserSet userSet = userSetMgr.getUserSet("Kärntner", group);
    User[] users = userSetMgr.getUsers(userSet,0,2,null,null);
    assertEquals(users.length, 2);
  }
View Full Code Here

    final String[] firstNames = new String[] {"John", "Jane"};
   
    GroupManager groupManager = new GroupManager(Locale.getDefault(), session);
    UserSetManager userSetManager = new UserSetManager(Locale.getDefault(), session);
    UserManager userManager = new UserManager(Locale.getDefault(), session);
    Group group = groupManager.getGroup("Evolaris");
    UserSet set = userSetManager.getUserSet("Java-Entwickler", group);
   
    for (int i=1; i<=TESTUSERCOUNT; i++) {
      System.out.println(i);
      User u = new User();
View Full Code Here

  @SuppressWarnings("unchecked")
  public ActionForward select(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse resp) {
    req.getSession().setAttribute("formActionPath", req.getParameter("formActionPath"));
   
    // get destination application (and thus group) or at least the group from session
    Group destinationGroup;
    Application destinationApplication = null;
    Object destinationApplicationIdFromSession = req.getSession().getAttribute("destinationApplicationId");
    if (destinationApplicationIdFromSession != null){
      if (!(destinationApplicationIdFromSession instanceof Long)){
        throw new BugException("invalid destinationApplicationId parameter: " + destinationApplicationIdFromSession);
      }
      ApplicationManager applicationManager = new ApplicationManager(locale,session);
      destinationApplication = applicationManager.getApplication((Long)destinationApplicationIdFromSession);
      if (destinationApplication == null){
        throw new BugException("invalid destination application id: " + destinationApplicationIdFromSession);
      }
      destinationGroup = destinationApplication.getGroup();
    } else {
      Object destinationGroupIdFromSession = req.getSession().getAttribute("destinationGroupId");
      if (!(destinationGroupIdFromSession instanceof Long)){
        throw new BugException("invalid destinationGroupId parameter: " + destinationGroupIdFromSession);
      }
      GroupManager groupManager = new GroupManager(locale,session);
      destinationGroup  = groupManager.getGroup((Long)destinationGroupIdFromSession);
      if (destinationGroup == null){
        throw new BugException("invalid destination group id: " + destinationGroupIdFromSession);
      }
    }
   
    // get mappings from session
    Object mappingSetFromSession = req.getSession().getAttribute("mappingSet");
    if (!(mappingSetFromSession instanceof MappingSet)) {
      throw new BugException("invalid mappingSet parameter: " + mappingSetFromSession);
    }
    MappingSet mappingSet = (MappingSet) mappingSetFromSession;
    mappingSet.reload(locale, session);
   
    // prepare mapping form and request attributes
    List<User> sourceUsers = new LinkedList<User>();
    List<User> proposedUsers = new LinkedList<User>();
    List<Long> proposedUserIds = new LinkedList<Long>();
    List<UserSet> sourceUserSets = new LinkedList<UserSet>();
    List<Long> proposedUserSetIds = new LinkedList<Long>();
    List<Sender> sourceSenders = new LinkedList<Sender>();
    List<Long> proposedSenderIds = new LinkedList<Long>();
    List<Fragment> sourceFragments = new LinkedList<Fragment>();
    List<Long> proposedContentIds = new LinkedList<Long>();
    List<Long> proposedFragmentIds = new LinkedList<Long>();
    List<Long> proposedChannelIds = new LinkedList<Long>();
    List<Blog> sourceBlogs = new LinkedList<Blog>();
    List<Long> proposedBlogIds = new LinkedList<Long>();
    for (Mapping entryMapping : mappingSet) {
      Entry sourceEntry = entryMapping.getSourceEntry();
      if (sourceEntry.getUser() != null){
        sourceUsers.add(sourceEntry.getUser());
        Entry destinationEntry = entryMapping.getDestinationEntry();
        if (destinationEntry != null){
          proposedUsers.add(destinationEntry.getUser());
          proposedUserIds.add(destinationEntry.getUser().getId());
        } else {
          proposedUserIds.add(-1L);
        }
      } else if (sourceEntry.getUserSet() != null){
        sourceUserSets.add(sourceEntry.getUserSet());
        Entry destinationEntry = entryMapping.getDestinationEntry();
        if (destinationEntry != null){
          proposedUserSetIds.add(destinationEntry.getUserSet().getId());
        } else {
          proposedUserSetIds.add(-1L);
        }
      } else if (sourceEntry.getSender() != null){
        sourceSenders.add(sourceEntry.getSender());
        Entry destinationEntry = entryMapping.getDestinationEntry();
        if (destinationEntry != null){
          proposedSenderIds.add(destinationEntry.getSender().getId());
        } else {
          proposedSenderIds.add(-1L);
        }
      } else if (sourceEntry.getFragment() != null){
        sourceFragments.add(sourceEntry.getFragment());
        Entry destinationEntry = entryMapping.getDestinationEntry();
        if (destinationEntry != null){
          proposedFragmentIds.add(destinationEntry.getFragment().getId());
        } else {
          proposedFragmentIds.add(-1L);
        }
      } else if (sourceEntry.getBlog() != null) {
        sourceBlogs.add(sourceEntry.getBlog());
        Entry destinationEntry = entryMapping.getDestinationEntry();
        if (destinationEntry != null) {
          proposedBlogIds.add(destinationEntry.getBlog().getId());
        } else {
          proposedBlogIds.add(-1L);
        }
      } // ignore group entry
    }
    req.setAttribute("sourceUsers", sourceUsers);
    req.setAttribute("proposedUserIds",proposedUserIds);
    req.setAttribute("sourceUserSets", sourceUserSets);
    req.setAttribute("proposedUserSetIds",proposedUserSetIds);
    req.setAttribute("sourceSenders", sourceSenders);
    req.setAttribute("proposedSenderIds",proposedSenderIds);
    req.setAttribute("proposedContentIds",proposedContentIds);
    req.setAttribute("sourceFragments", sourceFragments);
    req.setAttribute("proposedFragmentIds",proposedFragmentIds);
    req.setAttribute("proposedChannelIds",proposedChannelIds);
    req.setAttribute("sourceBlogs", sourceBlogs);
    req.setAttribute("proposedBlogIds",proposedBlogIds);
   
    // selection content; proposed mappings have to be in the lists independently of the maximum number of entries

    UserManager userManager = new UserManager(locale,session);
    SortedSet<SelectableUser> selectableUsers = new TreeSet<SelectableUser>();
    for (User user : proposedUsers) {
      selectableUsers.add(new SelectableUser(user.getId(),userManager.selectionDescription(user)));
    }
    User[] users = userManager.getUsers(destinationGroup, true);
    for (User user : users) {
      if (selectableUsers.size() < MAX_NOF_SELECTION_ENTRIES && user.getUsername() != null){  // only propose users with user names
        selectableUsers.add(new SelectableUser(user.getId(),userManager.selectionDescription(user)));
      }
    }
    req.setAttribute("selectableUsers", selectableUsers);
   
    UserSetManager userSetManager = new UserSetManager(locale,session);
    req.setAttribute("selectableUserSets", userSetManager.getUserSets(destinationGroup));
   
    Set<Sender> senders = destinationGroup.getSmsSenders();
    for (Sender sender : senders) {  // fill cache
      sender.getMsisdn();
      sender.getGatewayProvider();
      sender.getDescription();
    }
View Full Code Here

    User user = userManager.getUserDetails(req.getUserPrincipal().getName().toLowerCase());
    SendTaskListForm sendTaskListForm = (SendTaskListForm) form;

    SendTaskManager sendTaskMgr = new SendTaskManager(locale, session);

    Group groupToDisplay = getCurrentGroup(req);
    if (Boolean.TRUE.equals(sendTaskListForm.getAllGroups()) && UserManager.isUserInRole(webUser, UserManagerBase.ADMINISTRATOR)) {
      groupToDisplay = null;
    }   
    User userToDisplay = null;
View Full Code Here

   *      javax.servlet.http.HttpServletResponse)
   */
  public ActionForward create(ActionMapping mapping, ActionForm form,HttpServletRequest req, HttpServletResponse resp)  {
    IterateInteractionEnterOrEditForm f = (IterateInteractionEnterOrEditForm)form;
    MessageResources resources = getResources(req);
    Group group = groupFromSession(req);
    checkAccessRights(req, group);
    IterateCommandEntry iterateCommandEntry = f.toEntry(new IterateCommandEntry(), group, locale, session, resources);
    LOGGER.info("User " + req.getUserPrincipal().getName().toLowerCase() + ": Created iterate entry #" + iterateCommandEntry.getId());
    setCommandEntryInRequest(req, iterateCommandEntry);
    return mapping.findForward("created");
View Full Code Here

    if (groupIdParameter == null || !(groupIdParameter instanceof Long)){
      throw new InputException(getResources(req).getMessage(locale, "smssvc.pageNotValidAnymore"),null,"no group ID of type Long found in session.",null);
    }
    long groupId = ((Long)groupIdParameter).longValue();
    GroupManager groupManager = new GroupManager(locale,session);
    Group group = groupManager.getGroup(groupId);
    if (group == null){
      throw new ConfigurationException("There is no group with id: " + groupId + " -> cannot add a new interaction");
    }
    checkAccessRights(req, group);
    return group;
View Full Code Here

   *      javax.servlet.http.HttpServletResponse)
   */
  public ActionForward create(ActionMapping mapping, ActionForm form,HttpServletRequest req, HttpServletResponse resp)  {
    FragmentInteractionEnterOrEditForm f = (FragmentInteractionEnterOrEditForm)form;
    MessageResources resources = getResources(req);
    Group group = groupFromSession(req);
    checkAccessRights(req, group);
    FragmentCommandEntry fragmentCommandEntry = f.toEntry(new FragmentCommandEntry(), group, locale, session, resources);
    LOGGER.info("User " + req.getUserPrincipal().getName().toLowerCase() + ": Created fragment entry #" + fragmentCommandEntry.getId());
    setCommandEntryInRequest(req, fragmentCommandEntry);
    return mapping.findForward("created");
View Full Code Here

TOP

Related Classes of evolaris.framework.um.datamodel.Group

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.