Пример #1
0
  @Override
  public InputStream getRenderInputStream(
      PresentationType presentationType, List<Artifact> artifacts) throws OseeCoreException {
    InputStream stream = null;
    try {
      if (artifacts.isEmpty()) {
        stream =
            Streams.convertStringToInputStream(
                WordWholeDocumentAttribute.getEmptyDocumentContent(), "UTF-8");
      } else {
        Artifact artifact = artifacts.iterator().next();
        String content =
            artifact.getOrInitializeSoleAttributeValue(CoreAttributeTypes.WholeWordContent);
        if (presentationType == PresentationType.DIFF
            && WordUtil.containsWordAnnotations(content)) {
          throw new OseeStateException(
              "Trying to diff the [%s] artifact on the [%s] branch, which has tracked changes turned on.  All tracked changes must be removed before the artifacts can be compared.",
              artifact.getName(), artifact.getBranch().getName());
        }

        LinkType linkType = LinkType.OSEE_SERVER_LINK;
        content = WordMlLinkHandler.link(linkType, artifact, content);

        String classification = WordRendererUtil.getDataRightsClassification(artifact);
        if (Strings.isValid(classification)) {
          content = addDataRights(content, classification, artifact);
        }

        stream = Streams.convertStringToInputStream(content, "UTF-8");
      }
    } catch (IOException ex) {
      OseeExceptions.wrapAndThrow(ex);
    }
    return stream;
  }
 public void addValid(Artifact artifact) {
   if (artifact == null) {
     needWindow = true;
   } else {
     this.branch = artifact.getBranch();
     this.validArtifacts.add(artifact);
     this.names.add(artifact.getName());
   }
 }
Пример #3
0
 private void recurseAndOpenCoveragePackage(Artifact artifact) throws OseeCoreException {
   if (artifact.isOfType(CoverageArtifactTypes.CoveragePackage)) {
     CoverageEditor.open(new CoverageEditorInput(artifact.getName(), artifact, null, false));
   } else {
     if (artifact.getParent() != null) {
       recurseAndOpenCoveragePackage(artifact.getParent());
     }
   }
 }
 public static Set<Artifact> getEmailGroupsAndUserGroups(User user) throws OseeCoreException {
   Set<Artifact> artifacts = new HashSet<Artifact>();
   for (Artifact art :
       ArtifactQuery.getArtifactListFromType(
           CoreArtifactTypes.UserGroup, BranchManager.getCommonBranch())) {
     // Only add group if have read permissions
     if (!art.getName().equals("Root Artifact")
         && AccessControlManager.hasPermission(art, PermissionEnum.READ)) {
       artifacts.add(art);
     }
   }
   return artifacts;
 }
 public void addInvalidArtifact(Artifact invalidArtifact, String errorMessage) {
   invalidArtifacts.add(invalidArtifact);
   addInvalid(invalidArtifact.getName(), errorMessage);
 }
 private static void processTeam(
     TeamWorkFlowArtifact teamArt,
     String buildId,
     IAttributeType attributeType,
     ICommitConfigArtifact commitConfigArt,
     XResultData rd)
     throws OseeCoreException {
   String rpcrNum = teamArt.getSoleAttributeValue(AtsAttributeTypes.LegacyPcrId, "");
   ChangeData changeData = AtsBranchManager.getChangeData(teamArt, commitConfigArt);
   for (Artifact modArt :
       changeData.getArtifacts(
           KindType.Artifact, ModificationType.NEW, ModificationType.MODIFIED)) {
     List<String> attrStrs = modArt.getAttributesToStringList(attributeType);
     if (attrStrs.isEmpty()) {
       attrStrs.add(EnumeratedAttribute.UNSPECIFIED_VALUE);
     }
     for (String attrStr : attrStrs) {
       rd.addRaw(
           AHTML.addRowMultiColumnTable(
               new String[] {
                 teamArt.getHumanReadableId(),
                 buildId,
                 modArt.getName(),
                 attrStr,
                 rpcrNum,
                 "Content"
               }));
     }
   }
   for (Artifact artChg : changeData.getArtifacts(KindType.Artifact, ModificationType.DELETED)) {
     List<String> attrStrs = artChg.getAttributesToStringList(attributeType);
     if (attrStrs.isEmpty()) {
       attrStrs.add(EnumeratedAttribute.UNSPECIFIED_VALUE);
     }
     for (String attrStr : attrStrs) {
       rd.addRaw(
           AHTML.addRowMultiColumnTable(
               new String[] {
                 teamArt.getHumanReadableId(),
                 buildId,
                 artChg.getName(),
                 attrStr,
                 rpcrNum,
                 "Deleted"
               }));
     }
   }
   for (Artifact artChg :
       changeData.getArtifacts(
           KindType.RelationOnly, ModificationType.NEW, ModificationType.MODIFIED)) {
     List<String> attrStrs = artChg.getAttributesToStringList(attributeType);
     if (attrStrs.isEmpty()) {
       attrStrs.add(EnumeratedAttribute.UNSPECIFIED_VALUE);
     }
     for (String attrStr : attrStrs) {
       rd.addRaw(
           AHTML.addRowMultiColumnTable(
               new String[] {
                 teamArt.getHumanReadableId(),
                 buildId,
                 artChg.getName(),
                 attrStr,
                 rpcrNum,
                 "Relation"
               }));
     }
   }
 }
  private void runClientTest() throws OseeCoreException {
    String title = getName() + " - Destination Client Test";
    resultData.log("Running " + title);
    NewActionJob job = null;
    job =
        new NewActionJob(
            "tt",
            "description",
            ChangeType.Improvement,
            "1",
            null,
            false,
            getActionableItemsByToken(Arrays.asList(atsActionableItem)),
            null,
            null);
    job.setUser(true);
    job.setPriority(Job.LONG);
    job.schedule();
    try {
      job.join();
    } catch (InterruptedException ex) {
      OseeLog.log(Activator.class, Level.SEVERE, ex);
    }

    Artifact actionArt = job.getActionArt();
    resultData.log("Created Action " + actionArt);
    TeamWorkFlowArtifact teamArt = ActionManager.getFirstTeam(actionArt);

    // Make current user assignee for convenience to developer
    teamArt.getStateMgr().addAssignee(AtsClientService.get().getUserAdmin().getCurrentUser());
    teamArt.persist(getClass().getSimpleName());

    validateActionAtStart(actionArt);

    // Wait for destination client to start
    if (!MessageDialog.openConfirm(
        Displays.getActiveShell(),
        getName(),
        "Launch \"Destination Client - Start\" test, enter \""
            + actionArt.getName().replaceFirst("tt ", "")
            + "\" and press Ok")) {
      return;
    }

    int sleepTime = 250;
    makeChanges1(teamArt);
    sleep(sleepTime);
    makeChanges2(teamArt);
    sleep(sleepTime);
    makeChanges3(teamArt);
    sleep(sleepTime);
    makeChanges4(teamArt);
    sleep(sleepTime);
    makeChanges5(teamArt);
    sleep(sleepTime);
    makeChanges6(teamArt);
    sleep(sleepTime);
    makeChanges7(teamArt);
    sleep(sleepTime);

    validateActionAtEnd(actionArt);

    // Wait for destination client to end
    if (!MessageDialog.openConfirm(
        Displays.getActiveShell(),
        getName(),
        "Launch \"Destination Client - End\" test, enter \""
            + actionArt.getName().replaceFirst("tt ", "")
            + "\" and press Ok")) {
      return;
    }

    XResultDataUI.report(resultData, title);
  }