Exemplo n.º 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;
  }
  @Test
  public void testLoad() {
    IAtsActionableItem sawTestAi =
        AtsClientService.get()
            .getConfig()
            .getSoleByUuid(DemoArtifactToken.SAW_Test_AI.getUuid(), IAtsActionableItem.class);
    Assert.assertTrue(sawTestAi.isAllowUserActionCreation());
    Assert.assertEquals(
        1, ActionableItems.getUserEditableActionableItems(Arrays.asList(sawTestAi)).size());

    sawTestAi.setAllowUserActionCreation(false);
    AtsChangeSet changes = new AtsChangeSet(getClass().getSimpleName());
    AtsClientService.get().storeConfigObject(sawTestAi, changes);
    changes.execute();

    sawTestAi =
        AtsClientService.get()
            .getConfig()
            .getSoleByUuid(DemoArtifactToken.SAW_Test_AI.getUuid(), IAtsActionableItem.class);
    Assert.assertFalse(sawTestAi.isAllowUserActionCreation());
    Assert.assertEquals(
        0, ActionableItems.getUserEditableActionableItems(Arrays.asList(sawTestAi)).size());

    sawTestAi.setAllowUserActionCreation(true);
    changes = new AtsChangeSet(getClass().getSimpleName());
    AtsClientService.get().storeConfigObject(sawTestAi, changes);
    changes.execute();

    sawTestAi =
        AtsClientService.get()
            .getConfig()
            .getSoleByUuid(DemoArtifactToken.SAW_Test_AI.getUuid(), IAtsActionableItem.class);
    Assert.assertTrue(sawTestAi.isAllowUserActionCreation());
    Assert.assertEquals(
        1, ActionableItems.getUserEditableActionableItems(Arrays.asList(sawTestAi)).size());
  }
Exemplo n.º 3
0
  private static void performPostBranchCreationTasks(final TeamWorkFlowArtifact teamArt)
      throws OseeCoreException {
    // Create reviews as necessary
    AtsChangeSet changes = new AtsChangeSet("Create Reviews upon Transition");
    boolean created =
        createNecessaryBranchEventReviews(
            StateEventType.CreateBranch, teamArt, new Date(), AtsCoreUsers.SYSTEM_USER, changes);
    if (created) {
      changes.execute();
    }

    // Notify extensions of branch creation
    for (IAtsStateItemCore item : AtsStateItemCoreManager.getStateItems()) {
      item.workingBranchCreated(teamArt);
    }
  }
Exemplo n.º 4
0
 @Override
 public IAtsVersion store(IAtsVersion version, IAtsTeamDefinition teamDef) {
   Conditions.checkNotNull(version, "version");
   Conditions.checkNotNull(teamDef, "teamDef");
   Conditions.checkNotNull(teamDef.getStoreObject(), "teamDef storeObject");
   IAtsVersion result = version;
   if (version.getStoreObject() == null) {
     Artifact verArt = cacheProvider.get().getArtifact(version);
     if (verArt == null) {
       AtsChangeSet changes = new AtsChangeSet("Create " + version);
       VersionArtifactWriter writer = new VersionArtifactWriter();
       verArt = writer.store(version, cacheProvider.get(), changes);
       changes.relate(teamDef, AtsRelationTypes.TeamDefinitionToVersion_Version, verArt);
       version.setStoreObject(verArt);
       changes.execute();
     }
   }
   return result;
 }
Exemplo n.º 5
0
  @Override
  protected void doWork(IProgressMonitor monitor) throws Exception {
    data.validate();
    data.getResultData().log(getName() + "\n");
    monitor.worked(calculateWork(0.20));

    try {
      AtsChangeSet changes = new AtsChangeSet(getName());

      // Import Work Definition sheets
      data.getResultData().log("Importing Work Definitions");
      Artifact folder = getWorkDefinitionFolder();
      Set<String> stateNames = new HashSet<String>();
      AtsWorkDefinitionSheetProviders.importWorkDefinitionSheets(
          data.getResultData(), changes, folder, data.getWorkDefSheets(), stateNames);

      monitor.worked(calculateWork(0.30));
      data.getResultData().log("Importing Work Definitions...Complete");

      // Import AI and Team sheets
      data.getResultData().log("Importing AIs and Teams");
      for (WorkDefinitionSheet sheet : data.getTeamsAiSheets()) {
        AtsWorkDefinitionSheetProviders.importAIsAndTeamsToDb(sheet, changes);
      }
      monitor.worked(calculateWork(0.40));

      // Perform specialized configuration code (eg set extra attributes, create branches, etc)
      data.performPostConfig(changes, data);

      if (data.getResultData().isErrors()) {
        String errorStr = "Errors found, not persisting.  May need to restart your OSEE";
        data.getResultData().log(errorStr);
        AWorkbench.popup(errorStr);
      } else {
        changes.execute();
      }
    } catch (Exception ex) {
      data.getResultData().logError("Exception " + ex.getLocalizedMessage());
    }
    XResultDataUI.report(data.getResultData(), getName());
    monitor.worked(calculateWork(0.10));
  }
Exemplo n.º 6
0
  public static boolean promptChangeAssignees(
      final Collection<? extends AbstractWorkflowArtifact> awas, boolean persist)
      throws OseeCoreException {
    for (AbstractWorkflowArtifact awa : awas) {
      if (awa.isCompleted()) {
        AWorkbench.popup(
            "ERROR",
            "Can't assign completed " + awa.getArtifactTypeName() + " (" + awa.getAtsId() + ")");
        return false;
      } else if (awa.isCancelled()) {
        AWorkbench.popup(
            "ERROR",
            "Can't assign cancelled " + awa.getArtifactTypeName() + " (" + awa.getAtsId() + ")");
        return false;
      }
    }
    UserCheckTreeDialog uld =
        new UserCheckTreeDialog(
            "Select Assigness",
            "Select to assign.\nDeSelect to un-assign.",
            AtsClientService.get()
                .getUserServiceClient()
                .getOseeUsers(AtsClientService.get().getUserService().getUsers(Active.Active)));
    if (awas.iterator().next().getParentTeamWorkflow() != null) {
      uld.setTeamMembers(
          AtsClientService.get()
              .getUserServiceClient()
              .getOseeUsers(
                  awas.iterator()
                      .next()
                      .getParentTeamWorkflow()
                      .getTeamDefinition()
                      .getMembersAndLeads()));
    }

    if (awas.size() == 1) {
      uld.setInitialSelections(
          AtsClientService.get()
              .getUserServiceClient()
              .getOseeUsers(awas.iterator().next().getStateMgr().getAssignees()));
    }
    if (uld.open() != 0) {
      return false;
    }
    Collection<IAtsUser> users =
        AtsClientService.get().getUserServiceClient().getAtsUsers(uld.getUsersSelected());
    if (users.isEmpty()) {
      AWorkbench.popup("ERROR", "Must have at least one assignee");
      return false;
    }
    // As a convenience, remove the UnAssigned user if another user is selected
    if (users.size() > 1) {
      users.remove(AtsCoreUsers.SYSTEM_USER);
    }
    for (AbstractWorkflowArtifact awa : awas) {
      awa.getStateMgr().setAssignees(users);
    }
    if (persist) {
      AtsChangeSet.execute("Assignee - Prompt Change", awas);
    }
    return true;
  }