Package org.woped.editor.controller

Examples of org.woped.editor.controller.Role


           
            if (lm.allCompoundRoles.size() == 1) {
              boolean unrelatedRole = false;
              Iterator<?> it = lm.allRoles.iterator();
              while (it.hasNext()) {
                Role currentRole = (Role) it.next();
                Iterator<?> subit = currentRole.ancestors.iterator();
                while (subit.hasNext()) {
                  CompoundRole currentCompound = (CompoundRole) subit.next();
                  if (currentCompound.name == "") {
                    unrelatedRole = true;
                    break;
                  }
                }
                if (unrelatedRole == true ) {
                  break;
                }
              }
              if (unrelatedRole == true) {
                CompoundRole allRoles = new CompoundRole(Messages.getString("PetriNet.Resources.AllCompoundRolesName"));
                allRoles.children.addAll(lm.allRoles);
                it = lm.allRoles.iterator();
                while (it.hasNext()) {
                  Role currentRole = (Role) it.next();
                  currentRole.ancestors.add(allRoles);
                }
                lm.allCompoundRoles.add(allRoles);
              }
            }
           
            else if (lm.allCompoundRoles.size() == 0) {
              CompoundRole cr = new CompoundRole(Messages.getString("PetriNet.Resources.DefaultCompoundRoleName"));
              cr.children.addAll(lm.allRoles);
              Iterator<?> it = lm.allRoles.iterator();
              while (it.hasNext()) {
                Role currentRole = (Role) it.next();
                currentRole.ancestors.add(cr);
              }
              lm.allCompoundRoles.add(cr);
            }
         
            else {
              CompoundRole allRoles = new CompoundRole(Messages.getString("PetriNet.Resources.AllCompoundRolesName"));
              allRoles.children.addAll(lm.allRoles);
              Iterator<?> it = lm.allRoles.iterator();
              while (it.hasNext()) {
                Role currentRole = (Role) it.next();
                currentRole.ancestors.add(allRoles);
              }
              lm.allCompoundRoles.add(allRoles);
            }
         
View Full Code Here


           }
          
           //Get Roles
           for(int j =0; j <  RolesTreeModel.getChildCount(RolesTopNode);j++){
                   String currentRoleName = RolesTreeModel.getChild(RolesTopNode, j).toString();
                   Role currentRole = new Role(currentRoleName);
                   allRoles.add(currentRole);
                  
                   RolesTreeNode currentNode = (RolesTreeNode) RolesTreeModel.getChild(RolesTopNode, j);
                 
                   // find all children of currentRole and assign them to the Role
                   for(int i =0; i <  RolesTreeModel.getChildCount(currentNode);i++){
                         String currentComponentName = (String) RolesTreeModel.getChild(currentNode, i).toString();
                        
                         if (allAssignedComponents.size() != 0) {
                           Iterator<?> it = allAssignedComponents.iterator();
                           while (it.hasNext()) {
                             Component currentComponent = (Component) it.next();
                             if (currentComponent.name.equals( currentComponentName)) {
                               currentRole.addChild(currentComponent);
                               currentComponent.addAncestorRole(currentRole);
                             }
                           }
                         }
                   }
                  
                  
                }
          
          //Get Groups
           for(int j =0; j <  GroupsTreeModel.getChildCount(GroupsTopNode);j++){
                   String currentGroupName = GroupsTreeModel.getChild(GroupsTopNode, j).toString();
                   Group currentGroup = new Group(currentGroupName);
                   allGroups.add(currentGroup);
                  
                   GroupsTreeNode currentNode = (GroupsTreeNode) GroupsTreeModel.getChild(GroupsTopNode, j);
                 
                   // find all children of currentGroup and assign them to the Role
                   for(int i =0; i <  GroupsTreeModel.getChildCount(currentNode);i++){
                         String currentComponentName = (String) GroupsTreeModel.getChild(currentNode, i).toString();
                        
                         if (allAssignedComponents.size() != 0) {
                           Iterator<?> it = allAssignedComponents.iterator();
                           while (it.hasNext()) {
                             Component currentComponent = (Component) it.next();
                             if (currentComponent.name.equals(currentComponentName)) {
                               currentGroup.addChild(currentComponent);
                               currentComponent.addAncestorGroup(currentGroup);
                             }
                           }
                         }
                   }
                  
                  
                }
          
           //Get Compound Roles
           for(int j =0; j <  superRolesTreeModel.getChildCount(superRolesTopNode);j++){
                   String currentSuperRoleName = superRolesTreeModel.getChild(superRolesTopNode, j).toString();
                   CompoundRole currentSuperRole = new CompoundRole(currentSuperRoleName);
                   allCompoundRoles.add(currentSuperRole);
                  
                   SuperRolesTreeNode currentNode = (SuperRolesTreeNode) superRolesTreeModel.getChild(superRolesTopNode, j);
                 
                   // Get all Children of each Compound Role Branches
                   for(int i =0; i <  superRolesTreeModel.getChildCount(currentNode);i++){
                         String currentRoleName = (String) superRolesTreeModel.getChild(currentNode, i).toString();
                        
                         for (int t=0;t<allRoles.size();t++) {
                          
                           Iterator<?> it = allRoles.iterator();
                           while (it.hasNext()) {
                             Role currentRole = (Role) it.next();
                             if (currentRoleName.equals(currentRole.name)) {
                               currentRole.addAncestor(currentSuperRole);
                               currentSuperRole.addRole(currentRole);
                             }
                           }
                         }
                   }
              }
          
          //Get Compound Groups
           for(int j =0; j <  superGroupsTreeModel.getChildCount(superGroupsTopNode);j++){
                   String currentSuperGroupName = superGroupsTreeModel.getChild(superGroupsTopNode, j).toString();
                   CompoundGroup currentSuperGroup = new CompoundGroup(currentSuperGroupName);
                   allCompoundGroups.add(currentSuperGroup);
                  
                   SuperGroupsTreeNode currentNode = (SuperGroupsTreeNode) superGroupsTreeModel.getChild(superGroupsTopNode, j);
                 
                   // Get all Children of each Compound Group Branches
                   for(int i =0; i <  superGroupsTreeModel.getChildCount(currentNode);i++){
                         String currentGroupName = (String) superGroupsTreeModel.getChild(currentNode, i).toString();
                           
                           Iterator<?> it = allGroups.iterator();
                           while (it.hasNext()) {
                             Group currentGroup = (Group) it.next();
                             if (currentGroupName.equals(currentGroup.name)) {
                               currentGroup.addAncestor(currentSuperGroup);
                               currentSuperGroup.addGroup(currentGroup);
                             }
                           }
                   }
              }
          
           //Fill empty sets
           Iterator<?> it = allAssignedComponents.iterator();
           while (it.hasNext()) {
             Component currentComponent = (Component) it.next();
             if (currentComponent.roleAncestor.size() == 0) {
               currentComponent.addAncestorRole(new Role(""));
             }
           }
          
           it = allGroups.iterator();
           while (it.hasNext()) {
             Group currentGroup = (Group) it.next();
             if (currentGroup.children.size() == 0) {
               currentGroup.addChild(new Component(""));
             }
             if (currentGroup.ancestors.size() == 0) {
               currentGroup.addAncestor(new CompoundGroup(""));
             }
           }
          
           it = allRoles.iterator();
           while (it.hasNext()) {
             Role currentRole = (Role) it.next();
             if (currentRole.children.size() == 0) {
               currentRole.addChild(new Component(""));
             }
             if (currentRole.ancestors.size() == 0) {
               currentRole.addAncestor(new CompoundRole(""));
             }
           }
        }
View Full Code Here

TOP

Related Classes of org.woped.editor.controller.Role

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.