internal static Workitem Create(Asset asset, IDictionary <string, PropertyValues> listPropertyValues, IEntityFieldTypeResolver typeResolver, IList <Member> owners = null)
        {
            switch (asset.AssetType.Token)
            {
            case VersionOneProcessor.StoryType:
            case VersionOneProcessor.DefectType:
                return(PrimaryWorkitem.Create(asset, listPropertyValues, typeResolver, owners));

            case VersionOneProcessor.TaskType:
                return(new Task(asset, listPropertyValues, owners, typeResolver));

            case VersionOneProcessor.TestType:
                return(new Test(asset, listPropertyValues, owners, typeResolver));

            default:
                throw new NotSupportedException("Type " + asset.AssetType.Token + " is not supported in factory method");
            }
        }
Esempio n. 2
0
 public ICollection<BuildRun> GetBuildRuns(PrimaryWorkitem primaryWorkitem, BuildProject buildProject)
 {
     return processor.GetBuildRuns(GroupFilter.And(
         Filter.Equal("CompletesPrimaryWorkitems", primaryWorkitem.Id),
         Filter.Equal("BuildProject", buildProject.Id)));
 }
Esempio n. 3
0
 public void RemoveBuildRunsFromWorkitem(PrimaryWorkitem workitem, IEnumerable<BuildRun> buildRuns)
 {
     var remove = (buildRuns ?? new List<BuildRun>()).Select(ValueId.FromEntity).ToList();
     var buildRunIds = workitem.CompletedInBuildRuns.Where(x => !remove.Any(y => y.Equals(x))).ToArray();
     workitem.CompletedInBuildRuns = buildRunIds;
 }
Esempio n. 4
0
 public void AddBuildRunsToWorkitem(PrimaryWorkitem workitem, IEnumerable<BuildRun> buildRuns)
 {
     var buildRunIds = new List<ValueId>(workitem.CompletedInBuildRuns);
     buildRunIds.AddRange(buildRuns.Select(ValueId.FromEntity));
     workitem.CompletedInBuildRuns = buildRunIds.ToArray();
 }
 public void CloseWorkitem(PrimaryWorkitem workitem)
 {
     try {
         var closeOperation = workitem.Asset.AssetType.GetOperation(InactivateOperation);
         services.ExecuteOperation(closeOperation, workitem.Asset.Oid);
     } catch (V1Exception ex) {
         throw new VersionOneException(queryBuilder.Localize(ex.Message));
     } catch(Exception ex) {
         throw new VersionOneException(ex.Message);
     }
 }