Package org.opencustomer.db.vo.system

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


public final class DeleteAction extends org.opencustomer.framework.webapp.action.DeleteAction {
    private static Logger log = Logger.getLogger(DeleteAction.class);

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

        if (log.isDebugEnabled())
            log.debug("delete list configuration (ID:" + listConfiguration.getId() + ")");

        try {
            new ListConfigurationDAO().delete(listConfiguration);
           
            PanelStack stack = Panel.getPanelStack(request);
View Full Code Here


public class SaveAction extends EditSaveAction {
    private static Logger log = Logger.getLogger(SaveAction.class);

    @Override
    protected void saveEntity(EditPanel panel, ActionMessages errors, HttpServletRequest request) {
        ListConfigurationVO listConfiguration = (ListConfigurationVO) panel.getEntity();

        try {
            ListConfigurationDAO dao = new ListConfigurationDAO();
            HibernateContext.beginTransaction();
           
            if(listConfiguration.isDefault())
                dao.resetDefaultValue(listConfiguration.getType(), (listConfiguration.getUser() == null));
           
            if (listConfiguration.getId() == null) {
                if (log.isDebugEnabled())
                    log.debug("create list configuration");
                dao.insert(listConfiguration);
            } else {
                if (log.isDebugEnabled())
                    log.debug("save list configuration (ID:" + listConfiguration.getId() + ")");
                dao.update(listConfiguration);
            }
           
            HibernateContext.commitTransaction();
           
View Full Code Here

    }
   
    @Override
    protected boolean validateData(EditPanel panel, ActionMessages errors, HttpServletRequest request) {
        UserVO user                           = (UserVO)request.getSession().getAttribute(Globals.USER_KEY);
        ListConfigurationVO listConfiguration = (ListConfigurationVO) panel.getEntity();
       
        if (listConfiguration.getName() != null) {
            try {
                ListConfigurationDAO dao = new ListConfigurationDAO();

                ListConfigurationVO editListConfiguration = null;
                if(listConfiguration.getUser() == null)
                    editListConfiguration = dao.getForSystemByTypeAndName(listConfiguration.getType(), listConfiguration.getName());
                else
                    editListConfiguration = dao.getForUserByTypeAndName(listConfiguration.getType(), listConfiguration.getName(), user);
               
                if (editListConfiguration != null && !editListConfiguration.getId().equals(listConfiguration.getId())) {
                    errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("module.system.list.error.nameExists"));
                }

                HibernateContext.getSession().evict(editListConfiguration);
            } 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
    {
        ListConfigurationVO listConfiguration = (ListConfigurationVO)attributes.get("listConfiguration");
        String name = "list";
       
        if(log.isDebugEnabled())
            log.debug("listConfiguration (in panel): "+listConfiguration);
       
        EditPanel panel = null;
        if(listConfiguration.getUser() == null) {
            panel = new EditPanel(Right.ADMINISTRATION_LIST_GLOBALLIST, listConfiguration);
        } else {
            panel = new EditPanel(Right.ADMINISTRATION_LIST_WRITE, listConfiguration);
        }
       
        if(listConfiguration.getId() == null)
            panel.setTitle(MessageUtil.message(request, "module.system.list.create.title"));
        else {
            panel.setTitle(MessageUtil.message(request, "module.system.list.edit.title", listConfiguration.getName()));

            panel.setAttribute(DeleteAction.TEXT_TITLE, MessageUtil.message(request, "module.system.list.delete.title", listConfiguration.getName()));
            panel.setAttribute(DeleteAction.TEXT_QUESTION, MessageUtil.message(request, "module.system.list.delete.question", listConfiguration.getName()));
        }
       
        panel.addAction(Action.Type.DELETE, "/system/settings/"+name+"/delete");
        panel.addAction(Action.Type.SAVE, "/system/settings/"+name+"/save");
       
View Full Code Here

    public void loadEntity(ActionMessages errors, LoadForm form, Hashtable<String, Object> attributes, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
        if (log.isDebugEnabled())
            log.debug("load list configuration (ID:" + form.getId() + ")");

        try {
            ListConfigurationVO listConfiguration = new ListConfigurationDAO().getById(form.getId());
            attributes.put("listConfiguration", listConfiguration);
        } catch (HibernateException e) {
            errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("default.error.invalidEntity", new Integer(form.getId())));

            log.debug("problems loading list configuration (ID:" + form.getId() + ")");
View Full Code Here

        if (log.isDebugEnabled())
            log.debug("create list configuration (type:"+attributes.get("defaultType")+")");

        UserVO user   = (UserVO)request.getSession().getAttribute(Globals.USER_KEY);
       
        ListConfigurationVO listConfiguration = new ListConfigurationVO();
       
        ListConfigurationVO.Type type = (ListConfigurationVO.Type)attributes.get("defaultType");
       
        listConfiguration.setType((ListConfigurationVO.Type)attributes.get("defaultType"));
        listConfiguration.setUser(user);
       
        attributes.put("listConfiguration", listConfiguration);
    }
View Full Code Here

   
    private boolean isDefault;
   
    @Override
    public void validate(ActionMapping mapping, ActionMessages errors, HttpServletRequest request) {
        ListConfigurationVO listConfiguration = (ListConfigurationVO)getPanel().getEntity();
       
        name        = FormUtility.adjustParameter(name, 255);
        description = FormUtility.adjustParameter(description);
       
        if (name == null)
View Full Code Here

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

        listConfiguration.setName(form.getName());
        listConfiguration.setDescription(form.getDescription());
        if(AuthenticatorUtility.getInstance().authenticate(request, Right.ADMINISTRATION_LIST_GLOBALLIST)) {
            if(form.isGlobal())
                listConfiguration.setUser(null);
            else
                listConfiguration.setUser(user);
        }
        listConfiguration.setDefault(form.isDefault());
    }
View Full Code Here

    }
   
    @Override
    public void writeForm(PageStandardForm form, ActionMessages errors, HttpServletRequest request)
    {
        ListConfigurationVO listConfiguration = (ListConfigurationVO) getPanel().getEntity();

        form.setName(listConfiguration.getName());
        form.setDescription(listConfiguration.getDescription());
        if(listConfiguration.getUser() == null)
            form.setGlobal(true);
        else
            form.setGlobal(false);
        form.setDefault(listConfiguration.isDefault());
    }
View Full Code Here

public class PageColumnsAction extends EditPageAction<PageColumnsForm> {
    private static Logger log = Logger.getLogger(PageColumnsAction.class);

    @Override
    public void readForm(PageColumnsForm form, ActionMessages errors, HttpServletRequest request) {
        ListConfigurationVO listConfiguration = (ListConfigurationVO) getPanel().getEntity();
       
        if(form.getPositions().isEmpty()) {
            listConfiguration.setColumns(null);
        } else {
            ArrayList<Integer> positions = new ArrayList<Integer>();
            for(String value : form.getPositions().values()) {
                positions.add(Integer.valueOf(value));
            }
            Collections.sort(positions);
           
            Integer[] columns = new Integer[positions.size()];
            for(int i=0; i<columns.length; i++) {
                Integer position = positions.get(i);
                for(int column : form.getPositions().keySet()) {
                    if(position.toString().equals(form.getPositions().get(column))) {
                        columns[i] = column;
                        break;
                    }
                }
            }
           
            listConfiguration.setColumns(columns);
        }
    }
View Full Code Here

TOP

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

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.