Пример #1
0
 /**
  * Adds an action to the action set.
  *
  * @param action The action
  * @since jEdit 4.0pre1
  */
 public void addAction(E action) {
   actions.put(action.getName(), action);
   if (context != null) {
     context.actionNames = null;
     context.actionHash.put(action.getName(), this);
   }
 } // }}}
Пример #2
0
  public boolean addUserToUserList(E user, boolean isNew) {
    if (!containsPlayer(user.getName())) {
      String key = user.getName().toLowerCase();
      getUsers().put(key, new WeakReference(user));
      userNames.put(key, user.getName());
      if (isNew) {
        getUsersConfig().schedualSave();

        NewZoneUserEvent newZoneUserEvent = new NewZoneUserEvent(this, user);
        Bukkit.getPluginManager().callEvent(newZoneUserEvent);
      }
      return true;
    }
    return false;
  }
Пример #3
0
 /**
  * Called by the base class to add attributes to the meta data.
  *
  * @param metaData the meta data instance receiving the attributes.
  * @param ebXML the ebXML instance containing the attributes.
  */
 protected void addAttributesFromEbXML(C metaData, E ebXML) {
   metaData.setComments(ebXML.getDescription());
   metaData.setTitle(ebXML.getName());
   metaData.setEntryUuid(ebXML.getId());
   metaData.setLogicalUuid(ebXML.getLid());
   metaData.setVersion(ebXML.getVersionInfo());
 }
Пример #4
0
  @Override
  public int add(List<E> entities) throws DatabaseException {
    // pre-processing
    for (E molgenisUser : entities) this.hashPassword(molgenisUser);

    int count = super.add(entities);

    // post-processing
    for (E molgenisUser : entities) {
      List<MolgenisGroup> molgenisGroups =
          getDatabase()
              .find(
                  MolgenisGroup.class,
                  new QueryRule(MolgenisGroup.NAME, Operator.EQUALS, Login.GROUP_USERS_NAME));
      if (molgenisGroups == null || molgenisGroups.isEmpty())
        throw new DatabaseException("missing required user group '" + Login.GROUP_USERS_NAME + "'");
      MolgenisGroup userGroup = molgenisGroups.get(0);

      MolgenisRoleGroupLink molgenisRoleGroupLink = new MolgenisRoleGroupLink();
      molgenisRoleGroupLink.setName(userGroup.getName() + '-' + molgenisUser.getName());
      molgenisRoleGroupLink.setIdentifier(UUID.randomUUID().toString());
      molgenisRoleGroupLink.setRole(molgenisUser);
      molgenisRoleGroupLink.setGroup(userGroup);
      getDatabase().add(molgenisRoleGroupLink);
    }

    return count;
  }
Пример #5
0
 /** get edge by name and type */
 public E findEdge(String Name, EdgeType Type) {
   for (E u : this.getEdges()) {
     if ((u.getName().toUpperCase().equals(Name.toUpperCase()) && u.getType() == Type)) {
       return u;
     }
   }
   return null;
 }
 @Override
 protected String getRelativePath(S container, E entry) {
   String name = entry.getName();
   if (entry.isDirectory()) {
     // strip trailing slash from directory entries
     return "/" + name.substring(0, name.length() - 1);
   } else {
     return "/" + name;
   }
 }
Пример #7
0
 /**
  * Map entity's name -> entity object. A lot of logic code does filtering of data from 2 collections by quad
  * iterating over them. Common scenario: entity Parent.name is represent in Child.parentName. given list<Parent>
  * and
  * List<Child> find each Child that have parents in List<Parent> <code>
  * <code>
  * List<Parent> parents = ...
  * List<Child> childs = ...
  * Map<String, Parent> parentsByName = Entities.byName(parents)
  * for (Child c : childs) {
  * if(parents.contatinsKey(c.getParentName())) {
  * doThis();
  * }
  * }
  * }
  * </code>
  *
  * @param entities
  *
  * @return
  */
 public static <E extends Nameable> Map<String, E> entitiesByName(Collection<E> entities) {
   if (entities != null) {
     Map<String, E> map = new HashMap<>();
     for (E e : entities) {
       map.put(e.getName(), e);
     }
     return map;
   } else {
     return Collections.emptyMap();
   }
 }
Пример #8
0
 public static <E extends Nameable> Set<String> objectNames(Collection<E> entities) {
   if (entities != null && !entities.isEmpty()) {
     Set<String> names = new HashSet<>();
     for (E e : entities) {
       if (e != null) {
         names.add(e.getName());
       }
     }
     return names;
   } else {
     return Collections.emptySet();
   }
 }
Пример #9
0
 /** adds edge by HecataeusEdge */
 public boolean addEdge(E Edge) {
   edgeKeys.put(Edge, ++EvolutionGraph._KeyGenerator);
   // add edge to incoming edges of ToNode
   V fromNode = (V) Edge.getFromNode();
   if (fromNode == null || fromNode.getOutEdges() == null) {
     if (fromNode == null) {
       System.out.println(
           "fromNode=NULL!!! on edge: " + Edge.getName() + " to node:" + Edge.getToNode());
     } else {
       System.out.println("86 line: " + fromNode.getName());
     }
   }
   if (!fromNode.getOutEdges().contains(Edge)) fromNode.getOutEdges().add(Edge);
   // add edge to outgoing edges of FromNode
   V toNode = (V) Edge.getToNode();
   if (!toNode.getInEdges().contains(Edge)) toNode.getInEdges().add(Edge);
   return super.addEdge(Edge, fromNode, toNode);
 }
 public void reset() {
   myTitleLabel.setText("'" + myElement.getName() + "' manifest properties:");
   myManifestNotFoundLabel.setText(
       "META-INF/MANIFEST.MF file not found in '" + myElement.getName() + "'");
   updateManifest();
 }