Package org.jabusuite.core.modules

Examples of org.jabusuite.core.modules.Module


        Query q = manager.createQuery(query);

        List<Module> modules = q.getResultList();
        ArrayList<Module> availableModules = new ArrayList<Module>();
        for (int i = 0; i < modules.size(); i++) {
            Module module = modules.get(i);
            if (user.canRead(module)) {
                availableModules.add(module);
            }
        }
        return availableModules;
View Full Code Here


        }
        return availableModules;
    }
   
    public Module getModuleByName(String moduleName, JbsUser user, JbsCompany company) {
        Module module = null;
        List modules = this.getAllModules(user, null,"a.moduleName LIKE '"+moduleName+"'");
        if ((modules!=null) && (modules.size()>0))
            module=(Module)modules.get(0);
        return module;
    }
View Full Code Here

    }
   
    public void addModulesToXml(Element parentElement, ModuleGroup group) throws FileNotFoundException {
        Iterator<Module> it = group.getModules().iterator();
        while (it.hasNext()) {
            Module module = it.next();
            logger.debug("Adding module "+module.getModuleName()+" to xml");
           
            Element element = new Element("module");
            element.setAttribute("id",String.valueOf(module.getId()));
            element.setAttribute("moduleName",module.getModuleName());
            if (module.getName()!=null)
                element.setAttribute("name",module.getName());
            if (module.getLongName()!=null)
                element.setAttribute("longName",module.getLongName());
            if (module.getDescription()!=null)
                element.setAttribute("description",module.getDescription());
            if (module.getIcon()!=null)
                element.setAttribute("icon",module.getIcon());
            if (module.getClientPanel()!=null)
                element.setAttribute("clientPanel",module.getClientPanel());
           
            Element permissionElement = new Element("permissions");
           
            Element ownerElement = new Element("owner");
            ownerElement.setAttribute("name",module.getOwner().getUserName());
            permissionElement.addContent(ownerElement);
           
            Element groupElement = new Element("group");
            groupElement.setAttribute("name",module.getGroup().getGroupName());
            permissionElement.addContent(groupElement);
           
            Element permElement = new Element("permissions");
            permElement.setAttribute("readUser",String.valueOf(module.isReadUser()));
            permElement.setAttribute("readGroup",String.valueOf(module.isReadGroup()));
            permElement.setAttribute("readOther",String.valueOf(module.isReadOther()));
            permElement.setAttribute("writeUser",String.valueOf(module.isWriteUser()));
            permElement.setAttribute("writeGroup",String.valueOf(module.isWriteGroup()));
            permElement.setAttribute("writeOther",String.valueOf(module.isWriteOther()));
            permissionElement.addContent(permElement);
           
            element.addContent(permissionElement);
           
           
View Full Code Here

        while (it.hasNext()) {
            Element elModule = it.next();
           
            long moduleId = elModule.getAttribute("id").getLongValue();
                   
            Module module = this.findModule(moduleId);
            //If the module doesn't exist then create it:
            if (module==null) {
                module = new Module();
                module.setModuleName(elModule.getAttribute("moduleName").getValue());
                logger.debug("Creating module "+module.getModuleName());
                if (moduleId>0)
                    module.setId(moduleId);
                module.setName(elModule.getAttribute("name").getValue());
                module.setLongName(elModule.getAttribute("longName").getValue());
                module.setDescription(elModule.getAttribute("description").getValue());
                module.setIcon(elModule.getAttribute("icon").getValue());
                module.setClientPanel(elModule.getAttribute("clientPanel").getValue());
                module.setShowInModuleBar(elModule.getAttribute("showInModuleBar").getBooleanValue());
                module.setModuleGroup(group);
               
               
                Element elPermissions = elModule.getChild("permissions");
                if (elPermissions!=null) {
                    Element elUser = elPermissions.getChild("owner");
                    if (elUser!=null)
                        module.setOwner(userManagement.findUser(elUser.getAttributeValue("name")));
                    Element elUserGroup = elPermissions.getChild("group");
                    if (elUserGroup!=null)
                        module.setGroup(userGroupsManagement.findGroup(elUserGroup.getAttributeValue("name")));
                   
                    Element elPerm = elPermissions.getChild("permissions");
                    if (elPerm!=null) {
                        module.setReadUser(elPerm.getAttribute("readUser").getBooleanValue());
                        module.setReadGroup(elPerm.getAttribute("readGroup").getBooleanValue());
                        module.setReadOther(elPerm.getAttribute("readOther").getBooleanValue());
                        module.setWriteUser(elPerm.getAttribute("writeUser").getBooleanValue());
                        module.setWriteGroup(elPerm.getAttribute("writeGroup").getBooleanValue());
                        module.setWriteOther(elPerm.getAttribute("writeOther").getBooleanValue());
                    }
                }
               
                this.createModule(module);
               
View Full Code Here

        int i = 0;
        if (module!=null) {
            boolean found = false;
            Iterator<Module> it = ((SelModelModule) this.getModel()).getModules().iterator();
            while (it.hasNext() && (!found)) {
                Module exModule = it.next();
               
                if ((exModule!=null) && (exModule.getId() == module.getId())) {
                    found = true;
                } else {
                    i++;
                }
            }
View Full Code Here

        }

        protected void addGroupModules(ModuleGroup group) {
            Iterator<Module> it = group.getModules().iterator();
            while (it.hasNext()) {
                Module module = it.next();
                if (ClientGlobals.getUser().canRead(module)) {
                    this.getModules().add(module);
                }
            } //while
View Full Code Here

    }

    protected void addGroupModules(ModuleGroup group) {
        Iterator<Module> it = group.getModules().iterator();
        while (it.hasNext()) {
            Module module = it.next();
            if (ClientGlobals.getUser().canRead(module) && (module.getShowInModuleBar()))
                addModule(group, module);
        }
    }
View Full Code Here

TOP

Related Classes of org.jabusuite.core.modules.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.