Пример #1
0
        protected virtual string AcquireLocationTransferPermissionForThisItemIfNeeded(IProviderFacet ipf, params string[] locNameParamsArray)
        {
            string ec = WaitForPostedItemsComplete(ipf, locNameParamsArray);

            if (ec.IsNullOrEmpty())
            {
                var neededKVPSet = locNameParamsArray.Select(locName => KVP.Create(locName, AutoLocNameToITPRDictionary.SafeTryGetValue(locName))).Where(kvp => kvp.Value != null && !kvp.Value.TransferPermissionStatePublisher.Object.GetIsTransferPermitted(kvp.Key)).ToArray();

                currentItemAutoReleaseKVPList.AddRange(neededKVPSet);      // request each one to get released even if the acquire fails

                var acquireICFArray = neededKVPSet.Select(kvp => kvp.Value.TransferPermission(TransferPermissionRequestType.Acquire, kvp.Key).StartInline()).ToArray();

                ec = WaitForCompletion(ipf, acquireICFArray);
            }

            return(ec);
        }
Пример #2
0
        public SRMBase(TSRMConfigType config, IE039TableUpdater e039TableUpdater, SimpleActivePartBaseSettings?initialSettings = null)
            : base(config.PartID, initialSettings: initialSettings ?? SimpleActivePartBaseSettings.DefaultVersion2)
        {
            Config = config.MakeCopyOfThis();

            E039TableUpdater = e039TableUpdater;

            AutoLocNameToITPRDictionary   = Config.AutoLocNameToITPRDictionary;
            ManualLocNameToITPRDictionary = Config.ManualLocNameToITPRDictionary;

            bool autoITPRDictionaryIsEmpty   = Config.AutoLocNameToITPRDictionary.IsNullOrEmpty();
            bool manualITPRDictionaryIsEmpty = Config.ManualLocNameToITPRDictionary.IsNullOrEmpty();

            if (!autoITPRDictionaryIsEmpty && manualITPRDictionaryIsEmpty)
            {
                // auto is non-empty and manual is empty - replace manual with auto so that we can do manual requests for all of the auto items.
                ManualLocNameToITPRDictionary = AutoLocNameToITPRDictionary;
            }
            else if (!autoITPRDictionaryIsEmpty && !manualITPRDictionaryIsEmpty)
            {
                // both auto and manual are provided as non-empty - internally use the union of the auto with the manual set.  the manual set has priority (same name items replaces any one corresponding from the auto set)
                ManualLocNameToITPRDictionary = new ReadOnlyIDictionary <string, ITransferPermissionRequest>(AutoLocNameToITPRDictionary.ConvertToWritable().SafeAddRange(ManualLocNameToITPRDictionary));
            }
        }