예제 #1
0
        public async Task <TraceState <TState, TLinkData> > CancelTransferAsync <TLinkData>(TransferResponseInput <TLinkData> input)
        {
            // retrieve parent link
            TransferResponseInput <TLinkData> headLinkInput = new TransferResponseInput <TLinkData>(input.TraceId, null);
            TraceLink <TLinkData>             parentLink    = await this.GetHeadLinkAsync <TLinkData>(headLinkInput);

            TLinkData data = input.Data;

            SdkConfig sdkConfig = await this.GetConfigAsync();

            String workflowId = sdkConfig.WorkflowId;
            String configId   = sdkConfig.ConfigId;
            String accountId  = sdkConfig.AccountId;

            TraceLinkBuilderConfig <TLinkData> cfg = new TraceLinkBuilderConfig <TLinkData>()
            {
                // provide workflow id
                WorkflowId = workflowId,
                // and workflow config id
                ConfigId = configId,
                // and parent link to append to the existing trace
                ParentLink = parentLink
            };
            // use a TraceLinkBuilder to create the first link
            // only provide workflowId to initiate a new trace
            TraceLinkBuilder <TLinkData> linkBuilder = new TraceLinkBuilder <TLinkData>(cfg);

            linkBuilder // this is to cancel the transfer
            .ForCancelTransfer(data)
            // add creator info
            .WithCreatedBy(accountId);
            // call createLink helper
            return(await this.CreateLinkAsync(linkBuilder));
        }
예제 #2
0
        /// <summary>
        /// The PullTrace
        /// </summary>
        /// <typeparam name="TLinkData"></typeparam>
        /// <param name="input">The input<see cref="PullTransferInput{TLinkData}"/></param>
        /// <returns>The <see cref="Task{TraceState{TState, TLinkData}}"/></returns>
        public async Task <TraceState <TState, TLinkData> > PullTraceAsync <TLinkData>(PullTransferInput <TLinkData> input)
        {
            // retrieve parent link
            TransferResponseInput <TLinkData> headLinkInput = new TransferResponseInput <TLinkData>(input.TraceId, null);
            TraceLink <TLinkData>             parentLink    = await this.GetHeadLinkAsync <TLinkData>(headLinkInput);

            TLinkData data = input.Data;

            SdkConfig sdkConfig = await this.GetConfigAsync();

            string workflowId = sdkConfig.WorkflowId;
            string userId     = sdkConfig.UserId;
            string groupId    = sdkConfig.GroupId;

            TraceLinkBuilderConfig <TLinkData> cfg = new TraceLinkBuilderConfig <TLinkData>()
            {
                // provide workflow id
                WorkflowId = workflowId,
                // and parent link to append to the existing trace
                ParentLink = parentLink
            };
            // use a TraceLinkBuilder to create the first link
            // only provide workflowId to initiate a new trace
            TraceLinkBuilder <TLinkData> linkBuilder = new TraceLinkBuilder <TLinkData>(cfg);

            // this is a push transfer
            linkBuilder.ForPullTransfer(groupId, data).WithCreatedBy(userId);
            // call createLink helper
            return(await this.CreateLinkAsync(linkBuilder));
        }
예제 #3
0
        public async Task RejectTransferTestWithPojo()
        {
            PaginationInfo paginationInfo = new PaginationInfo(10, null, null, null);

            var sdk = GetSdk <StateExample>();

            TracesState <StateExample, DataClass> tracesIn = await sdk.GetIncomingTracesAsync <DataClass>(paginationInfo);

            string traceId = null;

            if (tracesIn.TotalCount == 0)
            {
                await PushTraceTestWithPojo();

                traceId = someTraceState.TraceId;
            }
            else
            {
                someTraceState = tracesIn.Traces[0];
                traceId        = someTraceState.TraceId;
            }
            TransferResponseInput <DataClass>    trInput     = new TransferResponseInput <DataClass>(traceId, null, null);
            TraceState <StateExample, DataClass> stateReject = await GetOtherGroupSdk <StateExample>().RejectTransferAsync <DataClass>(trInput);

            Assert.NotNull(stateReject.TraceId);
        }
예제 #4
0
        public async Task CancelTransferTestWithPojo()
        {
            await PushTraceTestWithPojo();

            TransferResponseInput <Object>    responseInput = new TransferResponseInput <Object>(someTraceState.TraceId, new Object(), null);
            TraceState <StateExample, Object> statecancel   = await GetSdk <StateExample>().CancelTransferAsync <Object>(responseInput);

            Assert.NotNull(statecancel.TraceId);
        }
예제 #5
0
        public async Task AcceptTransferTestWithPojo()
        {
            await PushTraceTestWithPojo();

            TransferResponseInput <Object>    trInput     = new TransferResponseInput <Object>(someTraceState.TraceId, new Object(), null);
            TraceState <StateExample, Object> stateAccept = await GetOtherGroupSdk <StateExample>().AcceptTransferAsync <Object>(trInput);

            Assert.NotNull(stateAccept.TraceId);
        }
예제 #6
0
        public async Task CancelTransferTest()
        {
            await PushTraceTest();

            TransferResponseInput <Object> responseInput = new TransferResponseInput <Object>(someTraceState.TraceId, null, null);
            TraceState <Object, Object>    statecancel   = await GetSdk().CancelTransferAsync(responseInput);

            Assert.NotNull(statecancel.TraceId);
        }
예제 #7
0
        public async Task AcceptTransferTest()
        {
            await PushTraceTest();

            TransferResponseInput <Object> trInput     = new TransferResponseInput <Object>(someTraceState.TraceId, null, null);
            TraceState <Object, Object>    stateAccept = await GetOtherGroupSdk().AcceptTransferAsync(trInput);

            Assert.NotNull(stateAccept.TraceId);
        }
예제 #8
0
        public async Task CancelTransferTestWithPojo()
        {
            Dictionary <string, object> data = new Dictionary <string, object>()
            {
                { "why", "because im testing the pushTrace 2" }
            };

            DataClass d = new DataClass()
            {
                f11 = 1,
                f22 = data
            };

            await PushTraceTestWithPojo();

            TransferResponseInput <DataClass>    responseInput = new TransferResponseInput <DataClass>(someTraceState.TraceId, d, null);
            TraceState <StateExample, DataClass> statecancel   = await GetSdk <StateExample>().CancelTransferAsync <DataClass>(responseInput);

            Assert.IsNotNull(statecancel.TraceId);;
        }
예제 #9
0
        public async Task AcceptTransferTestWithPojo()
        {
            await PushTraceToMyGroupTestWithPojo();

            Dictionary <string, object> data = new Dictionary <string, object>()
            {
                { "why", "because im testing the pushTrace 2" }
            };

            DataClass d = new DataClass()
            {
                f11 = 1,
                f22 = data
            };

            TransferResponseInput <DataClass>    trInput     = new TransferResponseInput <DataClass>(someTraceState.TraceId, d, null);
            TraceState <StateExample, DataClass> stateAccept = await GetSdk <StateExample>().AcceptTransferAsync <DataClass>(trInput);

            Assert.IsNotNull(stateAccept.TraceId);
        }
예제 #10
0
        /// <summary>
        /// The AppendLink
        /// </summary>
        /// <typeparam name="TLinkData"></typeparam>
        /// <param name="input">The input<see cref="AppendLinkInput{TLinkData}"/></param>
        /// <returns>The <see cref="Task{TraceState{TState, TLinkData}}"/></returns>
        public async Task <TraceState <TState, TLinkData> > AppendLinkAsync <TLinkData>(AppendLinkInput <TLinkData> input)
        {
            // retrieve parent link
            TransferResponseInput <TLinkData> headLinkInput = new TransferResponseInput <TLinkData>(input.TraceId, null);
            TraceLink <TLinkData>             parentLink    = await this.GetHeadLinkAsync <TLinkData>(headLinkInput);

            //extract info from input
            string    actionKey  = input.ActionKey;
            TLinkData data       = input.Data;
            string    groupLabel = input.GroupLabel;

            SdkConfig sdkConfig = await this.GetConfigAsync();

            string workflowId = sdkConfig.WorkflowId;
            string configId   = sdkConfig.ConfigId;
            string accountId  = sdkConfig.AccountId;
            string groupId    = sdkConfig.GetGroupId(groupLabel);

            // upload files and transform data
            await this.UploadFilesInLinkData(data);

            TraceLinkBuilderConfig <TLinkData> cfg = new TraceLinkBuilderConfig <TLinkData>()
            {
                // provide workflow id
                WorkflowId = workflowId,
                // and workflow config id
                ConfigId = configId,
                // and parent link to append to the existing trace
                ParentLink = parentLink
            };
            // use a TraceLinkBuilder to create the first link
            // only provide workflowId to initiate a new trace
            TraceLinkBuilder <TLinkData> linkBuilder = new TraceLinkBuilder <TLinkData>(cfg);

            // this is an attestation
            linkBuilder.ForAttestation(actionKey, data)
            .WithGroup(groupId)
            .WithCreatedBy(accountId);
            // call createLink helper
            return(await this.CreateLinkAsync(linkBuilder));
        }
예제 #11
0
        /// <summary>
        /// The AppendLink
        /// </summary>
        /// <typeparam name="TLinkData"></typeparam>
        /// <param name="input">The input<see cref="AppendLinkInput{TLinkData}"/></param>
        /// <returns>The <see cref="Task{TraceState{TState, TLinkData}}"/></returns>
        public async Task <TraceState <TState, TLinkData> > AppendLinkAsync <TLinkData>(AppendLinkInput <TLinkData> input)
        {
            // retrieve parent link
            TransferResponseInput <TLinkData> headLinkInput = new TransferResponseInput <TLinkData>(input.TraceId, null);
            TraceLink <TLinkData>             parentLink    = await this.GetHeadLinkAsync <TLinkData>(headLinkInput);

            //extract info from input
            string    formId = input.FormId;
            TLinkData data   = input.Data;

            SdkConfig sdkConfig = await this.GetConfigAsync();

            string workflowId = sdkConfig.WorkflowId;
            string userId     = sdkConfig.UserId;
            string ownerId    = sdkConfig.OwnerId;
            string groupId    = sdkConfig.GroupId;
            IDictionary <string, string> actionNames = sdkConfig.ActionNames;

            // upload files and transform data
            await this.UploadFilesInLinkData(data);

            TraceLinkBuilderConfig <TLinkData> cfg = new TraceLinkBuilderConfig <TLinkData>()
            {
                // provide workflow id
                WorkflowId = workflowId,
                // and parent link to append to the existing trace
                ParentLink = parentLink
            };
            // use a TraceLinkBuilder to create the first link
            // only provide workflowId to initiate a new trace
            TraceLinkBuilder <TLinkData> linkBuilder = new TraceLinkBuilder <TLinkData>(cfg);

            // this is an attestation
            linkBuilder.ForAttestation(formId, actionNames.ContainsKey(formId)?actionNames[formId]:null, data)
            .WithOwner(ownerId)
            .WithGroup(groupId)
            .WithCreatedBy(userId);
            // call createLink helper
            return(await this.CreateLinkAsync(linkBuilder));
        }
예제 #12
0
        public async Task RejectTransferTest()
        {
            PaginationInfo paginationInfo         = new PaginationInfo(10, null, null, null);
            TracesState <Object, Object> tracesIn = await GetSdk().GetIncomingTracesAsync <Object>(paginationInfo);

            string traceId = null;

            if (tracesIn.TotalCount == 0)
            {
                await PushTraceTest();

                traceId = someTraceState.TraceId;
            }
            else
            {
                someTraceState = tracesIn.Traces[0];
                traceId        = someTraceState.TraceId;
            }
            TransferResponseInput <Object> trInput     = new TransferResponseInput <Object>(traceId, null, null);
            TraceState <Object, Object>    stateReject = await GetOtherGroupSdk().RejectTransferAsync(trInput);

            Assert.NotNull(stateReject.TraceId);
        }
예제 #13
0
        public async Task <TraceState <TState, TLinkData> > AcceptTransferAsync <TLinkData>(TransferResponseInput <TLinkData> input)
        {
            // retrieve parent link
            TraceLink <TLinkData> parentLink = await this.GetHeadLinkAsync(input);

            //extract info from input
            TLinkData data       = input.Data;
            string    groupLabel = input.GroupLabel;

            SdkConfig sdkConfig = await this.GetConfigAsync();

            String workflowId = sdkConfig.WorkflowId;
            string configId   = sdkConfig.ConfigId;
            String accountId  = sdkConfig.AccountId;
            String groupId    = sdkConfig.GetGroupId(groupLabel);

            TraceLinkBuilderConfig <TLinkData> cfg = new TraceLinkBuilderConfig <TLinkData>()
            {
                // provide workflow id
                WorkflowId = workflowId,
                // and workflow config id
                ConfigId = configId,
                // and parent link to append to the existing trace
                ParentLink = parentLink
            };
            // use a TraceLinkBuilder to create the first link
            // only provide workflowId to initiate a new trace
            TraceLinkBuilder <TLinkData> linkBuilder = new TraceLinkBuilder <TLinkData>(cfg);

            // this is an attestation
            linkBuilder.ForAcceptTransfer(data)
            // add group info
            .WithGroup(groupId)
            // add creator info
            .WithCreatedBy(accountId);
            // call createLink helper
            return(await CreateLinkAsync(linkBuilder));
        }