예제 #1
0
파일: Module.java 프로젝트: Timon87/husacct
 public boolean hasSubModule(long id) {
   boolean hasSubModule = false;
   for (Module subModule : subModules) {
     if (subModule.getId() == id || subModule.hasSubModule(id)) {
       hasSubModule = true;
     }
   }
   return hasSubModule;
 }
예제 #2
0
파일: Module.java 프로젝트: Timon87/husacct
 public boolean hasSubModule(String name) {
   boolean hasSubModule = false;
   for (Module subModule : subModules) {
     if (subModule.getName().equals(name) || subModule.hasSubModule(name)) {
       hasSubModule = true;
     }
   }
   return hasSubModule;
 }
 @Override
 public boolean isMapped() {
   boolean isMapped = false;
   ArrayList<Module> modules = SoftwareArchitecture.getInstance().getModules();
   for (Module module : modules) {
     if (module.isMapped()) {
       isMapped = true;
     }
   }
   return isMapped;
 }
예제 #4
0
파일: Module.java 프로젝트: Timon87/husacct
 public boolean isMapped() {
   boolean isMapped = false;
   if (mappedSUunits.size() > 0) {
     isMapped = true;
   }
   for (Module mod : subModules) {
     if (mod.isMapped()) {
       isMapped = true;
     }
   }
   return isMapped;
 }
예제 #5
0
파일: Module.java 프로젝트: Timon87/husacct
 public boolean hasSoftwareUnit(String softwareUnitName) {
   boolean hasSoftwareUnit = false;
   for (SoftwareUnitDefinition unit : mappedSUunits) {
     if (unit.getName().equals(softwareUnitName)) {
       hasSoftwareUnit = true;
     }
   }
   for (Module mod : subModules) {
     if (mod.hasSoftwareUnit(softwareUnitName)) {
       hasSoftwareUnit = true;
     }
   }
   return hasSoftwareUnit;
 }
예제 #6
0
파일: Module.java 프로젝트: Timon87/husacct
 public void removeSubModule(Module subModule) {
   if (subModules.contains(subModule) && this.hasSubModule(subModule.getName())) {
     subModules.remove(subModule);
   } else {
     System.out.println("This sub module does not exist!");
   }
 }
예제 #7
0
파일: Module.java 프로젝트: Timon87/husacct
 // Module
 public void addSubModule(Module subModule) {
   if (!subModules.contains(subModule) && !this.hasSubModule(subModule.getName())) {
     subModules.add(subModule);
   } else {
     System.out.println("This sub module has already been added!");
   }
 }
예제 #8
0
파일: Module.java 프로젝트: Timon87/husacct
 public SoftwareUnitDefinition getSoftwareUnitByName(String softwareUnitName) {
   SoftwareUnitDefinition softwareUnit = null;
   for (SoftwareUnitDefinition unit : mappedSUunits) {
     if (unit.getName().equals(softwareUnitName)) {
       softwareUnit = unit;
     }
   }
   for (Module mod : subModules) {
     if (mod.hasSoftwareUnit(softwareUnitName)) {
       softwareUnit = getSoftwareUnitByName(softwareUnitName);
     }
   }
   if (softwareUnit == null) {
     throw new RuntimeException("This Software Unit does not exist!");
   }
   return softwareUnit;
 }
예제 #9
0
  public Element getModuleInXML(Module module) {
    Element xmlModule = new Element("Module");

    Element moduleType = new Element("type");
    moduleType.addContent(module.getClass().getSimpleName());
    xmlModule.addContent(moduleType);

    Element moduleDescription = new Element("description");
    moduleDescription.addContent(module.getDescription());
    xmlModule.addContent(moduleDescription);

    Element moduleId = new Element("id");
    moduleId.addContent(Long.toString(module.getId()));
    xmlModule.addContent(moduleId);

    Element moduleName = new Element("name");
    moduleName.addContent(module.getName());
    xmlModule.addContent(moduleName);

    /** build extra elements based on type (Module is generic) */
    if (module.getClass().getSimpleName().toLowerCase().equals("layer")) {
      Element moduleLevel = new Element("HierarchicalLevel");
      moduleLevel.addContent("" + ((Layer) module).getHierarchicalLevel());
      xmlModule.addContent(moduleLevel);
    }

    /** Check for units and add them to the XML root of this element */
    if (module.getUnits().size() > 0) {
      Element units = new Element("SoftwareUnitDefinitions");
      for (SoftwareUnitDefinition SUD : module.getUnits()) {
        units.addContent(this.getSoftwareUnitDefinitionInXML(SUD));
      }
      xmlModule.addContent(units);
    }

    /** Check for submodules and add them to the root of the parent (recursive call) */
    if (module.getSubModules().size() > 0) {
      Element subModule = new Element("SubModules");
      for (Module m : module.getSubModules()) {
        subModule.addContent(this.getModuleInXML(m));
      }
      xmlModule.addContent(subModule);
    }

    if (module.getUnits().size() > 0) {
      Element physicalPaths = new Element("PhysicalPaths");

      for (SoftwareUnitDefinition su : module.getUnits()) {
        physicalPaths.addContent(this.getPhysicalPathInXML(su.getName()));
      }

      xmlModule.addContent(physicalPaths);
    }

    return xmlModule;
  }