Ejemplo n.º 1
0
 /**
  * @param name the public name of the member to be found
  * @param project the project
  * @return the member
  */
 public ProjectMember findDiagramMemberByUniqueName(Project project, String name) {
   name = name + DIAGRAM_SUFFIX;
   Iterator iter = project.getMembers().iterator();
   while (iter.hasNext()) {
     ProjectMember element = (ProjectMember) iter.next();
     if (element instanceof ProjectMemberDiagram) {
       if (name.equals(element.getUniqueDiagramName())) {
         return element;
       }
     }
   }
   return null;
 }
Ejemplo n.º 2
0
 /**
  * Get a MemberFilePersister based on a given ProjectMember.
  *
  * @param pm the project member
  * @return the persister
  */
 protected MemberFilePersister getMemberFilePersister(ProjectMember pm) {
   Class<? extends MemberFilePersister> persister = null;
   if (persistersByClass.containsKey(pm)) {
     persister = persistersByClass.get(pm);
   } else {
     /*
      * TODO: Not sure we need to do this, but just to be safe for now.
      */
     for (Class clazz : persistersByClass.keySet()) {
       if (clazz.isAssignableFrom(pm.getClass())) {
         persister = persistersByClass.get(clazz);
         break;
       }
     }
   }
   if (persister != null) {
     return newPersister(persister);
   }
   return null;
 }