@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 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; }
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; }