Exemplo n.º 1
0
 @Override
 public synchronized int getGroupCount() {
   // in addition to the real folders returned by the /reader/feeds API, there are virtual folders
   // for global shared stories, social feeds and saved stories
   if (activeFolderNames == null) return 0;
   // two types of group (folder and All Stories are represented as folders, and don't count, so
   // -2)
   return (activeFolderNames.size() + (GroupType.values().length - 2));
 }
Exemplo n.º 2
0
 /**
  * Add an <code>Attribute</code> to a <code>GroupType</code>.
  *
  * <p>
  *
  * @param i BeanShell interpreter.
  * @param stack BeanShell call stack.
  * @param type Add to this <code>GroupType</code>.
  * @param name Name of <code>Attribute</code>.
  * @param read <code>Privilege</code> required for reading.
  * @param write <code>Privilege</code> required for writing.
  * @param req Is <code>Attribute</code> required.
  * @return <code>Field</code>
  * @throws GrouperShellException
  * @since 0.1.0
  */
 public static Field invoke(
     Interpreter i,
     CallStack stack,
     String type,
     String name,
     Privilege read,
     Privilege write,
     boolean req)
     throws GrouperShellException {
   GrouperShell.setOurCommand(i, true);
   try {
     GrouperSession s = GrouperShell.getSession(i);
     GroupType t = GroupTypeFinder.find(type);
     return t.addAttribute(s, name, read, write, req);
   } catch (InsufficientPrivilegeException eIP) {
     GrouperShell.error(i, eIP);
   } catch (SchemaException eS) {
     GrouperShell.error(i, eS);
   }
   throw new GrouperShellException(E.TYPE_ADDATTR + name);
 } // public static Field invoke(i, stack, type, name, read, write, req)
Exemplo n.º 3
0
 static Grouping restoreFrom(String saved) {
   if (saved == null || saved.length() == 0) {
     return createDefault();
   }
   StringTokenizer st = new StringTokenizer(saved, "[] ,", false);
   List<GroupType> types = new ArrayList<GroupType>();
   while (st.hasMoreTokens()) {
     GroupType type = GroupType.getType(st.nextToken());
     types.add(type);
   }
   if (types.isEmpty()) {
     return createDefault();
   }
   return createFrom(types);
 }
Exemplo n.º 4
0
 public void loadGroups() {
   try {
     File groupFile = new File("groups.txt");
     if (groupFile.exists()) {
       BufferedReader br = new BufferedReader(new FileReader("groups.txt"));
       List<String> groupStrings = new ArrayList<String>();
       while (true) {
         String s = br.readLine();
         if (s != null) {
           groupStrings.add(s);
         } else {
           break;
         }
       }
       for (String s : groupStrings) {
         String[] info = s.split(":");
         Group g = new Group(info[0], info[2], GroupType.toGroupType(info[1]));
         if (!info[3].equals("null")) {
           g.street = info[3];
         }
         if (!info[4].equals("null")) {
           g.playground = Playground.getPlayground(info[4]);
         }
         g.players = Integer.parseInt(info[5]);
         for (int i = 6; i < info.length; i++) {
           for (Modifier[] array : g.validModifiers) {
             for (Modifier m : array) {
               for (String s2 : m.searchText) {
                 if (s2.equalsIgnoreCase(info[i])) {
                   g.modifiers.add(m);
                   break;
                 }
               }
             }
           }
         }
         groups.add(g);
       }
       br.close();
       groupFile.delete();
     }
   } catch (IOException ex) {
   }
 }
 public void fromRaw(final RawDimensionalBagPermissionGroupEntry raw) {
   this.m_groupType = GroupType.valueOf(raw.groupType);
   this.m_rights = raw.rights;
 }
Exemplo n.º 6
0
  public GroupTracker() {
    super();
    setName("GroupTracker");
    setLogin("GroupTracker");
    for (String s : presetOps) {
      ops.add(s);
    }

    Group.gagTrainingMods.add(
        new Modifier[] {
          new Modifier("Toonup", false),
          new Modifier("Trap", false),
          new Modifier("Lure", false),
          new Modifier("Sound", false),
          new Modifier("Throw", false),
          new Modifier("Squirt", false),
          new Modifier("Drop", false)
        });

    Group.buildingMods.add(
        new Modifier[] {
          new Modifier("1 story", new String[] {"1", "one"}),
          new Modifier("2 story", new String[] {"2", "two"}),
          new Modifier("3 story", new String[] {"3", "three"}),
          new Modifier("4 story", new String[] {"4", "four"}),
          new Modifier("5 story", new String[] {"5", "five"})
        });
    Group.buildingMods.add(
        new Modifier[] {
          new Modifier("Sellbot", new String[] {"Sell"}),
          new Modifier("Cashbot", new String[] {"Cash"}),
          new Modifier("Lawbot", new String[] {"Law"}),
          new Modifier("Bossbot")
        });

    Group.fieldOfficeMods.add(
        new Modifier[] {
          new Modifier("Sellbot", new String[] {"Sell"}),
          new Modifier("Cashbot", new String[] {"Cash"}),
          new Modifier("Lawbot", new String[] {"Law"}),
          new Modifier("Bossbot")
        });

    Group.factoryMods.add(
        new Modifier[] {
          new Modifier("Front", false), new Modifier("Side", false), new Modifier("Brutal", false)
        });
    Group.factoryMods.add(
        new Modifier[] {
          new Modifier("Short", false), new Modifier("Long", false), new Modifier("Hybrid", false)
        });

    Group.mintMods.add(
        new Modifier[] {
          new Modifier("Coin", false), new Modifier("Dollar", false), new Modifier("Bullion", false)
        });

    Group.daOfficeMods.add(
        new Modifier[] {
          new Modifier("A", false).pos(ModifierPos.BACK),
          new Modifier("B", false).pos(ModifierPos.BACK),
          new Modifier("C", false).pos(ModifierPos.BACK),
          new Modifier("D", false).pos(ModifierPos.BACK)
        });

    Group.cogGolfMods.add(
        new Modifier[] {
          new Modifier("Front Three", new String[] {"Front"}),
          new Modifier("Middle Six", new String[] {"Middle"}),
          new Modifier("Back Nine", new String[] {"Back"})
        });

    Group.bossMods.add(
        new Modifier[] {
          new Modifier("SOS Shopping", false, new String[] {"sos", "shopping"}).requires("VP")
        });
    Group.bossMods.add(
        new Modifier[] {new Modifier("Brutal", false, new String[] {"Brutal"}).requires("VP")});
    Group.bossMods.add(
        new Modifier[] {new Modifier("Brutal", false, new String[] {"Brutal"}).requires("CFO")});
    Group.bossMods.add(
        new Modifier[] {
          new Modifier("VP"), new Modifier("CFO"), new Modifier("CJ"), new Modifier("CEO")
        });

    List<String> words = new ArrayList<String>();
    for (GroupType g : GroupType.getAllGroupTypes()) {
      for (String s : g.searchText) {
        words.add(s);
      }
    }

    groupWords = words.toArray(new String[words.size()]);

    timer = new Timer(60000, this);
    timer.start();

    self = this;
  }
Exemplo n.º 7
0
 @Override
 public int getGroupTypeCount() {
   return GroupType.values().length;
 }