CreateFormat() public static method

Gets the DatalistFormat instance that represents the given formatName, or creates a new one if a DatalistFormat instance does not exist for the given formatName.
formatName cannot be null or empty string.
public static CreateFormat ( string formatName, EmitionTypes publicFormatName = EmitionTypes.XML, string headerType = "" ) : DataListFormat
formatName string The display name of the datalist format.
publicFormatName EmitionTypes Name of the public format.
headerType string Type of the header.
return DataListFormat
Exemplo n.º 1
0
        /// <summary>
        /// Gets the wizard data list for a workflow.
        /// </summary>
        /// <param name="dataList"></param>
        /// <returns>
        /// The string for the data list
        /// </returns>
        /// <exception cref="System.Exception">
        /// </exception>
        public string GetWizardDataListForWorkflow(string dataList)
        {
            IBinaryDataList newDl = Dev2BinaryDataListFactory.CreateDataList();
            ErrorResultTO   errors;
            var             dataListStringBuilder = new StringBuilder(dataList);
            Guid            dlID = ConvertTo(DataListFormat.CreateFormat(GlobalConstants._XML_Without_SystemTags), dataListStringBuilder, dataListStringBuilder, out errors);

            if (!errors.HasErrors())
            {
                IBinaryDataList dl = FetchBinaryDataList(dlID, out errors);
                if (!errors.HasErrors())
                {
                    IList <IBinaryDataListEntry> entries = dl.FetchAllEntries();
                    foreach (IBinaryDataListEntry entry in entries)
                    {
                        if (entry.IsRecordset)
                        {
                            if (entry.ColumnIODirection != enDev2ColumnArgumentDirection.None)
                            {
                                string tmpError;
                                newDl.TryCreateRecordsetTemplate(entry.Namespace, entry.Description, entry.Columns, true, out tmpError);
                            }
                        }
                        else
                        {
                            if (entry.ColumnIODirection != enDev2ColumnArgumentDirection.None)
                            {
                                string tmpError;
                                IBinaryDataListItem scalar = entry.FetchScalar();
                                newDl.TryCreateScalarTemplate(string.Empty, scalar.FieldName, entry.Description, true, out tmpError);
                            }
                        }
                    }
                    Guid newDlId = PushBinaryDataList(newDl.UID, newDl, out errors);
                    dataList = ConvertFrom(newDlId, DataListFormat.CreateFormat(GlobalConstants._XML_Without_SystemTags), enTranslationDepth.Shape, out errors).ToString();
                }
                else
                {
                    throw new Exception(errors.MakeUserReady());
                }
            }
            else
            {
                throw new Exception(errors.MakeUserReady());
            }
            return(dataList);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Shapes the dev2 definitions to data list.
        /// </summary>
        /// <param name="definitions">The definitions as string</param>
        /// <param name="defType">Type of the def.</param>
        /// <param name="pushToServer">if set to <c>true</c> [push to server].</param>
        /// <param name="errors">The errors.</param>
        /// <param name="flipGeneration">if set to <c>true</c> [flip generation].</param>
        /// <returns></returns>
        public StringBuilder ShapeDev2DefinitionsToDataList(string definitions, enDev2ArgumentType defType, bool pushToServer, out ErrorResultTO errors, bool flipGeneration = false)
        {
            var           dataList = ShapeDefinitionsToDataList(definitions, defType, out errors, flipGeneration);
            StringBuilder result;

            if (pushToServer)
            {
                //  Push to server and return GUID
                byte[] data = new byte[0];
                result = new StringBuilder(_svrCompiler.ConvertTo(null, DataListFormat.CreateFormat(GlobalConstants._XML), data, dataList, out errors).ToString());
            }
            else
            {
                result = dataList; // else return the datalist as requested
            }

            return(result);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Generates the data list from defs.
        /// </summary>
        /// <param name="definitions">The definitions as binary objects</param>
        /// <param name="pushToServer">if set to <c>true</c> [push to server]. the GUID is returned</param>
        /// <param name="errors">The errors.</param>
        /// <param name="withData"></param>
        /// <returns></returns>
        public StringBuilder GenerateDataListFromDefs(IList <IDev2Definition> definitions, bool pushToServer, out ErrorResultTO errors, bool withData = false)
        {
            errors = new ErrorResultTO();
            var           dataList = GenerateDataListFromDefs(definitions, withData);
            StringBuilder result;

            if (pushToServer)
            {
                byte[] data = new byte[0];
                result = new StringBuilder(_svrCompiler.ConvertTo(null, DataListFormat.CreateFormat(GlobalConstants._XML), data, dataList, out errors).ToString());
            }
            else
            {
                result = dataList;
            }

            return(result);
        }