示例#1
0
        public void AssignAction(ParameterManager processParameterManager)
        {
            //if (!_bindToResourceTemplate) return;
            var dictionaryParameter = processParameterManager.GetDictionaryParam(_bindingDictionaryName);

            var selectedResource = dictionaryParameter.GetValue(_bindKey).ToString();

            var resource = ActionsManagement.GetContainer(selectedResource);

            var baseAction = resource.GetAction(_actionName);

            Action = baseAction.Clone();
            Action.ActionContainer = baseAction.ActionContainer;

            Log.Info($"当前StepAction绑定的是Machine:[{selectedResource}]的Action:[{_actionName}].");
        }
示例#2
0
        public void InitFromXml(XmlElement xmlElement)
        {
            var containerName = xmlElement.GetAttribute("Container");

            _actionName = xmlElement.GetAttribute("Action");

            //step action的container绑定了resource Template, sunjian 2019-12-25

            if (containerName.Contains("{Using"))
            {
                _bindToResourceTemplate = true;

                var trimmedContainerString = containerName.Trim('{').Trim('}').Replace(" ", "").Trim();

                var containerAttribute = trimmedContainerString.Split(',');

                var resourceTemplateName = containerAttribute[0].Substring("Using".Length,
                                                                           containerAttribute[0].Length - "Using".Length);

                _bindingDictionaryName = containerAttribute[1]
                                         .Substring("Binding{".Length, containerAttribute[1].Length - "Binding{".Length);

                _bindKey = containerAttribute[2].Substring("Key=".Length, containerAttribute[2].Length - "Key=".Length);

                var resourceTemplate =
                    (MachineResourceTemplate)ResourceManager.GetResourceTemplate(resourceTemplateName);

                if (!resourceTemplate.HasAction(_actionName))
                {
                    Log.Error($"ResourceTemplate:[{resourceTemplate}]中不存Action:[{_actionName}]");
                }
            }

            else if (!string.IsNullOrEmpty(containerName))
            {
                _bindToResourceTemplate = false;
                var container = ActionsManagement.GetContainer(containerName);
                Action = container.GetAction(_actionName);
            }
        }