コード例 #1
0
        private async Task CreateRetentionSchedule(string nodeId, uint period)
        {
            try
            {
                var node = await _alfrescoHttpClient.GetRecordCategory(nodeId, ImmutableList <Parameter> .Empty
                                                                       .Add(new Parameter(AlfrescoNames.Headers.Include, AlfrescoNames.Includes.HasRetentionSchedule, ParameterType.QueryString)));

                if (node.Entry?.HasRetentionSchedule != true)
                {
                    await _alfrescoHttpClient.ExecutionQueue(new ExecutionQueue
                    {
                        Name    = "createDispositionSchedule",
                        NodeRef = $"workspace://SpacesStore/{nodeId}"
                    });
                }

                var nodeChildren = await _alfrescoHttpClient.GetNodeChildren(nodeId, ImmutableList <Parameter> .Empty
                                                                             .Add(new Parameter(AlfrescoNames.Headers.Where, "(nodeType='rma:dispositionSchedule')", ParameterType.QueryString))
                                                                             .Add(new Parameter(AlfrescoNames.Headers.MaxItems, 1, ParameterType.QueryString)));

                var children = nodeChildren?.List?.Entries?.ToList() ?? new List <NodeChildAssociationEntry>();

                if (children.Count == 0)
                {
                    Log.Error("Retention schedule not found", $"CreateRetentionSchedule for '{nodeId}' failed");
                }

                var retentionScheduleId = children[0].Entry.Id;

                await _alfrescoHttpClient.FormProcessor(retentionScheduleId, new FormProcessor
                {
                    Prop_rma_dispositionAuthority    = "Authority",
                    Prop_rma_dispositionInstructions = "Instructions",
                    Prop_rma_recordLevelDisposition  = "true"
                });

                await _alfrescoHttpClient.DispositionActionDefinitions(retentionScheduleId, new DispositionActionDefinitions
                {
                    CombineDispositionStepConditions = "false",
                    Description = "DispositionActionDefinitions",
                    EligibleOnFirstCompleteEvent = "true",
                    GhostOnDestroy = "on",
                    Name           = "cutoff",
                    Period         = $"year|{period}",
                    PeriodProperty = "rma:dateFiled"
                });
            }
            catch (Exception ex)
            {
                Log.Error(ex, $"CreateRetentionSchedule for '{nodeId}' failed");
            }
        }