Example #1
0
  @Override
  public boolean handleAltLeftClick(TreeColumn treeColumn, TreeItem treeItem) {
    try {
      if (treeItem.getData() instanceof Artifact) {
        Artifact useArt = (Artifact) treeItem.getData();
        if (useArt.isOfType(AtsArtifactTypes.Action)) {
          if (ActionManager.getTeams(useArt).size() == 1) {
            useArt = ActionManager.getFirstTeam(useArt);
          } else {
            return false;
          }
        }
        if (!(useArt instanceof AbstractWorkflowArtifact)) {
          return false;
        }
        AbstractWorkflowArtifact awa = (AbstractWorkflowArtifact) useArt;
        boolean modified = promptChangeAssignees(Arrays.asList(awa), isPersistViewer());
        XViewer xViewer = ((XViewerColumn) treeColumn.getData()).getTreeViewer();
        if (modified && isPersistViewer(xViewer)) {
          AtsChangeSet.execute("persist assignees via alt-left-click", awa);
        }
        if (modified) {
          xViewer.update(awa, null);
          return true;
        }
      }
    } catch (OseeCoreException ex) {
      OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
    }

    return false;
  }
  private void validateActionAtEnd(Artifact actionArt) throws OseeCoreException {
    resultData.log("\nValidating End...");
    // Ensure event service is connected
    if (!OseeEventManager.isEventManagerConnected()) {
      resultData.logError("Remote Event Service is not connected");
      return;
    }
    resultData.log("Remote Event Service connected");

    // Validate values
    TeamWorkFlowArtifact teamArt = ActionManager.getFirstTeam(actionArt);
    testEquals(
        "Description",
        "description 4",
        teamArt.getSoleAttributeValue(AtsAttributeTypes.Description, null));
    testEquals("Change Type", ChangeType.Support, ChangeTypeUtil.getChangeType(teamArt));
    testEquals(
        "Priority", "3", teamArt.getSoleAttributeValue(AtsAttributeTypes.PriorityType, null));
    testEquals(
        "Validation Required",
        "false",
        String.valueOf(teamArt.getSoleAttributeValue(AtsAttributeTypes.ValidationRequired, null)));

    IAtsVersion verArt = AtsVersionService.get().getTargetedVersion(teamArt);
    String expectedTargetedVersion;
    if (verArt != null) {
      expectedTargetedVersion = verArt.toString();
    } else {
      expectedTargetedVersion = "not set";
    }
    testEquals("Targeted Version", expectedTargetedVersion, "2.5.7");
    testEquals("State", TeamState.Analyze.getName(), teamArt.getStateMgr().getCurrentStateName());
  }
Example #3
0
 @Override
 public Object[] getChildren(Object parentElement) {
   if (parentElement instanceof Collection<?>) {
     return ((Collection<?>) parentElement).toArray();
   }
   if (parentElement instanceof Artifact) {
     try {
       Artifact artifact = (Artifact) parentElement;
       if (artifact.isDeleted()) {
         return new Object[] {};
       }
       if (artifact.isOfType(AtsArtifactTypes.Action)) {
         relatedArts.addAll(ActionManager.getTeams(artifact));
         return ActionManager.getTeams((artifact)).toArray();
       }
       if (artifact.isOfType(AtsArtifactTypes.Goal)) {
         List<Artifact> arts =
             AtsClientService.get().getGoalMembersCache().getMembers((GoalArtifact) artifact);
         relatedArts.addAll(arts);
         AtsBulkLoad.bulkLoadArtifacts(relatedArts);
         return arts.toArray(new Artifact[arts.size()]);
       }
       if (artifact.isOfType(AtsArtifactTypes.AgileSprint)) {
         List<Artifact> arts =
             AtsClientService.get().getSprintItemsCache().getMembers((SprintArtifact) artifact);
         relatedArts.addAll(arts);
         AtsBulkLoad.bulkLoadArtifacts(relatedArts);
         return arts.toArray(new Artifact[arts.size()]);
       }
       if (artifact.isOfType(AtsArtifactTypes.TeamWorkflow)) {
         TeamWorkFlowArtifact teamArt = TeamWorkFlowManager.cast(artifact);
         List<Artifact> arts = new ArrayList<Artifact>();
         // Convert artifacts to WorldArtifactItems
         arts.addAll(ReviewManager.getReviews(teamArt));
         arts.addAll(teamArt.getTaskArtifactsSorted());
         relatedArts.addAll(arts);
         return arts.toArray();
       }
     } catch (OseeCoreException ex) {
       OseeLog.log(Activator.class, Level.SEVERE, ex);
     }
   }
   return org.eclipse.osee.framework.jdk.core.util.Collections.EMPTY_ARRAY;
 }
Example #4
0
 @Override
 public void handleColumnMultiEdit(TreeColumn treeColumn, Collection<TreeItem> treeItems) {
   try {
     Set<AbstractWorkflowArtifact> awas = new HashSet<>();
     for (TreeItem item : treeItems) {
       Artifact art = (Artifact) item.getData();
       if (art instanceof AbstractWorkflowArtifact) {
         awas.add((AbstractWorkflowArtifact) art);
       }
       if (art.isOfType(AtsArtifactTypes.Action) && ActionManager.getTeams(art).size() == 1) {
         awas.add(ActionManager.getFirstTeam(art));
       }
     }
     if (awas.isEmpty()) {
       AWorkbench.popup("Invalid selection for setting assignees.");
       return;
     }
     promptChangeAssignees(awas, true);
   } catch (OseeCoreException ex) {
     OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
   }
 }
  private void validateActionAtStart(Artifact actionArt) throws OseeCoreException {
    resultData.log("\nValidating Start...");
    // Ensure event service is connected
    if (!OseeEventManager.isEventManagerConnected()) {
      resultData.logError("Remote Event Service is not connected");
      return;
    }
    resultData.log("Remote Event Service connected");

    // Validate values
    TeamWorkFlowArtifact teamArt = ActionManager.getFirstTeam(actionArt);
    testEquals(
        "Description",
        "description",
        teamArt.getSoleAttributeValue(AtsAttributeTypes.Description, null));
    testEquals("Change Type", ChangeType.Improvement, ChangeTypeUtil.getChangeType(teamArt));
    testEquals(
        "Priority", "1", teamArt.getSoleAttributeValue(AtsAttributeTypes.PriorityType, null));
  }
Example #6
0
 public static Image getAssigneeImage(Artifact artifact) throws OseeCoreException {
   if (artifact.isDeleted()) {
     return null;
   }
   if (artifact instanceof AbstractWorkflowArtifact) {
     return FrameworkArtifactImageProvider.getUserImage(
         AtsClientService.get()
             .getUserServiceClient()
             .getOseeUsers(((AbstractWorkflowArtifact) artifact).getStateMgr().getAssignees()));
   }
   if (artifact.isOfType(AtsArtifactTypes.Action)) {
     for (TeamWorkFlowArtifact team : ActionManager.getTeams(artifact)) {
       Image image = AssigneeColumnUI.getAssigneeImage(team);
       if (image != null) {
         return image;
       }
     }
   }
   return null;
 }
  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);
  }