예제 #1
0
 @Override
 public String getTaskEditorLabel(SearchType searchType) throws OseeCoreException {
   StringBuffer sb = new StringBuffer();
   Collection<IAtsTeamDefinition> teamDefs = getSelectedTeamDefinitions();
   if (teamDefs.size() > 0) {
     sb.append(" - Teams: ");
     sb.append(org.eclipse.osee.framework.jdk.core.util.Collections.toString(",", teamDefs));
   }
   if (getSelectedVersionArtifact() != null) {
     sb.append(" - Version: ");
     sb.append(getSelectedVersionArtifact());
   }
   if (getSelectedGroups().size() > 0) {
     sb.append(" - Groups: ");
     sb.append(Collections.toString(",", getSelectedGroups()));
   }
   if (getSelectedUser() != null) {
     sb.append(" - Assignee: ");
     sb.append(getSelectedUser());
   }
   if (getSelectedState() != null) {
     sb.append(" - State: ");
     sb.append(getSelectedState());
   }
   if (isIncludeCompletedCheckbox() && isIncludeCancelledCheckbox()) {
     sb.append(" - Include Completed/Cancelled");
   }
   if (isIncludeCompletedCheckbox()) {
     sb.append(" - Include Completed");
   }
   if (isIncludeCancelledCheckbox()) {
     sb.append(" - Include Cancelled");
   }
   return Strings.truncate("Tasks" + sb.toString(), TaskEditor.TITLE_MAX_LENGTH, true);
 }
  private void processSoftwareRequirement(ArtifactReadable softwareRequirement, String criticality)
      throws IOException {
    writer.writeCell(
        softwareRequirement.getName(), SafetyReportGenerator.SOFTWARE_REQUIREMENT_INDEX);
    String softwareRequirementDAL =
        writeCriticalityWithDesignCheck(
            softwareRequirement,
            criticality,
            CoreRelationTypes.Requirement_Trace__Higher_Level,
            CoreAttributeTypes.DevelopmentAssuranceLevel);

    writer.writeCell(
        calculateBoeingEquivalentSWQualLevel(
            softwareRequirementDAL,
            softwareRequirement.getAttributeCount(CoreAttributeTypes.Partition)));
    writer.writeCell(functionalCategory);

    writer.writeCell(
        Collections.toString(
            ",", getAttributesToStringList(softwareRequirement, CoreAttributeTypes.Partition)));

    writer.writeCell(
        safetyReport.getComponentUtil().getQualifiedComponentNames(softwareRequirement));
    Collection<String> codeUnits =
        safetyReport.getRequirementToCodeUnitsValues(softwareRequirement);

    if (Conditions.hasValues(codeUnits)) {
      for (String codeUnit : codeUnits) {
        writer.writeCell(codeUnit, SafetyReportGenerator.CODE_UNIT_INDEX);
        writer.endRow();
      }
    } else {
      writer.endRow();
    }
  }
  @Override
  public void run(TableLoadOption... tableLoadOptions) {
    try {
      Set<Artifact> groupOptions = getEmailGroupsAndUserGroups(UserManager.getUser());
      UserGroupsCheckTreeDialog dialog = new UserGroupsCheckTreeDialog(groupOptions);
      dialog.setTitle("Select Groups to Email");
      if (dialog.open() == 0) {

        Set<String> emails = new HashSet<String>();
        for (Artifact artifact : dialog.getSelection()) {
          if (artifact.isOfType(CoreArtifactTypes.UniversalGroup)) {
            for (Artifact userArt :
                artifact.getRelatedArtifacts(CoreRelationTypes.Universal_Grouping__Members)) {
              if (userArt instanceof User) {
                if (!EmailUtil.isEmailValid((User) userArt)) {
                  OseeLog.logf(
                      Activator.class,
                      Level.SEVERE,
                      "Invalid email [%s] for user [%s]; skipping",
                      ((User) userArt).getEmail(),
                      userArt);
                } else if (((User) userArt).isActive()) {
                  emails.add(((User) userArt).getEmail());
                }
              }
            }
          } else if (artifact.isOfType(CoreArtifactTypes.UserGroup)) {
            for (User user :
                artifact.getRelatedArtifacts(CoreRelationTypes.Users_User, User.class)) {
              if (!EmailUtil.isEmailValid(user)) {
                OseeLog.logf(
                    Activator.class,
                    Level.SEVERE,
                    "Invalid email [%s] for user [%s]; skipping",
                    user.getEmail(),
                    user);
              } else if (user.isActive()) {
                emails.add(user.getEmail());
              }
            }
          }
        }
        if (emails.isEmpty()) {
          AWorkbench.popup("Error", "No emails configured.");
          return;
        }
        String emailStr =
            org.eclipse.osee.framework.jdk.core.util.Collections.toString(";", emails);
        if (emailStr.length() > 2048) {
          AWorkbench.popup(
              "Email list too big for auto-open. Emails opened in editor for copy/paste.");
          ResultsEditor.open("Email Addresses", "Email Addresses", emailStr);
        } else {
          Program.launch("mailto:" + emailStr);
        }
        AWorkbench.popup("Complete", "Configured emails openened in local email client.");
      }
    } catch (OseeCoreException ex) {
      OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
    }
  }
예제 #4
0
  @Override
  public String getColumnText(Object element, XViewerColumn xCol, int columnIndex)
      throws OseeCoreException {
    ICoverage coverage = (ICoverage) element;
    if (xCol.equals(CoverageXViewerFactory.Name)) {
      return coverage.getName();
    }
    if (element instanceof MessageCoverageItem) {
      return "";
    }
    if (xCol.equals(CoverageXViewerFactory.Assignees_Col)) {
      if (element instanceof CoverageUnit) {
        return Artifacts.toString(
            "; ", OseeCoverageUnitStore.getAssignees((CoverageUnit) coverage));
      }
      return "";
    }
    if (xCol.equals(CoverageXViewerFactory.Notes_Col)) {
      return coverage.getNotes();
    }
    if (xCol.equals(CoverageXViewerFactory.Coverage_Percent)) {
      return coverage.getCoveragePercentStr();
    }
    if (xCol.equals(CoverageXViewerFactory.Location)) {
      return coverage.getLocation();
    }
    if (xCol.equals(CoverageXViewerFactory.Full_Path)) {
      return CoverageUtil.getFullPath(coverage);
    }
    if (xCol.equals(CoverageXViewerFactory.Namespace)) {
      return coverage.getNamespace();
    }
    if (xCol.equals(CoverageXViewerFactory.Work_Product_Task)) {
      return coverage.getWorkProductTaskStr();
    }
    if (xCol.equals(CoverageXViewerFactory.Guid)) {
      return coverage.getGuid();
    }
    if (xCol.equals(CoverageXViewerFactory.Unit)) {
      String unit = "";
      if (element instanceof CoverageUnit) {
        unit = coverage.getName();
      } else {
        unit = coverage.getParent().getName();
      }

      return unit;
    }
    if (xCol.equals(CoverageXViewerFactory.Lines_Covered)) {
      if (element instanceof CoverageUnit) {
        return String.valueOf(((CoverageUnit) coverage).getCoverageItemsCoveredCount(true));
      }
    }
    if (xCol.equals(CoverageXViewerFactory.Total_Lines)) {
      if (element instanceof CoverageUnit) {
        return String.valueOf(((CoverageUnit) coverage).getCoverageItems(true).size());
      }
    }

    if (coverage instanceof CoverageItem
        || (coverage instanceof MergeItem
            && ((MergeItem) coverage).getImportItem() instanceof CoverageItem)) {
      CoverageItem coverageItem = null;
      if (coverage instanceof CoverageItem) {
        coverageItem = (CoverageItem) coverage;
      } else {
        coverageItem = (CoverageItem) ((MergeItem) coverage).getImportItem();
      }
      if (xCol.equals(CoverageXViewerFactory.Coverage_Rationale)) {
        return coverageItem.getRationale();
      }
      if (xCol.equals(CoverageXViewerFactory.Method_Number)) {
        return coverageItem.getParent().getOrderNumber();
      }
      if (xCol.equals(CoverageXViewerFactory.Execution_Number)) {
        return coverageItem.getOrderNumber();
      }
      if (xCol.equals(CoverageXViewerFactory.Line_Number)) {
        return coverageItem.getLineNumber();
      }
      if (xCol.equals(CoverageXViewerFactory.Coverage_Method)) {
        return coverageItem.getCoverageMethod().getName();
      }
      if (xCol.equals(CoverageXViewerFactory.Parent_Coverage_Unit)) {
        return coverageItem.getCoverageUnit().getName();
      }
      if (xCol.equals(CoverageXViewerFactory.Coverage_Test_Units)) {
        Collection<String> testUnits = coverageItem.getTestUnits();
        if (testUnits == null) {
          return "";
        }
        return Collections.toString(", ", testUnits);
      }
      return "";
    }
    if (coverage instanceof CoverageUnit
        || (coverage instanceof MergeItem
            && ((MergeItem) coverage).getImportItem() instanceof CoverageUnit)) {
      CoverageUnit coverageUnit = null;
      if (coverage instanceof CoverageUnit) {
        coverageUnit = (CoverageUnit) coverage;
      } else if (coverage instanceof MergeItem) {
        coverageUnit = (CoverageUnit) ((MergeItem) coverage).getImportItem();
      }
      if (xCol.equals(CoverageXViewerFactory.Parent_Coverage_Unit)) {
        return coverageUnit.getParentCoverageUnit() == null
            ? ""
            : coverageUnit.getParentCoverageUnit().getName();
      }
      if (xCol.equals(CoverageXViewerFactory.Method_Number)) {
        return coverageUnit.getOrderNumber();
      }
    }
    if (coverage instanceof CoverageItem) {
      CoverageItem coverageItem = (CoverageItem) coverage;
      if (xCol.equals(CoverageXViewerFactory.Parent_Coverage_Unit)) {
        return coverageItem.getParent() == null ? "" : coverageItem.getParent().getName();
      }
      if (xCol.equals(CoverageXViewerFactory.Method_Number)) {
        return coverageItem.getParent() == null ? "" : coverageItem.getParent().getOrderNumber();
      }
      if (xCol.equals(CoverageXViewerFactory.Execution_Number)) {
        return coverageItem.getOrderNumber();
      }
      if (xCol.equals(CoverageXViewerFactory.Coverage_Method)) {
        return coverageItem.getCoverageMethod().getName();
      }
    }
    if (coverage instanceof MergeItem
        && (((MergeItem) coverage).getImportItem() instanceof CoverageItem
            || ((MergeItem) coverage).getPackageItem() instanceof CoverageItem)) {
      MergeItem mergeItem = (MergeItem) coverage;
      ICoverage importItem = mergeItem.getImportItem();
      ICoverage packageItem = mergeItem.getPackageItem();
      if (xCol.equals(CoverageXViewerFactory.Parent_Coverage_Unit)) {
        if (importItem != null && importItem.getParent() != null) {
          return importItem.getParent().getName();
        } else if (packageItem != null && packageItem.getParent() != null) {
          return packageItem.getParent().getName();
        }
        return "";
      }
      if (xCol.equals(CoverageXViewerFactory.Method_Number)) {
        if (importItem != null && importItem.getParent() != null) {
          return importItem.getParent().getOrderNumber();
        } else if (packageItem != null && packageItem.getParent() != null) {
          return packageItem.getParent().getOrderNumber();
        }
        return "";
      }
      if (xCol.equals(CoverageXViewerFactory.Execution_Number)) {
        if (importItem != null) {
          return importItem.getOrderNumber();
        } else if (packageItem != null) {
          return packageItem.getOrderNumber();
        }
        return "";
      }
      if (xCol.equals(CoverageXViewerFactory.Coverage_Method)) {
        if (importItem != null) {
          return ((CoverageItem) importItem).getCoverageMethod().getName();
        } else if (packageItem != null) {
          return ((CoverageItem) packageItem).getCoverageMethod().getName();
        }
        return "";
      }
    }
    return "";
  }
예제 #5
0
 private String asCertString(List<String> certs) {
   return certs != null
       ? org.eclipse.osee.framework.jdk.core.util.Collections.toString(";", certs)
       : null;
 }