Beispiel #1
0
 public PluginService()
 {
     ResourceID   = Guid.Empty;
     ResourceType = Common.Interfaces.Data.ResourceType.PluginService;
     Source       = new PluginSource();
     Recordsets   = new RecordsetList();
     Method       = new ServiceMethod();
 }
Beispiel #2
0
 public PluginService()
 {
     ResourceID   = Guid.Empty;
     ResourceType = ResourceType.PluginService;
     Source       = new PluginSource();
     Recordsets   = new RecordsetList();
     Method       = new ServiceMethod();
 }
Beispiel #3
0
 public WebService()
 {
     ResourceID   = Guid.Empty;
     ResourceType = "WebService";
     Source       = new WebSource();
     Recordsets   = new RecordsetList();
     Method       = new ServiceMethod();
 }
Beispiel #4
0
 public ComPluginService()
 {
     ResourceID   = Guid.Empty;
     ResourceType = "ComPluginService";
     Source       = new ComPluginSource();
     Recordsets   = new RecordsetList();
     Method       = new ServiceMethod();
 }
Beispiel #5
0
 public PluginService()
 {
     ResourceID   = Guid.Empty;
     ResourceType = "PluginService";
     Source       = new PluginSource();
     Recordsets   = new RecordsetList();
     MethodsToRun = new List <IDev2MethodInfo>();
     Constructor  = new ServiceConstructor();
     Method       = new ServiceMethod();
 }
Beispiel #6
0
        public WcfService(XElement xml)
            : base(xml)
        {
            ResourceType = "PluginService";
            var action = xml.Descendants("Action").FirstOrDefault();

            if (action == null)
            {
                if (xml.HasAttributes && xml.Attribute("Type").Value == "WcfService")
                {
                    action = xml;
                }
                else
                {
                    return;
                }
            }

            Source     = CreateSource <WcfService>(action);
            Method     = CreateInputsMethod(action);
            Recordsets = CreateOutputsRecordsetList(action);
        }
Beispiel #7
0
        protected XElement CreateXml(enActionType actionType, string actionName, Resource source, RecordsetList recordsets, params object[] actionContent)
        {
            VerifyArgument.IsNotNull("source", source);
            var action = new XElement("Action",
                                      new XAttribute("Name", actionName),
                                      new XAttribute("Type", actionType),
                                      new XAttribute("SourceID", source.ResourceID),
                                      new XAttribute("SourceName", source.ResourceName ?? string.Empty),
                                      new XAttribute("ExecuteAction", Method.ExecuteAction ?? string.Empty),
                                      new XAttribute("SourceMethod", Method.Name ?? (ResourceName ?? string.Empty)) // Required for legacy!!
                                      );

            if (actionContent != null)
            {
                action.Add(actionContent);
            }

            var inputs  = CreateInputsXml(Method);
            var outputs = CreateOutputsXml(recordsets);

            action.Add(inputs);
            action.Add(outputs);


            var result = base.ToXml();

            result.AddFirst(
                new XElement("Actions", action),
                new XElement("AuthorRoles"),
                new XElement("Comment"),
                new XElement("Tags"),
                new XElement("HelpLink"),
                new XElement("UnitTestTargetWorkflowService"),
                new XElement("BizRule"),
                new XElement("WorkflowActivityDef"),
                new XElement("XamlDefinition"),
                new XElement("DataList"),
                new XElement("TypeOf", actionType)
                );

            return(result);
        }
Beispiel #8
0
 protected XElement CreateXml(enActionType actionType, Resource source, RecordsetList recordsets, params object[] actionContent)
 {
     return(CreateXml(actionType, ResourceName ?? string.Empty, source, recordsets, actionContent));
 }
Beispiel #9
0
        public static RecordsetList ToRecordsetList(this IOutputDescription outputDescription, RecordsetList currentList = null, string defaultFieldName = "")
        {
            if (outputDescription == null || outputDescription.DataSourceShapes == null || outputDescription.DataSourceShapes.Count == 0)
            {
                throw new Exception("Error retrieving shape from service output.");
            }

            var result        = currentList ?? new RecordsetList();
            var currentFields = new List <RecordsetField>();

            #region Create a copy of the current list's fields so that we don't lose the user-defined aliases.

            foreach (var rs in result)
            {
                currentFields.AddRange(rs.Fields);
                rs.Fields.Clear();
            }

            #endregion

            var paths = outputDescription.DataSourceShapes[0].Paths;

            foreach (var path in paths)
            {
                var names     = SplitRecordsetAndFieldNames(path);
                var rsName    = names.Item1;
                var rsAlias   = rsName;
                var fieldName = names.Item2;
                if (string.IsNullOrEmpty(fieldName) && string.IsNullOrEmpty(defaultFieldName))
                {
                    continue;
                }

                if (string.IsNullOrEmpty(fieldName) && !string.IsNullOrEmpty(defaultFieldName))
                {
                    fieldName = defaultFieldName;
                }

                // Bug 10532 - Amend to remove : from the alias ;)
                var fieldAlias = fieldName.Replace(":", "");

                var pathLoop = path;
                var rsField  = currentFields.FirstOrDefault(f => f.Path == pathLoop) ?? new RecordsetField {
                    Path = path, Alias = fieldAlias, RecordsetAlias = rsAlias
                };
                rsField.Name = fieldName;

                var rs = result.FirstOrDefault(r => r.Name == rsName);
                if (rs == null)
                {
                    rs = new Recordset {
                        Name = rsName
                    };
                    result.Add(rs);
                }
                var fieldIndex = rs.Fields.Count;
                rs.Fields.Add(rsField);

                var data = path.SampleData.Split(',');
                for (var recordIndex = 0; recordIndex < data.Length; recordIndex++)
                {
                    rs.SetValue(recordIndex, fieldIndex, data[recordIndex]);
                }
            }
            return(result);
        }
Beispiel #10
0
        // BUG 9626 - 2013.06.11 - TWR : refactored
        protected RecordsetList CreateOutputsRecordsetList(XElement action)
        {
            var result = new RecordsetList();

            var outputDescriptionStr = action.ElementSafe("OutputDescription");
            var paths = new List <IPath>();

            if (!string.IsNullOrEmpty(outputDescriptionStr))
            {
                var outputDescriptionSerializationService = OutputDescriptionSerializationServiceFactory.CreateOutputDescriptionSerializationService();
                var description = outputDescriptionSerializationService.Deserialize(outputDescriptionStr);

                if (description == null)
                {
                    // we need to handle old plugins ;)
                    outputDescriptionStr =
                        outputDescriptionStr.Replace("<JSON />", "")
                        .Replace("</Dev2XMLResult>", "")
                        .Replace("</InterrogationResult>", "")
                        .Replace("<InterrogationResult>", "")
                        .Replace("<Dev2XMLResult>", "");

                    description = outputDescriptionSerializationService.Deserialize(outputDescriptionStr);
                }

                // TODO : Get Result Coming Back ;)

                OutputDescription = description;

                if (description != null && description.DataSourceShapes.Count > 0)
                {
                    paths = description.DataSourceShapes[0].Paths;
                }
            }
            var xElement = action.Element("Outputs");

            if (xElement != null)
            {
                OutputSpecification = xElement.ToString();
            }
            foreach (var output in action.Descendants("Output"))
            {
                var rsName     = output.AttributeSafe("RecordsetName");
                var rsAlias    = output.AttributeSafe("Recordset"); // legacy - should be RecordsetAlias
                var fieldName  = output.AttributeSafe("OriginalName");
                var fieldAlias = output.AttributeSafe("MapsTo");

                var path = paths.FirstOrDefault(p => output.AttributeSafe("Value").Equals(p.OutputExpression, StringComparison.InvariantCultureIgnoreCase));
                if (path != null)
                {
                    var names = RecordsetListHelper.SplitRecordsetAndFieldNames(path);
                    if (string.IsNullOrEmpty(rsName))
                    {
                        rsName = names.Item1;
                    }
                    if (string.IsNullOrEmpty(fieldName))
                    {
                        fieldName = names.Item2;
                    }
                }

                var recordset = result.FirstOrDefault(r => r.Name == rsName);
                if (recordset == null)
                {
                    recordset = new Recordset {
                        Name = rsName
                    };
                    result.Add(recordset);
                }

                recordset.Fields.Add(new RecordsetField
                {
                    Name           = fieldName,
                    Alias          = fieldAlias,
                    RecordsetAlias = rsAlias,
                    Path           = path
                });
            }

            return(result);
        }
 public static RecordsetList ToRecordsetList(this IOutputDescription outputDescription, RecordsetList currentList) => outputDescription.ToRecordsetList(currentList, "");