Beispiel #1
0
        /// <summary>
        /// Will create a scalar template
        /// </summary>
        /// <param name="theNameSpace">The name space.</param>
        /// <param name="fieldName">Name of the field.</param>
        /// <param name="description">The description.</param>
        /// <param name="overwrite">if set to <c>true</c> [overwrite].</param>
        /// <param name="isEditable">if set to <c>true</c> [is editable].</param>
        /// <param name="ioDir"></param>
        /// <param name="error">The error.</param>
        /// <returns></returns>
        public bool TryCreateScalarTemplate(string theNameSpace, string fieldName, string description, bool overwrite, bool isEditable, enDev2ColumnArgumentDirection ioDir, out string error)
        {
            bool result = false;

            error = string.Empty;
            string key = CreateKey(theNameSpace, fieldName);

            if (CollectionExist(key) && !overwrite)
            {
                error = "Template already exist for scalar [ " + fieldName + " ]";
            }
            else
            {
                IBinaryDataListEntry template = new BinaryDataListEntry(key, description, isEditable, ioDir, UID);
                _templateDict[key] = template;
                result             = true;
                // create scalar intellisense part ;)
                if (!theNameSpace.Equals(GlobalConstants.SystemTagNamespace))
                {
                    CreateIntelliseneResult(key);
                }
            }

            return(result);
        }
Beispiel #2
0
        /// <summary>
        /// Will create a recordset template
        /// </summary>
        /// <param name="theNameSpace">The name space.</param>
        /// <param name="description">The description.</param>
        /// <param name="columns">The columns.</param>
        /// <param name="overwrite">if set to <c>true</c> [overwrite].</param>
        /// <param name="isEditable">if set to <c>true</c> [is editable].</param>
        /// <param name="ioDir">The io dir.</param>
        /// <param name="error">The error.</param>
        /// <returns></returns>
        public bool TryCreateRecordsetTemplate(string theNameSpace, string description, IList <Dev2Column> columns, bool overwrite, bool isEditable, enDev2ColumnArgumentDirection ioDir, out string error)
        {
            bool result = false;

            error = string.Empty;

            if (CollectionExist(theNameSpace) && !overwrite)
            {
                error = "Template already exist for recordset [ " + theNameSpace + " ]";
            }
            else
            {
                IBinaryDataListEntry template = new BinaryDataListEntry(theNameSpace, description, columns, isEditable, ioDir, UID);
                _templateDict[theNameSpace] = template;
                result = true;

                if (!theNameSpace.Equals(GlobalConstants.SystemTagNamespace))
                {
                    // create intellisense parts for the recordset ;)
                    CreateIntelliseneResult(theNameSpace, columns);
                }
            }

            return(result);
        }
Beispiel #3
0
        public IBinaryDataListEntry Clone(enTranslationDepth depth, Guid clonedStorageId, out string error)
        {
            error = string.Empty;
            BinaryDataListEntry result;
            Guid dlKey = DataListKey;

            if (clonedStorageId != GlobalConstants.NullDataListID)
            {
                dlKey = clonedStorageId;
            }

            if (Columns != null)
            {
                // clone the columns
                IList <Dev2Column> cols = new List <Dev2Column>(Columns.Count);
                foreach (Dev2Column c in Columns)
                {
                    cols.Add(new Dev2Column(c.ColumnName, c.ColumnDescription));
                }
                result = new BinaryDataListEntry(Namespace, Description, cols, dlKey);
            }
            else
            {
                result = new BinaryDataListEntry(Namespace, Description, dlKey);
            }

            // 2013.09.09 - we're the same, just adjust the view and return
            if (clonedStorageId.Equals(DataListKey))
            {
                // manip result's _internalObj aka the view of the data ;)
                result._internalObj.CopyTo(_internalObj);
                // copy express auditing data too ;)
                result.ComplexExpressionAuditor = ComplexExpressionAuditor;
            }

            if (depth == enTranslationDepth.Data || depth == enTranslationDepth.Data_With_Blank_OverWrite)
            {
                // clone _items
                if (IsRecordset)
                {
                    IIndexIterator ii      = _internalObj.Keys;
                    bool           isEmtpy = _internalObj.IsEmtpy;
                    result._internalObj.IsEmtpy = isEmtpy;
                    while (ii.HasMore())
                    {
                        int next = ii.FetchNextIndex();
                        // clone the data
                        IList <IBinaryDataListItem> items = _internalObj[next];
                        IList <IBinaryDataListItem> clone = new List <IBinaryDataListItem>();
                        // Bug 8725
                        if (items != null)
                        {
                            foreach (IBinaryDataListItem itm in items)
                            {
                                clone.Add(itm.Clone());
                            }
                        }
                        // now push back clone
                        result._internalObj[next] = clone;
                    }

                    // ensure we reset min index if not 1 ;)
                    var keys = _internalObj.Keys;
                    var min  = keys.MinIndex();
                    var max  = keys.MaxIndex();
                    var gaps = _internalObj.FetchGaps();
                    result._internalObj.MoveIndexDataForClone(min, max, gaps, false);
                }
                else
                {
                    IList <IBinaryDataListItem> items = _internalObj[0];
                    IList <IBinaryDataListItem> clone = items.Select(itm => itm.Clone()).ToList();

                    // now push back clone
                    result._internalObj[0]      = clone;
                    result._internalObj.IsEmtpy = false;
                }
            }
            else // only wanted the shape cloned
            {
                var keys = _internalObj.Keys;
                var min  = keys.MinIndex();
                var max  = keys.MaxIndex();
                var gaps = _internalObj.FetchGaps();
                result._internalObj.MoveIndexDataForClone(min, max, gaps, false);
            }

            result.ComplexExpressionAuditor = ComplexExpressionAuditor;

            return(result);
        }