@Override public Object getParent(Object element) { if (element instanceof Artifact) { try { Artifact artifact = (Artifact) element; if (artifact.isDeleted()) { return null; } if (artifact.isOfType(AtsArtifactTypes.TeamWorkflow)) { return TeamWorkFlowManager.cast(artifact).getParentActionArtifact(); } if (artifact.isOfType(AtsArtifactTypes.Task)) { return TaskManager.cast(artifact).getParentAWA(); } if (artifact.isOfType(AtsArtifactTypes.ReviewArtifact)) { return ReviewManager.cast(artifact).getParentAWA(); } if (artifact.isOfType(AtsArtifactTypes.Goal)) { return ((GoalArtifact) artifact).getParentAWA(); } if (artifact.isOfType(AtsArtifactTypes.AgileSprint)) { return ((SprintArtifact) artifact).getParentAWA(); } } catch (Exception ex) { // do nothing } } return null; }
@Override public Collection<IAtsAbstractReview> getReviews(IAtsTeamWorkflow teamWf) { List<IAtsAbstractReview> reviews = new ArrayList<IAtsAbstractReview>(); for (AbstractReviewArtifact reviewArt : ReviewManager.getReviews((TeamWorkFlowArtifact) teamWf.getStoreObject())) { reviews.add(atsClient.getWorkItemFactory().getReview(reviewArt)); } return reviews; }
@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; }
@Override public Collection<IAtsAbstractReview> getReviewsFromCurrentState(IAtsTeamWorkflow teamWf) throws OseeCoreException { return ReviewManager.getReviewsFromCurrentState((TeamWorkFlowArtifact) teamWf); }