Package org.opencustomer.db.vo.system

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


        }
    }
   
    @Override
    public void writeForm(PageColumnsForm form, ActionMessages errors, HttpServletRequest request) {
        ListConfigurationVO listConfiguration = (ListConfigurationVO) getPanel().getEntity();
       
        if(listConfiguration.getColumns() != null) {
            for(int i=0; i<listConfiguration.getColumns().length; i++) {
                form.setPosition(listConfiguration.getColumns()[i], Integer.toString(i+1));
            }
        }
    }
View Full Code Here


        }
    }

    @Override
    protected void preOperations(PageColumnsForm form, ActionMessages errors, HttpServletRequest request) {
        ListConfigurationVO listConfiguration = (ListConfigurationVO) getPanel().getEntity();
       
        if(getPanel().getAttribute("entities") == null) {
            if(log.isDebugEnabled()) {
                log.debug("add entities for "+listConfiguration.getType());
            }
           
            LinkedHashMap<String, Entity> entities = new LinkedHashMap<String, Entity>();

            Configuration configuration = TableFactory.getInstance().getConfiguration(listConfiguration.getType().getName());
            entities.put(configuration.getEntity().getMessageKey(), new Entity(configuration.getEntity().getMessageKey()));
           
            HashSet<Property> addedProperties = new HashSet<Property>();
           
            for(Property property : configuration.getProperties()) {
View Full Code Here

        return list;
    }
   
    public ListConfigurationVO getForSystemByTypeAndName(ListConfigurationVO.Type type, String name) {
        ListConfigurationVO vo = null;

        StringBuilder hql = new StringBuilder();
        hql.append(" FROM ").append(getEntityClass().getName()).append(" e ");
        hql.append(" WHERE e.user is null ");
        hql.append(" AND e.type = :type ");
View Full Code Here

        return vo;
    }

    public ListConfigurationVO getForUserByTypeAndName(ListConfigurationVO.Type type, String name, UserVO user) {
        ListConfigurationVO vo = null;

        StringBuilder hql = new StringBuilder();
        hql.append(" FROM ").append(getEntityClass().getName()).append(" e ");
        hql.append(" WHERE e.type = :type ");
        hql.append(" AND e.name = :name ");
View Full Code Here

       
        query.executeUpdate();
    }
   
    public ListConfigurationVO getDefaultListConfiguration(ListConfigurationVO.Type type, UserVO user) {
        ListConfigurationVO vo = null;

        StringBuilder hql = new StringBuilder();
        hql.append(" FROM ").append(getEntityClass().getName()).append(" e ");
        hql.append(" WHERE e.type = :type ");
        hql.append(" AND (e.user = :user OR e.user is null)");
View Full Code Here

        final ListConfigurationVO.Type type = getType();
       
        UserVO user            = (UserVO)request.getSession().getAttribute(Globals.USER_KEY);
        UserConfiguration conf = (UserConfiguration)request.getSession().getAttribute(Globals.CONFIGURATION_KEY);
       
        ListConfigurationVO choosenList = (ListConfigurationVO)panel.getAttribute("choosenList");
       
        if(panel.getAttribute("listConfigurations") == null) {
            List<ListConfigurationVO> listConfigurations = new ListConfigurationDAO().getByTypeAndUser(type, user);
            if(!listConfigurations.isEmpty()) {
                ListBean bean = new ListBean();
                for(ListConfigurationVO vo : listConfigurations) {
                    List<ListConfigurationVO> group = bean.getGroups().get(vo.getUser() == null);
                    group.add(vo);
                }
               
                if(!listConfigurations.contains(choosenList)) {
                    if(log.isDebugEnabled())
                        log.debug("list is not yet available: "+choosenList);
                    panel.removeAttribute("choosenList");
                }
               
                panel.setAttribute("listConfigurations", bean);
            }
        }
       
        if(form.getDoChooseList() != null) {
            if(log.isDebugEnabled())
                log.debug("load new list configuration: "+form.getListId());
           
            panel.removeAttribute(TABLE_KEY);
           
            choosenList = new ListConfigurationDAO().getById(form.getListId());

            form.setDoChooseList(null);
        } else if(panel.getAttribute(TABLE_KEY) == null) {
            if(log.isDebugEnabled())
                log.debug("load default configuration: ");
           
            if(choosenList == null)
                choosenList = new ListConfigurationDAO().getDefaultListConfiguration(type, user);
            else
                choosenList = new ListConfigurationDAO().getById(choosenList.getId());
           
            if(choosenList != null)
                form.setListId(choosenList.getId());
        }
       
        if(choosenList != null)
            panel.setAttribute("choosenList", choosenList);
       
        // query database
        Table table = (Table)panel.getAttribute(TABLE_KEY);
        if(table == null) {
            Integer[] columns = null;
            if(choosenList != null)
                columns = choosenList.getColumns();
            table = TableFactory.getInstance().createTable(type.getName(), user, columns);
            table.getPage().setStep(conf.getIntValue(UserConfiguration.Key.LIST_NUMBER_ROWS));
            panel.setAttribute(TABLE_KEY, table);
        }
       
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.