Package evolaris.platform.smssvc.web.form

Examples of evolaris.platform.smssvc.web.form.UserSetInteractionEnterOrEditForm


   *      org.apache.struts.action.ActionForm,
   *      javax.servlet.http.HttpServletRequest,
   *      javax.servlet.http.HttpServletResponse)
   */
  public ActionForward enter(ActionMapping mapping, ActionForm form,HttpServletRequest req, HttpServletResponse resp)  {
    UserSetInteractionEnterOrEditForm userSetInteractionEnterOrEditForm = (UserSetInteractionEnterOrEditForm) form;
    Group group = groupFromSession(req);
    checkAccessRights(req, group);
    userSetInteractionEnterOrEditForm.setSortLabel(sortLabelProposalFromSession(req));
    userSetInteractionEnterOrEditForm.setCommandType(1)// default: add to user set
    userSetInteractionEnterOrEditForm.setNofUsers(null);
   
    Set<UserSet> userSets = group.getUserSets();
    req.getSession().setAttribute("userSets", userSets)// may be empty
    if (userSets.size() >= 1){
      userSetInteractionEnterOrEditForm.setUserSetId(userSets.iterator().next().getId());
    }
    req.getSession().setAttribute("enterOrEdit", "enter");
    req.getSession().setAttribute("formActionPath", req.getParameter("formActionPath"));
    return mapping.findForward("enter");
  }
View Full Code Here


   *      org.apache.struts.action.ActionForm,
   *      javax.servlet.http.HttpServletRequest,
   *      javax.servlet.http.HttpServletResponse)
   */
  public ActionForward edit(ActionMapping mapping, ActionForm form,HttpServletRequest req, HttpServletResponse resp)  {
    UserSetInteractionEnterOrEditForm userSetInteractionEnterOrEditForm = (UserSetInteractionEnterOrEditForm) form;
    UserSetCommandEntry userSetCommandEntry = (UserSetCommandEntry)commandEntryFromRequest(req);
    Group group = userSetCommandEntry.getGroup();
    checkAccessRights(req, group);
    userSetInteractionEnterOrEditForm.setCommandEntryId(userSetCommandEntry.getId())// not to be used when editing
    userSetInteractionEnterOrEditForm.setSortLabel(userSetCommandEntry.getSortLabel());
    userSetInteractionEnterOrEditForm.setUserSetId(userSetCommandEntry.getUserSet() != null ? userSetCommandEntry.getUserSet().getId() : -2);
    userSetInteractionEnterOrEditForm.setCommandType(userSetCommandEntry.getUserSetCommandEntryType());
    if(userSetCommandEntry.getNofUsers() != null){
      userSetInteractionEnterOrEditForm.setNofUsers(userSetCommandEntry.getNofUsers().toString());
      userSetInteractionEnterOrEditForm.setNofDrawings(userSetCommandEntry.getNofUsers().toString());
    }
   
    Set<UserSet> userSets = group.getUserSets();
   
    if(userSetCommandEntry.getUserSetCommandEntryType().intValue() == 6){
      userSetInteractionEnterOrEditForm.setAssignUserSetId(userSetCommandEntry.getUserSetOperand() != null ? userSetCommandEntry.getUserSetOperand().getId() : -2);
    } else {
      userSetInteractionEnterOrEditForm.setAssignUserSetId(userSets.iterator().next().getId());
    }
    if(userSetCommandEntry.getUserSetCommandEntryType().intValue() == 7){
      userSetInteractionEnterOrEditForm.setReplaceWithUserSetId(userSetCommandEntry.getUserSetOperand() != null ? userSetCommandEntry.getUserSetOperand().getId() : -2);
    } else {
      userSetInteractionEnterOrEditForm.setReplaceWithUserSetId(userSets.iterator().next().getId());
    }
    if(userSetCommandEntry.getUserSetCommandEntryType().intValue() == 8){
      userSetInteractionEnterOrEditForm.setRemoveUserSetId(userSetCommandEntry.getUserSetOperand() != null ? userSetCommandEntry.getUserSetOperand().getId() : -2);
    } else {
      userSetInteractionEnterOrEditForm.setRemoveUserSetId(userSets.iterator().next().getId());
    }
    if(userSetCommandEntry.getUserSetCommandEntryType().intValue() == 9){
      userSetInteractionEnterOrEditForm.setKeepSharedUserSetId(userSetCommandEntry.getUserSetOperand() != null ? userSetCommandEntry.getUserSetOperand().getId() : -2);
    } else {
      userSetInteractionEnterOrEditForm.setKeepSharedUserSetId(userSets.iterator().next().getId());
    }
    if(userSetCommandEntry.getUserSetCommandEntryType().intValue() == 10){
      userSetInteractionEnterOrEditForm.setDrawFromUserSetId(userSetCommandEntry.getUserSetOperand() != null ? userSetCommandEntry.getUserSetOperand().getId() : -2);
    } else {
      userSetInteractionEnterOrEditForm.setDrawFromUserSetId(userSets.iterator().next().getId());
    }   
   
    Hibernate.initialize(userSets);
    req.getSession().setAttribute("userSets", userSets);
    req.getSession().setAttribute("enterOrEdit", "edit");
View Full Code Here

   *      org.apache.struts.action.ActionForm,
   *      javax.servlet.http.HttpServletRequest,
   *      javax.servlet.http.HttpServletResponse)
   */
  public ActionForward modify(ActionMapping mapping, ActionForm form,HttpServletRequest req, HttpServletResponse resp)  {
    UserSetInteractionEnterOrEditForm f = (UserSetInteractionEnterOrEditForm) form;
    long commandEntryId = f.getCommandEntryId();
    CommandEntryManager commandEntryManager = new CommandEntryManager(locale,session);
    CommandEntry commandEntry = commandEntryManager.getCommandEntry(commandEntryId);
    if (commandEntry == null || !(commandEntry instanceof UserSetCommandEntry)){
      throw new InputException(getResources(req).getMessage(locale, "smssvc.editedInteractionDoesNotExistAnymore"))// may have been deleted
    }
    UserSetCommandEntry userSetCommandEntry = (UserSetCommandEntry)commandEntry;
    checkAccessRights(req, userSetCommandEntry.getGroup());
    commandEntryManager.evict(userSetCommandEntry)// do not modify in this session yet (might be erroneous)
   
    UserSetManager userSetManager = new UserSetManager(locale,session);
    UserSet userSet = f.getUserSetId() == -2 ? null : userSetManager.getUserSet(f.getUserSetId());
    if (f.getUserSetId() != -2
      && (userSet == null || userSet.getGroup() != userSetCommandEntry.getGroup())) {
      throw new InputException(getResources(req).getMessage(locale, "smssvc.selectedUserSetDoesNotExistAnymore"))// may have been deleted
    }

    userSetCommandEntry.setSortLabel(f.getSortLabel());
    userSetCommandEntry.setUserSet(userSet);
    userSetCommandEntry.setCurrentUserSetAsTarget(f.getUserSetId() == -2 ? 1 : 0);
    userSetCommandEntry.setUserSetCommandEntryType(f.getCommandType());
    if(f.getNofUsers() != null && !f.getNofUsers().equals("")){
      userSetCommandEntry.setNofUsers(Integer.parseInt(f.getNofUsers()));
    } else {
      userSetCommandEntry.setNofUsers(0);
    }

    setUserSetOperand(userSetCommandEntry, f);
View Full Code Here

   *      org.apache.struts.action.ActionForm,
   *      javax.servlet.http.HttpServletRequest,
   *      javax.servlet.http.HttpServletResponse)
   */
  public ActionForward create(ActionMapping mapping, ActionForm form,HttpServletRequest req, HttpServletResponse resp)  {
    UserSetInteractionEnterOrEditForm f = (UserSetInteractionEnterOrEditForm) form;
    Group group = groupFromSession(req);
    checkAccessRights(req, group);
    UserSetManager userSetManager = new UserSetManager(locale,session);
    UserSet userSet = f.getUserSetId() == -2 ? null : userSetManager.getUserSet(f.getUserSetId());
    if (f.getUserSetId() != -2
      && (userSet == null || userSet.getGroup() != group)) {
      throw new InputException(getResources(req).getMessage(locale, "smssvc.selectedUserSetDoesNotExistAnymore"))// may have been deleted
    }
    UserSetCommandEntry userSetCommandEntry = new UserSetCommandEntry();
    userSetCommandEntry.setSortLabel(f.getSortLabel());
    userSetCommandEntry.setGroup(group);
    userSetCommandEntry.setUserSet(userSet);
    userSetCommandEntry.setCurrentUserSetAsTarget(f.getUserSetId() == -2 ? 1 : 0);
    userSetCommandEntry.setUserSetCommandEntryType(f.getCommandType());
    if(f.getNofUsers() != null && !f.getNofUsers().equals("")){
      userSetCommandEntry.setNofUsers(Integer.parseInt(f.getNofUsers()));
    } else {
      userSetCommandEntry.setNofUsers(null);
    }

    setUserSetOperand(userSetCommandEntry, f);
View Full Code Here

TOP

Related Classes of evolaris.platform.smssvc.web.form.UserSetInteractionEnterOrEditForm

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.