예제 #1
0
 @Override
 public IAtsVersion getTargetedVersionByTeamWf(IAtsTeamWorkflow teamWf) throws OseeCoreException {
   IAtsVersion version = versionCache.getVersion(teamWf);
   if (version == null) {
     if (getArtifact(teamWf)
             .getRelatedArtifactsCount(AtsRelationTypes.TeamWorkflowTargetedForVersion_Version)
         > 0) {
       List<Artifact> verArts =
           getArtifact(teamWf)
               .getRelatedArtifacts(AtsRelationTypes.TeamWorkflowTargetedForVersion_Version);
       if (verArts.size() > 1) {
         OseeLog.log(
             Activator.class,
             Level.SEVERE,
             "Multiple targeted versions for artifact " + teamWf.toStringWithId());
         version =
             cacheProvider
                 .get()
                 .getSoleByGuid(verArts.iterator().next().getGuid(), IAtsVersion.class);
       } else {
         version =
             cacheProvider
                 .get()
                 .getSoleByGuid(verArts.iterator().next().getGuid(), IAtsVersion.class);
       }
       versionCache.cache(teamWf, version);
     }
   }
   return version;
 }
예제 #2
0
 @Override
 public IAtsVersion createVersion(String name) throws OseeCoreException {
   IAtsVersion item = atsClient.getVersionFactory().createVersion(name);
   AtsArtifactConfigCache cache = cacheProvider.get();
   cache.cache(item);
   return item;
 }
예제 #3
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;
 }