Beispiel #1
0
  @Override
  public Collection<IAtsTask> createTasks(NewTaskData newTaskData) {
    AtsTaskEndpointApi taskEp = AtsClientService.getTaskEp();
    Response response = taskEp.create(newTaskData);

    Artifact teamWf = atsClient.getArtifact(newTaskData.getTeamWfUuid());

    JaxAtsTasks jaxTasks = response.readEntity(JaxAtsTasks.class);
    ArtifactEvent artifactEvent = new ArtifactEvent(AtsUtilCore.getAtsBranch());
    List<Long> artUuids = new LinkedList<>();
    for (JaxAtsTask task : jaxTasks.getTasks()) {
      String guid = ArtifactQuery.getGuidFromUuid(task.getUuid(), AtsUtilCore.getAtsBranch());
      artifactEvent
          .getArtifacts()
          .add(
              new EventBasicGuidArtifact(
                  EventModType.Added,
                  AtsUtilCore.getAtsBranch().getUuid(),
                  AtsArtifactTypes.Task.getGuid(),
                  guid));
      artUuids.add(task.getUuid());

      RelationLink relation = getRelation(teamWf, task);
      Artifact taskArt = atsClient.getArtifact(task.getUuid());

      DefaultBasicUuidRelation guidRelation =
          new DefaultBasicUuidRelation(
              AtsUtilCore.getAtsBranch().getUuid(),
              AtsRelationTypes.TeamWfToTask_Task.getGuid(),
              relation.getId(),
              relation.getGammaId(),
              getBasicGuidArtifact(teamWf),
              getBasicGuidArtifact(taskArt));

      artifactEvent
          .getRelations()
          .add(
              new EventBasicGuidRelation(
                  RelationEventType.Added,
                  newTaskData.getTeamWfUuid().intValue(),
                  new Long(task.getUuid()).intValue(),
                  guidRelation));
    }

    OseeEventManager.kickPersistEvent(getClass(), artifactEvent);

    List<IAtsTask> tasks = new LinkedList<>();
    for (Long uuid : artUuids) {
      tasks.add(
          AtsClientService.get()
              .getWorkItemFactory()
              .getTask(AtsClientService.get().getArtifact(uuid)));
    }
    return tasks;
  }
 @Override
 public IAtsVersion createVersion(String name) throws OseeCoreException {
   IAtsVersion item = atsClient.getVersionFactory().createVersion(name);
   AtsArtifactConfigCache cache = cacheProvider.get();
   cache.cache(item);
   return item;
 }
 public AtsVersionServiceImpl(
     IAtsClient atsClient,
     CacheProvider<AtsArtifactConfigCache> configCacheProvider,
     AtsVersionCache versionCache) {
   super(atsClient.getServices());
   this.atsClient = atsClient;
   this.cacheProvider = configCacheProvider;
   this.versionCache = versionCache;
 }
 @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;
 }