Package org.apdplat.module.module.model

Examples of org.apdplat.module.module.model.Module


           
            if(node.contains("-")){
                try{
                    String[] temp=node.split("-");
                    int id=Integer.parseInt(temp[1]);
                    Module module=moduleService.getModule(id);
                    String json=moduleService.toJsonForEdit(module);
                    Struts2Utils.renderJson(json);
                }catch(Exception e){
                    LOG.error("获取根模块出错",e);
                }
View Full Code Here


                Struts2Utils.renderJson(value);
                return null;
            }
           
            long start=System.currentTimeMillis();
            Module module=null;
            if(node.contains("-")){
                String[] temp=node.split("-");
                int id=Integer.parseInt(temp[1]);
                module=moduleService.getModule(id);
            }else if(node.trim().startsWith("root")){
View Full Code Here

            }
        };
        return toJson(module, filter);
    }
    public String toRootJsonForEdit(){
        Module m=getRootModule();
        if(m==null){
            LOG.error("获取根功能菜单失败!");
            return "";
        }
        StringBuilder json=new StringBuilder();
        json.append("[{'text':'").append(m.getChinese()).append("','id':'module-").append(m.getId()).append("','iconCls':'").append(m.getEnglish()).append("','leaf':false}]");
       
        return json.toString();
    }
View Full Code Here

        //重新装载用户,消除由于不同会话间延迟加载的问题
        user = serviceFacade.retrieve(User.class, user.getId());
        List<Module> userModules = user.getModule();
        Iterator<Module> moduleIterator = modules.iterator();
        while (moduleIterator.hasNext()) {
            Module m = moduleIterator.next();
            //把没有分配给用户的模块去掉
            boolean contains = false;
            for (Module userModule : userModules) {
                if (m.getId() == userModule.getId()) {
                    contains = true;
                    break;
                }
            }
            if (!contains) {
View Full Code Here

     * @param commands
     */
    public void displayControl(List<Module> modules) {
        Iterator<Module> moduleIterator = modules.iterator();
        while (moduleIterator.hasNext()) {
            Module m = moduleIterator.next();
            //去掉隐藏的模块
            if (!m.isDisplay()) {
                moduleIterator.remove();
                continue;
            }
        }
    }
View Full Code Here

        //query是命令
        //user是模块
        //security也是模块
       
        //倒数第一级模块,对以上例子来说,即为user模块
        Module module = command.getModule();
        //获取除了倒数第一级模块之外的模块访问路径表示,对以上例子来说,即为security/
        String modulePath = getModulePath(module.getParentModule());
        //对模块名称进行处理,如:updatePart要转换为update-part,以符合struts2的规则,对以上例子来说,即为user
        String moduleName = PrivilegeUtils.process(module.getEnglish());
        for (String cmd : commands) {
            StringBuilder path = new StringBuilder();
            //模块访问路径+模块名称+"!"+命令 即为浏览器要访问一个命令的完全路径
            //如: /**/security/user!query
            path.append("/**/").append(modulePath).append(moduleName).append("!").append(cmd);
 
View Full Code Here

     * @param stack
     */
    private static void getModules(Module module, Stack<Module> stack) {
        //将当前模块加入堆栈
        stack.push(module);
        Module parent = module.getParentModule();
        //当还有父模块并且父模块不为根模块的时候,把父模块也加入堆栈
        if (parent != null && !"root".equals(parent.getEnglish())) {
            getModules(parent, stack);
        }
    }
View Full Code Here

                InputStream in = null;
                try {
                    URL url=ps.nextElement();
                    LOG.info("找到模块描述文件:"+url.getPath());
                    in = url.openStream();
                    Module root=getRootModule(in);
                    modules.add(root);
                }catch(Exception e)
                {
                    LOG.error("获取根模块出错",e);
                }
View Full Code Here

            LOG.info("注册module.xml文件");
            LOG.info("验证module.xml文件");
            //校验文件
            verifyFile(bin);
            // 解析模块
            Module module=parseModule(xml);
            return module;
        } catch (UnsupportedEncodingException e) {
            LOG.error("获取根模块出错",e);
        }
        return null;
View Full Code Here

        }
        return null;
    }
    private static Module parseModule(String xml) {
        XMLFactory factory=new XMLFactory(Module.class,Command.class);
        Module module=factory.unmarshal(xml);
        //将XML表示的模块转变为JAVA对象表示的模块
        assembleMudule(module);
        return module;
    }
View Full Code Here

TOP

Related Classes of org.apdplat.module.module.model.Module

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.