Package org.opencustomer.db.vo.system

Examples of org.opencustomer.db.vo.system.UsergroupVO


    public UsergroupVO getByName(String name)
    {
        String _name = toLower(adjustWildcards(name));

        UsergroupVO usergroup = null;

        try
        {
            StringBuilder hql = new StringBuilder();
            hql.append(" FROM ").append(getEntityClass().getName()).append(" e ");
View Full Code Here


            return Panel.getForward(getPanel().getAction(Action.Type.SAVE).getAction(), request);
        } else if (form.getDoJumpUsergroup().isSelected()) {
            if(log.isDebugEnabled())
                log.debug("jump to usergroup");
           
            UsergroupVO usergroup = ((RoleVO)getPanel().getEntity()).getDefaultUsergroup();
           
            request.setAttribute("external_usergroup_id", usergroup.getId());
           
            return Panel.getForward(getPanel().getAction(Action.Type.SAVE).getAction(), request);
        } else {
            if(log.isDebugEnabled())
                log.debug("no custom action found");
View Full Code Here

    private static Logger log = Logger.getLogger(DeleteAction.class);

    @Override
    protected void deleteEntity(DeletePanel panel, HttpServletRequest request, HttpServletResponse response, ActionMessages errors)
    {
        UsergroupVO usergroup = (UsergroupVO) panel.getEntity();

        if (log.isDebugEnabled())
            log.debug("delete usergroup (ID:" + usergroup.getId() + ")");

        try
        {
            new UsergroupDAO().delete(usergroup);
        }
View Full Code Here

    private static Logger log = Logger.getLogger(SaveAction.class);

    @Override
    protected void saveEntity(EditPanel panel, ActionMessages errors, HttpServletRequest request)
    {
        UsergroupVO usergroup = (UsergroupVO) panel.getEntity();
        UserVO activeUser = (UserVO) request.getSession().getAttribute(Globals.USER_KEY);

        try
        {
            UsergroupDAO dao = new UsergroupDAO();
            if (usergroup.getId() == null)
            {
                if (log.isDebugEnabled())
                    log.debug("create usergroup");
                dao.insert(usergroup, activeUser);
            }
            else
            {
                if (log.isDebugEnabled())
                    log.debug("save usergroup (ID:" + usergroup.getId() + ")");
                dao.update(usergroup, activeUser);
            }
        }
        catch (HibernateException e)
        {
View Full Code Here

    }
   
    @Override
    protected boolean validateData(EditPanel panel, ActionMessages errors, HttpServletRequest request)
    {
        UsergroupVO usergroup = (UsergroupVO) panel.getEntity();

        if (usergroup.getName() != null)
        {
            try
            {
                UsergroupDAO dao = new UsergroupDAO();

                UsergroupVO editUsergroup = dao.getByName(usergroup.getName());
                if (editUsergroup != null && !editUsergroup.getId().equals(usergroup.getId())) {
                    if(editUsergroup.isAdmin())
                        errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("module.system.usergroup.block.error.nameExistsInAdmin"));
                    else
                        errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("module.system.usergroup.block.error.nameExists"));
                }
View Full Code Here

        try
        {
            UserVO user = (UserVO) panel.getEntity();

            UsergroupVO usergroup = new UsergroupDAO().getById(form.getId());
           
            if (user.getProfile().getLdapGroup() == null && !user.getProfile().getUsergroups().contains(usergroup))
                user.getProfile().getUsergroups().add(usergroup);
        }
        catch (HibernateException e)
View Full Code Here

    private static Logger log = Logger.getLogger(LoadAction.class);

    @Override
    public EditPanel createPanel(ActionMessages errors, LoadForm form, Hashtable<String, Object> attributes, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
    {
        UsergroupVO usergroup = (UsergroupVO)attributes.get("usergroup");
        List<UserVO> users = (List<UserVO>)attributes.get("users");
        List<RoleVO> roles = (List<RoleVO>)attributes.get("roles");

        boolean deletable = false;
        if(users.isEmpty() && roles.isEmpty())
            deletable = true;

        EditPanel panel = new EditPanel(Right.ADMINISTRATION_USERGROUP_WRITE, usergroup);
       
        if(usergroup.getId() == null)
            panel.setTitle(MessageUtil.message(request, "module.system.usergroup.headLine.create"));
        else
        {
            panel.setTitle(MessageUtil.message(request, "module.system.usergroup.headLine.edit", usergroup.getName()));

            panel.setAttribute(DeleteAction.TEXT_TITLE, MessageUtil.message(request, "module.system.usergroup.delete.headLine", usergroup.getName()));
            panel.setAttribute(DeleteAction.TEXT_QUESTION, MessageUtil.message(request, "module.system.usergroup.delete.question", usergroup.getName()));
        }
       
        panel.addAction(Action.Type.DELETE, "/system/management/usergroup/delete", deletable);
        panel.addAction(Action.Type.SAVE, "/system/management/usergroup/save");
       
View Full Code Here

        if (log.isDebugEnabled())
            log.debug("load usergroup (ID:" + form.getId() + ")");

        try
        {
            UsergroupVO usergroup = new UsergroupDAO().getById(form.getId());

            attributes.put("usergroup", usergroup);
            attributes.put("users", new UserDAO().getForUsergroup(usergroup));
            attributes.put("roles", new RoleDAO().getForDefaultUsergroup(usergroup));
        }
View Full Code Here

    @Override
    public void createEntity(ActionMessages errors, LoadForm form, Hashtable<String, Object> attributes, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
    {
        UserVO activeUser = (UserVO) request.getSession().getAttribute(Globals.USER_KEY);

        UsergroupVO usergroup = new UsergroupVO();
       
        usergroup.setAccessUser(EntityAccess.Access.WRITE_SYSTEM);
        usergroup.setOwnerUser(activeUser.getId());
        usergroup.setAccessGroup(EntityAccess.Access.NONE);
        usergroup.setOwnerGroup(activeUser.getProfile().getDefaultUsergroup().getId());
        usergroup.setAccessGlobal(EntityAccess.Access.WRITE_SYSTEM);

        attributes.put("usergroup", usergroup);
        attributes.put("users", new ArrayList<UserVO>());
        attributes.put("roles", new ArrayList<RoleVO>());
    }
View Full Code Here

    @Override
    public void readForm(PageStandardForm form, ActionMessages errors, HttpServletRequest request)
    {
        UserVO activeUser     = (UserVO) request.getSession().getAttribute(Globals.USER_KEY);
        UsergroupVO usergroup = (UsergroupVO) getPanel().getEntity();

        usergroup.setName(form.getName());
        if(usergroup.getId() == null && activeUser.getProfile().getRole().isAdmin())
            usergroup.setAdmin(form.isAdmin());
    }
View Full Code Here

TOP

Related Classes of org.opencustomer.db.vo.system.UsergroupVO

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.