QBM.Operations.CompositionApi.Server.PlugIn/QBM.CompositionApi.Operations/QBM_Queue_ReactivateJob.cs
Decompiler Source FileQBM.Operations.CompositionApi.Server.PlugIn.QBM_Queue_ReactivateJobDecompiled Source
Interpretation
- Decompiled source file. Use method/event registrations and call-site extraction to connect back to DialogMethod, QBMEvent, and API layers.
Relations
- CallMethodAsync: ResetOverlimit at line 80
- CallMethodAsync: ResetFrozen at line 84
- CallMethodAsync: ResetFrozen at line 94
- CallMethodAsync: ResetFrozen at line 97
Typed Edges
- No typed edges extracted for this source.
References
- No direct source references extracted.
Referenced By
- No direct source references extracted.
C# source-derived context
Generated by pattern extraction from the decompiled C# source and decompile index. This is factual source evidence, not inferred behavior.
reads entity values references DB/Dialog objects Job/process related markers
Summary: classes QBM_Queue_ReactivateJob, ReactivateJobInput; methods Build; references ESet, JobQueue; markers reads entity values, references DB/Dialog objects, Job/process related markers
Complete Source
1using System;2using System.Collections;3using System.Collections.Generic;4using System.Runtime.CompilerServices;5using System.Threading;6using System.Threading.Tasks;7using QBM.CompositionApi.Definition;8using QBM.CompositionApi.Dto;9using QBM.CompositionApi.Handling;10using VI.Base;11using VI.DB;12using VI.DB.Entities;13using VI.DB.MetaData;1415namespace QBM.CompositionApi.Operations;1617public class QBM_Queue_ReactivateJob : IApiProviderFor<OperationsApiProject>, IApiProvider18{19 public class ReactivateJobInput20 {21 [field: CompilerGenerated]22 public string[] UidJobs23 {24 [CompilerGenerated]25 get;26 [CompilerGenerated]27 set;28 }2930 [field: CompilerGenerated]31 public ReactivateJobMode Mode32 {33 [CompilerGenerated]34 get;35 [CompilerGenerated]36 set;37 }38 }3940 public enum ReactivateJobMode41 {42 Reactivate,43 ContinueSuccess,44 ContinueError45 }4647 public void Build(IApiBuilder builder)48 {49 builder.AddMethod(Method.Define("queue/reactivatejob").WithDescription("Reactivates a process where one of the process steps is in the FROZEN or OVERLIMIT state.").Handle<ReactivateJobInput, EntityCollectionData>("POST", (Func<ReactivateJobInput, IRequest, CancellationToken, System.Threading.Tasks.Task<EntityCollectionData>>)([AsyncStateMachine(typeof(_003C_003Ec._003C_003CBuild_003Eb__0_0_003Ed))] async (ReactivateJobInput input, IRequest qr, CancellationToken ct) =>50 {51 //IL_0002: Unknown result type (might be due to invalid IL or missing references)52 //IL_0007: Unknown result type (might be due to invalid IL or missing references)53 //IL_001e: Unknown result type (might be due to invalid IL or missing references)54 //IL_001f: Unknown result type (might be due to invalid IL or missing references)55 ISqlFormatter sqlFormatter = qr.Session.SqlFormatter();56 object[] uidJobs = input.UidJobs;57 string text = sqlFormatter.InClause("UID_Job", ValType.String, FormatterOptions.NonUnicodeLiterals, uidJobs);58 string text2 = sqlFormatter.InClause("Ready2EXE", ValType.String, "OVERLIMIT", "FROZEN");59 text = "uid_tree in ( select uid_tree from jobqueue where " + text + ") and " + text2;60 Query query = Query.From("JobQueue").Select("Ready2EXE").Where(text);61 ISession session = qr.Session;62 IEntityCollection entityCollection = await session.Source().GetCollectionAsync(query, EntityCollectionLoadType.Bulk, ct).ConfigureAwait(false);63 List<IEntity> processedJobs = new List<IEntity>();64 ReactivateJobMode mode = input.Mode;65 using (IUnitOfWork u = session.StartUnitOfWork())66 {67 System.Collections.Generic.IEnumerator<IEntity> enumerator = ((System.Collections.Generic.IEnumerable<IEntity>)entityCollection).GetEnumerator();68 try69 {70 while (((System.Collections.IEnumerator)enumerator).MoveNext())71 {72 IEntity j = enumerator.Current;73 switch (mode)74 {75 case ReactivateJobMode.Reactivate:76 {77 string value = j.GetValue<string>("Ready2Exe");78 if (string.Equals(value, "OVERLIMIT", (StringComparison)5))79 {80 await j.CallMethodAsync("ResetOverlimit", ct).ConfigureAwait(false);81 }82 else if (string.Equals(value, "FROZEN", (StringComparison)5))83 {84 await j.CallMethodAsync("ResetFrozen", ct).ConfigureAwait(false);85 }86 else if (!string.Equals(value, "TRUE", (StringComparison)5))87 {88 session.GetLogSession().Info("The step {0} is in state {1} and cannot be reactivated.", j.GetValue("UID_Job").String, value);89 throw new InvalidOperationException();90 }91 break;92 }93 case ReactivateJobMode.ContinueError:94 await j.CallMethodAsync("ResetFrozen", parameter: false, ct).ConfigureAwait(false);95 break;96 case ReactivateJobMode.ContinueSuccess:97 await j.CallMethodAsync("ResetFrozen", parameter: true, ct).ConfigureAwait(false);98 break;99 default:100 throw new InvalidOperationException();101 }102 processedJobs.Add(j);103 await u.PutAsync(j, ct).ConfigureAwait(false);104 }105 }106 finally107 {108 ((System.IDisposable)enumerator)?.Dispose();109 }110 await u.CommitAsync(ct).ConfigureAwait(false);111 }112 IMetaTable metaTable = await session.MetaData().GetTableAsync("JobQueue", ct).ConfigureAwait(false);113 IEntity[] array = ((System.Collections.Generic.IEnumerable<IEntity>)processedJobs).ToArraySmart();114 return await array.ToEntityDataAsync(session, array.Length, "JobQueue", new string[2] { "UID_Job", "Ready2EXE" }, null, metaTable, null, ct).ConfigureAwait(false);115 })));116 }117}118