public CswViewBuilderProp(CswNbtMetaDataNodeTypeProp NodeTypeProp)
        {
            CswNbtMetaDataNodeType nt = NodeTypeProp.getNodeType();

            if (null != nt)
            {
                OwnerName = nt.NodeTypeName;
            }
            FieldType = NodeTypeProp.getFieldTypeValue();
            //ListOptions.FromString( NodeTypeProp.ListOptions );
            ListOptions.FromString(NodeTypeProp.DesignNode.AttributeProperty[CswEnumNbtPropertyAttributeName.Options].AsText.Text);
            RelatedIdType = CswEnumNbtViewRelatedIdType.NodeTypeId;
            MetaDataPropNameWithQuestionNo = NodeTypeProp.PropNameWithQuestionNo;
            MetaDataPropId   = NodeTypeProp.FirstPropVersionId;
            MetaDataPropName = NodeTypeProp.PropName;
            MetaDataTypeName = NodeTypeProp.getNodeType().NodeTypeName;
            FieldTypeRule    = NodeTypeProp.getFieldTypeRule();
            Type             = CswEnumNbtViewPropType.NodeTypePropId;
            PropName         = MetaDataPropName;
            AssociatedPropIds.Add(MetaDataPropId.ToString());
            if (NodeTypeProp.ObjectClassPropId != Int32.MinValue)
            {
                AssociatedPropIds.Add(NodeTypeProp.ObjectClassPropId.ToString());
            }
        } //ctor Ntp
 public ICswNbtFieldTypeRule getFieldTypeRule()
 {
     if (_FieldTypeRule == null)
     {
         _FieldTypeRule = _CswNbtMetaDataResources.makeFieldTypeRule(this.getFieldTypeValue());
     }
     return(_FieldTypeRule);
 }
Exemple #3
0
        /// <summary>
        /// Returns the original value of the default subfield for this property
        /// </summary>
        public string GetOriginalPropRowValue()
        {
            string ret = string.Empty;
            ICswNbtFieldTypeRule FieldTypeRule = _CswNbtMetaDataNodeTypeProp.getFieldTypeRule();

            if (FieldTypeRule != null)
            {
                ret = GetOriginalPropRowValue(FieldTypeRule.SubFields.Default.Column);
            }
            return(ret);
        }
Exemple #4
0
        /// <summary>
        /// Returns the original value of the provided subfield for this property
        /// </summary>
        public string GetOriginalPropRowValue(CswEnumNbtSubFieldName SubfieldName)
        {
            string ret = string.Empty;
            ICswNbtFieldTypeRule FieldTypeRule = _CswNbtMetaDataNodeTypeProp.getFieldTypeRule();

            if (FieldTypeRule != null)
            {
                CswEnumNbtPropColumn Column = FieldTypeRule.SubFields[SubfieldName].Column;
                ret = GetOriginalPropRowValue(Column);
            }
            return(ret);
        }
        } //ctor Ntp

        public CswViewBuilderProp(CswNbtViewProperty ViewProperty)
        {
            if (ViewProperty.Type == CswEnumNbtViewPropType.NodeTypePropId &&
                null != ViewProperty.NodeTypeProp)
            {
                OwnerName = _getOwnerName(ViewProperty);
                FieldType = ViewProperty.NodeTypeProp.getFieldTypeValue();
                //ListOptions.FromString( ViewProperty.NodeTypeProp.ListOptions );
                if (ViewProperty.NodeTypeProp.DesignNode.AttributeProperty.ContainsKey(CswEnumNbtPropertyAttributeName.Options))
                {
                    ListOptions.FromString(ViewProperty.NodeTypeProp.DesignNode.AttributeProperty[CswEnumNbtPropertyAttributeName.Options].AsText.Text);
                }
                RelatedIdType = CswEnumNbtViewRelatedIdType.NodeTypeId;
                MetaDataPropNameWithQuestionNo = ViewProperty.NodeTypeProp.PropNameWithQuestionNo;
                MetaDataPropId   = ViewProperty.NodeTypeProp.FirstPropVersionId;
                MetaDataPropName = ViewProperty.NodeTypeProp.PropName;
                MetaDataTypeName = ViewProperty.NodeTypeProp.getNodeType().NodeTypeName;
                FieldTypeRule    = ViewProperty.NodeTypeProp.getFieldTypeRule();
                AssociatedPropIds.Add(MetaDataPropId.ToString());
                if (ViewProperty.NodeTypeProp.ObjectClassPropId != Int32.MinValue)
                {
                    AssociatedPropIds.Add(ViewProperty.NodeTypeProp.ObjectClassPropId.ToString());
                }
            }
            else if (ViewProperty.Type == CswEnumNbtViewPropType.ObjectClassPropId &&
                     null != ViewProperty.ObjectClassProp)
            {
                CswNbtMetaDataObjectClass oc = ViewProperty.ObjectClassProp.getObjectClass();
                if (null != oc)
                {
                    OwnerName = oc.ObjectClass.Value;
                }
                FieldType = ViewProperty.ObjectClassProp.getFieldTypeValue();
                setObjectClassPropListOptions(ViewProperty.ObjectClassProp);
                RelatedIdType = CswEnumNbtViewRelatedIdType.ObjectClassId;
                MetaDataPropNameWithQuestionNo = ViewProperty.ObjectClassProp.PropNameWithQuestionNo;
                MetaDataPropId   = ViewProperty.ObjectClassProp.ObjectClassPropId;
                MetaDataPropName = ViewProperty.ObjectClassProp.PropName;
                MetaDataTypeName = ViewProperty.ObjectClassProp.getObjectClass().ObjectClass.ToString().Replace("Class", "");
                FieldTypeRule    = ViewProperty.ObjectClassProp.getFieldTypeRule();
                AssociatedPropIds.Add(MetaDataPropId.ToString());
            }
            ViewProp   = ViewProperty;
            FieldType  = ViewProperty.FieldType;
            Filters    = ViewProperty.Filters;
            Type       = ViewProperty.Type;
            Width      = ViewProperty.Width;
            SortBy     = ViewProperty.SortBy;
            SortMethod = ViewProperty.SortMethod;
            PropName   = ViewProperty.Name ?? MetaDataPropName;
        } //ctor Vp
        } //ctor Ntp

        public CswViewBuilderProp(CswNbtMetaDataObjectClassProp ObjectClassProp)
        {
            CswNbtMetaDataObjectClass oc = ObjectClassProp.getObjectClass();

            if (null != oc)
            {
                OwnerName = oc.ObjectClass.Value;
            }
            FieldType = ObjectClassProp.getFieldTypeValue();
            setObjectClassPropListOptions(ObjectClassProp);
            RelatedIdType = CswEnumNbtViewRelatedIdType.NodeTypeId;
            MetaDataPropNameWithQuestionNo = ObjectClassProp.PropNameWithQuestionNo;
            MetaDataPropId   = ObjectClassProp.ObjectClassPropId;
            MetaDataPropName = ObjectClassProp.PropName;
            MetaDataTypeName = ObjectClassProp.getObjectClass().ObjectClass.ToString();
            FieldTypeRule    = ObjectClassProp.getFieldTypeRule();
            Type             = CswEnumNbtViewPropType.ObjectClassPropId;
            PropName         = MetaDataPropName;
            AssociatedPropIds.Add(MetaDataPropId.ToString());
        } //ctor Ntp
Exemple #7
0
        /// <summary>
        /// Handles when the property value is copied to another node
        /// </summary>
        public void CopyGeneric(CswNbtNodePropData Source)
        {
            // Default, just copy the data values

            CswEnumNbtFieldType  FieldType     = Source.getFieldTypeValue();
            ICswNbtFieldTypeRule FieldTypeRule = _CswNbtResources.MetaData.getFieldTypeRule(FieldType);

            foreach (CswNbtSubField SubField in FieldTypeRule.SubFields)
            {
                if (SubField.Column == CswEnumNbtPropColumn.Field1_FK)
                {
                    //Implementing FieldType specific behavior here. Blame Steve.
                    if (FieldType == CswEnumNbtFieldType.ViewReference)
                    {
                        //we want to copy views to the new node by value, so changes to the view on either node don't affect the other
                        CswNbtView View     = _CswNbtResources.ViewSelect.restoreView(new CswNbtViewId(Source.Field1_Fk));
                        CswNbtView ViewCopy = new CswNbtView(_CswNbtResources);
                        ViewCopy.saveNew(View.ViewName, View.Visibility, View.VisibilityRoleId, View.VisibilityUserId, View);
                        SetSubFieldValue(CswEnumNbtSubFieldName.ViewID, ViewCopy.ViewId);
                    }
                    else
                    {
                        SetSubFieldValue(SubField.Name, Source.Field1_Fk);
                    }
                } // if( SubField.Column == CswEnumNbtPropColumn.Field1_FK )
                else
                {
                    SetSubFieldValue(SubField.Name, Source.GetPropRowValue(SubField));
                }
            } // foreach( CswNbtSubField SubField in NodeTypeProp.getFieldTypeRule().SubFields )

            // Also copy Gestalt, which usually isn't listed as a subfield
            SetSubFieldValue(CswEnumNbtSubFieldName.Gestalt, Source.Gestalt);
            SetSubFieldValue(CswEnumNbtSubFieldName.GestaltSearch, Source.GestaltSearch);

            //Case 31362 - also copy Blob_Data if necessary
            if (Source.getFieldTypeValue() == CswEnumNbtFieldType.MOL || Source.getFieldTypeValue() == CswEnumNbtFieldType.Image || Source.getFieldTypeValue() == CswEnumNbtFieldType.File)
            {
                CswNbtSdBlobData.CopyBlobData(_CswNbtResources, Source.JctNodePropId, JctNodePropId);
            }
        }
        } // loadRelationshipRecursive()

        private CswArbitrarySelect _makeNodeSql(CswNbtViewRelationship Relationship, IEnumerable <CswPrimaryKey> ParentNodeIds = null)
        {
            string CurrentUserIdClause = string.Empty;

            if (null != _CswNbtResources.CurrentNbtUser && null != _CswNbtResources.CurrentNbtUser.UserId)
            {
                CurrentUserIdClause = " and f.userid = " + _CswNbtResources.CurrentNbtUser.UserId.PrimaryKey;
            }
            CswCommaDelimitedString With = new CswCommaDelimitedString();
            string Select  = @"select n.nodeid,
                                     n.relationalid, n.relationaltable,
                                     n.nodename, 
                                     n.locked,
                                     nvl(n.iconfilename, t.iconfilename) iconfilename,
                                     t.nodetypename,
                                     t.nametemplate,
                                     t.nodetypeid,
                                     o.objectclass,
                                     o.objectclassid,
                                     f.userid";
            string From    = @"from nodes n
                            left join favorites f on n.nodeid = f.itemid " + CurrentUserIdClause + @"
                            join nodetypes t on (n.nodetypeid = t.nodetypeid)
                            join object_class o on (t.objectclassid = o.objectclassid) ";
            string OrderBy = string.Empty;

            // Nodetype/Object Class filter
            string Where;

            if (Relationship.SecondType == CswEnumNbtViewRelatedIdType.NodeTypeId)
            {
                Where = " where (t.firstversionid = " + Relationship.SecondId + ") ";
            }
            else if (Relationship.SecondType == CswEnumNbtViewRelatedIdType.ObjectClassId)
            {
                Where = " where (o.objectclassid = " + Relationship.SecondId + ") ";
            }
            else if (Relationship.SecondType == CswEnumNbtViewRelatedIdType.PropertySetId)
            {
                From += @" join jct_propertyset_objectclass jpo on (o.objectclassid = jpo.objectclassid) 
                           join property_set ps on (jpo.propertysetid = ps.propertysetid) ";
                Where = " where (ps.propertysetid = " + Relationship.SecondId + ") ";
            }
            else
            {
                throw new CswDniException(CswEnumErrorType.Error, "Invalid View", "CswNbtTreeLoaderFromXmlViewByLevel got a relationship with an unrecognized SecondType: " + Relationship.SecondType.ToString());
            }

            //If we have access to disabled module MetaData, we should have access to their Nodes as well
            if (_CswNbtResources.MetaData.ExcludeDisabledModules)
            {
                // case 26029
                Where += " and t.enabled = '1' ";
            }

            // Parent Node
            if (Relationship.PropId != Int32.MinValue && null != ParentNodeIds)
            {
                bool   first       = true;
                string parentsWith = "parents as (";
                foreach (Int32 ParentNodeId in ParentNodeIds.Select(key => key.PrimaryKey))
                {
                    if (first)
                    {
                        first = false;
                    }
                    else
                    {
                        parentsWith += " union ";
                    }
                    parentsWith += "select " + ParentNodeId + " nodeid from dual ";
                }
                parentsWith += ")";
                With.Add(parentsWith);

                Select += ",parent.parentnodeid ";

                if (Relationship.PropOwner == CswEnumNbtViewPropOwnerType.First)
                {
                    From += @"            join (select jnp.nodeid parentnodeid, jnp.field1_fk thisnodeid
                                                  from jct_nodes_props jnp
                                                  join nodetype_props p on (jnp.nodetypepropid = p.nodetypepropid) ";
                    if (Relationship.PropType == CswEnumNbtViewPropIdType.NodeTypePropId)
                    {
                        From += @"               where p.firstpropversionid = " + Relationship.PropId;
                    }
                    else
                    {
                        From += @"                join object_class_props op on (p.objectclasspropid = op.objectclasspropid)
                                                 where op.objectclasspropid = " + Relationship.PropId;
                    }
                    From += @"                ) parent on (parent.thisnodeid = n.nodeid)";
                }
                else
                {
                    From += @"          join (select jnp.nodeid thisnodeid, jnp.field1_fk parentnodeid
                                                from jct_nodes_props jnp
                                                join nodetype_props p on (jnp.nodetypepropid = p.nodetypepropid) ";
                    if (Relationship.PropType == CswEnumNbtViewPropIdType.NodeTypePropId)
                    {
                        From += @"             where p.firstpropversionid = " + Relationship.PropId;
                    }
                    else
                    {
                        From += @"              join object_class_props op on (p.objectclasspropid = op.objectclasspropid)
                                               where op.objectclasspropid = " + Relationship.PropId;
                    }
                    From += @"        ) parent on (parent.thisnodeid = n.nodeid)";
                }
                From += " join parents on (parent.parentnodeid = parents.nodeid) ";
            } // if( Relationship.PropId != Int32.MinValue )

            CswCommaDelimitedString OrderByProps = new CswCommaDelimitedString();

            OrderByProps.Add("f.userid");
            // Grouping
            if (Relationship.GroupByPropId != Int32.MinValue)
            {
                CswNbtSubField GroupBySubField = _getDefaultSubFieldForProperty(Relationship.GroupByPropType, Relationship.GroupByPropId);
                Select += " ,g." + GroupBySubField.Column + " groupname";
                OrderByProps.Add("g." + GroupBySubField.Column);
                if (Relationship.GroupByPropType == CswEnumNbtViewPropIdType.ObjectClassPropId)
                {
                    From += @" left outer join (select j.nodeid, " + GroupBySubField.Column + @" 
                                                    from jct_nodes_props j 
                                                    join nodetype_props p on j.nodetypepropid = p.nodetypepropid 
                                                    where p.objectclasspropid = " + Relationship.GroupByPropId.ToString() + @") g
                                on (g.nodeid = n.nodeid)";
                }
                else
                {
                    From += @" left outer join (select j.nodeid, " + GroupBySubField.Column + @" 
                                                    from jct_nodes_props j 
                                                    where j.nodetypepropid = " + Relationship.GroupByPropId.ToString() + @") g 
                                on (g.nodeid = n.nodeid)";
                }
            } // if( Relationship.GroupByPropId != Int32.MinValue )

            // Handle sort order
            Int32  sortAlias     = 0;
            String OrderByString = String.Empty;

            foreach (CswNbtViewProperty Prop in Relationship.Properties)
            {
                if (Prop.SortBy)
                {
                    // Case 10530
                    sortAlias++;
                    if (null != Prop.MetaDataProp)
                    {
                        CswEnumNbtPropColumn SubFieldColumn = Prop.MetaDataProp.getFieldTypeRule().SubFields.Default.Column;
                        string aliasName = "mssqlorder" + sortAlias;
                        Select += ",(select ";
                        if (SubFieldColumn == CswEnumNbtPropColumn.Field1_Numeric ||
                            SubFieldColumn == CswEnumNbtPropColumn.Field1_Date ||
                            SubFieldColumn == CswEnumNbtPropColumn.Field2_Numeric ||
                            SubFieldColumn == CswEnumNbtPropColumn.Field2_Date)
                        {
                            Select += SubFieldColumn.ToString();
                        }
                        else
                        {
                            Select += "lower(" + SubFieldColumn.ToString() + ")";
                        }
                        Select += " from jct_nodes_props where nodeid = n.nodeid and ";
                        if (Prop.Type == CswEnumNbtViewPropType.NodeTypePropId)
                        {
                            Select += "nodetypepropid = " + Prop.NodeTypePropId;
                        }
                        else
                        {
                            Select += "nodetypepropid in (select nodetypepropid from nodetype_props where objectclasspropid = " + Prop.ObjectClassPropId + ")";
                        }
                        Select += ") as " + aliasName;

                        // Case 10533
                        if (SubFieldColumn == CswEnumNbtPropColumn.Gestalt ||
                            SubFieldColumn == CswEnumNbtPropColumn.ClobData)
                        {
                            OrderByString = "lower(to_char(" + aliasName + "))";
                        }
                        else if (SubFieldColumn == CswEnumNbtPropColumn.Field1_Numeric ||
                                 SubFieldColumn == CswEnumNbtPropColumn.Field1_Date ||
                                 SubFieldColumn == CswEnumNbtPropColumn.Field2_Numeric ||
                                 SubFieldColumn == CswEnumNbtPropColumn.Field2_Date)
                        {
                            OrderByString = aliasName;
                        }
                        else
                        {
                            OrderByString = "lower(" + aliasName + ")";
                        }

                        if (Prop.SortMethod == CswEnumNbtViewPropertySortMethod.Descending)
                        {
                            OrderByString += " desc";
                        }

                        Int32 OrderByOrder = Prop.Order;
                        if (OrderByOrder != 0 && (OrderByProps.Count <= OrderByOrder || OrderByOrder < 0))
                        {
                            if (OrderByProps.Count == 0)
                            {
                                OrderByOrder = 0;
                            }
                            else
                            {
                                OrderByOrder = OrderByProps.Count - 1;
                            }
                        }

                        OrderByProps.Insert(OrderByOrder, OrderByString);
                    }
                } // if( Prop.SortBy )
            }     // foreach( CswNbtViewProperty Prop in Relationship.Properties )

            // case 29193: always fall back on name sort
            sortAlias++;
            Select += ",lower(n.nodename) mssqlorder" + sortAlias;
            OrderByProps.Add("lower(n.nodename)");

            OrderBy = " order by " + OrderByProps.ToString() + " ";
            // for property multiplexing
            OrderBy += ",n.nodeid";
            if (Relationship.PropId != Int32.MinValue && null != ParentNodeIds)
            {
                OrderBy += ",parent.parentnodeid ";
            }

            // Properties for Select
            if (Relationship.Properties.Count > 0)
            {
                CswCommaDelimitedString NTPropsInClause = new CswCommaDelimitedString(0, "'");
                CswCommaDelimitedString OCPropsInClause = new CswCommaDelimitedString(0, "'");
                foreach (CswNbtViewProperty Prop in Relationship.Properties)
                {
                    if (Prop.Type == CswEnumNbtViewPropType.NodeTypePropId && Prop.NodeTypePropId != Int32.MinValue)
                    {
                        NTPropsInClause.Add(Prop.NodeTypePropId.ToString());
                    }
                    else if (Prop.ObjectClassPropId != Int32.MinValue)
                    {
                        OCPropsInClause.Add(Prop.ObjectClassPropId.ToString());
                    }
                }

                // This will multiplex the results by the number of properties!
                if (NTPropsInClause.Count > 0 || OCPropsInClause.Count > 0)
                {
                    // Properties
                    // We match on propname because that's how the view editor works.
                    Select += @" ,props.nodetypepropid, props.objectclasspropid, props.propname, props.objectclasspropname, props.fieldtype ";

                    string propsWith = "props as (";
                    if (NTPropsInClause.Count > 0)
                    {
                        propsWith += @"  select p2.nodetypeid, p2.nodetypepropid, p2.objectclasspropid, p2.propname, f.fieldtype, ocp2.propname as objectclasspropname
                                from nodetype_props p1
                                join nodetype_props p2 on (p2.firstpropversionid = p1.firstpropversionid or p1.propname = p2.propname)
                                left outer join object_class_props ocp2 on p2.objectclasspropid = ocp2.objectclasspropid
                                join field_types f on f.fieldtypeid = p2.fieldtypeid
                                where p1.nodetypepropid in (" + NTPropsInClause.ToString() + @")";
                        if (OCPropsInClause.Count > 0)
                        {
                            propsWith += @" UNION ALL ";
                        }
                    }
                    if (OCPropsInClause.Count > 0)
                    {
                        propsWith += @" select ntp.nodetypeid, ntp.nodetypepropid, ntp.objectclasspropid, ntp.propname, f.fieldtype, op.propname as objectclasspropname
                                from object_class_props op
                                join nodetype_props ntp on (ntp.objectclasspropid = op.objectclasspropid or ntp.propname = op.propname)
                                join field_types f on f.fieldtypeid = ntp.fieldtypeid
                                where op.objectclasspropid in (" + OCPropsInClause.ToString() + @")";
                    }
                    propsWith += @"   )";
                    With.Add(propsWith);

                    From += " left outer join props on (props.nodetypeid = t.nodetypeid)";  // intentional multiplexing

                    // Property Values
                    Select += @" ,propval.jctnodepropid, propval.gestalt, propval.field1, propval.field2, propval.field1_fk, propval.field1_numeric, propval.hidden, propval.field1_big ";
                    From   += @"  left outer join jct_nodes_props propvaljoin on (props.nodetypepropid = propvaljoin.nodetypepropid and propvaljoin.nodeid = n.nodeid) "; // better performance from indexes if we do this first
                    From   += @"  left outer join jct_nodes_props propval on (propval.jctnodepropid = propvaljoin.jctnodepropid) ";
                } // if( NTPropsInClause.Count > 0 || OCPropsInClause.Count > 0 )
            } // if(Relationship.Properties.Count > 0)

            // Property Filters
            Int32  FilterCount = 0;
            string FilterWhere = string.Empty;
            Dictionary <string, string> FilterParameters = new Dictionary <string, string>();

            foreach (CswNbtViewProperty Prop in Relationship.Properties)
            {
                foreach (CswNbtViewPropertyFilter Filter in Prop.Filters)
                {
                    if (Filter.FilterMode == CswEnumNbtFilterMode.Null ||
                        Filter.FilterMode == CswEnumNbtFilterMode.NotNull ||
                        Filter.Value != string.Empty)
                    {
                        FilterCount += 1;
                        ICswNbtFieldTypeRule FilterFieldTypeRule = _CswNbtResources.MetaData.getFieldTypeRule(Prop.FieldType);
                        string FilterValue = string.Empty;
                        if (null != FilterFieldTypeRule)
                        {
                            FilterValue = FilterFieldTypeRule.renderViewPropFilter(_RunAsUser, Filter, FilterParameters, FilterCount);
                        }
                        if (false == string.IsNullOrEmpty(FilterValue))
                        {
                            CswNbtSubField FilterSubField = FilterFieldTypeRule.SubFields[Filter.SubfieldName];

                            //if( FilterSubField.RelationalTable == string.Empty )
                            //{
                            string FilterClause = string.Empty;    // @"select z.nodeid, '1' as included from nodes z where ";
                            if (Filter.FilterMode == CswEnumNbtFilterMode.Null ||
                                Filter.FilterMode == CswEnumNbtFilterMode.NotEquals ||
                                Filter.FilterMode == CswEnumNbtFilterMode.NotContains)
                            {
                                FilterClause += @"select z.nodeid, '1' as included 
                                                        from nodes z ";

                                if (Relationship.SecondType == CswEnumNbtViewRelatedIdType.NodeTypeId)
                                {
                                    FilterClause += @" join nodetypes t on z.nodetypeid = t.nodetypeid
                                                          where (t.firstversionid = :filt" + FilterCount + "relid) ";
                                }
                                else if (Relationship.SecondType == CswEnumNbtViewRelatedIdType.ObjectClassId)
                                {
                                    FilterClause += @" join nodetypes t on z.nodetypeid = t.nodetypeid
                                                           join object_class o on t.objectclassid = o.objectclassid
                                                          where (o.objectclassid = :filt" + FilterCount + "relid) ";
                                }
                                else if (Relationship.SecondType == CswEnumNbtViewRelatedIdType.PropertySetId)
                                {
                                    FilterClause += @" join nodetypes t on z.nodetypeid = t.nodetypeid
                                                           join object_class o on t.objectclassid = o.objectclassid
                                                           join jct_propertyset_objectclass jpo on (o.objectclassid = jpo.objectclassid) 
                                                           join property_set ps on (jpo.propertysetid = ps.propertysetid) 
                                                          where (ps.propertysetid = :filt" + FilterCount + "relid) ";
                                }
                                FilterClause += @"      and (z.nodeid not in (
                                                           select jnp.nodeid
                                                             from jct_nodes_props jnp
                                                             join nodetype_props p on (jnp.nodetypepropid = p.nodetypepropid) ";

                                if (Prop.Type == CswEnumNbtViewPropType.NodeTypePropId)
                                {
                                    FilterClause += @"  where (lower(p.propname) = :filt" + FilterCount + @"ntpname)) ";
                                }
                                else
                                {
                                    FilterClause += @"   join object_class_props op on (p.objectclasspropid = op.objectclasspropid)
                                                            where op.objectclasspropid = :filt" + FilterCount + @"ocpid)";
                                }
                                FilterClause += @" or z.nodeid in (select n.nodeid from nodes n ";
                            }
                            else
                            {
                                FilterClause += @"select n.nodeid, '1' as included from nodes n ";
                            }

                            if (Prop.Type == CswEnumNbtViewPropType.NodeTypePropId)
                            {
                                FilterClause += @"            join nodetype_props p on (lower(p.propname) = :filt" + FilterCount + @"ntpname) ";
                                FilterParameters.Add("filt" + FilterCount + "ntpname", CswTools.SafeSqlParam(Prop.NodeTypeProp.PropName.ToLower()));
                            }
                            else
                            {
                                FilterClause += @"            join object_class_props op on (op.objectclasspropid = :filt" + FilterCount + @"ocpid)
                                                                  join nodetype_props p on (p.objectclasspropid = op.objectclasspropid) ";
                                FilterParameters.Add("filt" + FilterCount + "ocpid", Prop.ObjectClassPropId.ToString());
                            }
                            FilterClause += @"                join jct_nodes_props jnp on (jnp.nodeid = n.nodeid and jnp.nodetypepropid = p.nodetypepropid) ";

                            FilterParameters.Add("filt" + FilterCount + "relid", Relationship.SecondId.ToString());
                            if (Relationship.SecondType == CswEnumNbtViewRelatedIdType.NodeTypeId)
                            {
                                FilterClause += @" join nodetypes t on n.nodetypeid = t.nodetypeid
                                                        where (t.firstversionid = :filt" + FilterCount + "relid) ";
                            }
                            else if (Relationship.SecondType == CswEnumNbtViewRelatedIdType.ObjectClassId)
                            {
                                FilterClause += @" join nodetypes t on n.nodetypeid = t.nodetypeid
                                                        join object_class o on t.objectclassid = o.objectclassid
                                                        where (o.objectclassid = :filt" + FilterCount + "relid) ";
                            }
                            else if (Relationship.SecondType == CswEnumNbtViewRelatedIdType.PropertySetId)
                            {
                                FilterClause += @" join nodetypes t on n.nodetypeid = t.nodetypeid
                                                        join object_class o on t.objectclassid = o.objectclassid
                                                        join jct_propertyset_objectclass jpo on (o.objectclassid = jpo.objectclassid) 
                                                        join property_set ps on (jpo.propertysetid = ps.propertysetid) 
                                                        where (ps.propertysetid = :filt" + FilterCount + "relid) ";
                            }

                            FilterClause += @" and " + FilterValue + @"";
                            if (Filter.FilterMode == CswEnumNbtFilterMode.Null ||
                                Filter.FilterMode == CswEnumNbtFilterMode.NotEquals ||
                                Filter.FilterMode == CswEnumNbtFilterMode.NotContains)
                            {
                                FilterClause += "))";
                            }

                            With.Add("filt" + FilterCount.ToString() + " as (" + FilterClause + ")");

                            From += "left outer join filt" + FilterCount.ToString() + " f" + FilterCount.ToString() + " on (f" + FilterCount.ToString() + ".nodeid = n.nodeid)";
                            if (Filter.ResultMode == CswEnumNbtFilterResultMode.Disabled)
                            {
                                Select += ",f" + FilterCount.ToString() + ".included as included" + Filter.Conjunction.ToString() + FilterCount.ToString();
                            }
                            if (Filter.ResultMode == CswEnumNbtFilterResultMode.Hide)
                            {
                                if (FilterWhere != string.Empty)
                                {
                                    FilterWhere += Filter.Conjunction.ToString().ToLower();
                                }
                                FilterWhere += " f" + FilterCount.ToString() + ".included = '1' ";
                            }

                            //} // if( FilterSubField.RelationalTable == string.empty )
                            //else if( false == string.IsNullOrEmpty( FilterValue ) )
                            //{
                            //    FilterWhere += Filter.Conjunction.ToString().ToLower() + " " + FilterValue;
                            //}
                        } // if we really have a filter
                    }     // if we have a filter
                }         // foreach( CswNbtViewPropertyFilter Filter in Prop.Filters )
            }             // foreach( CswNbtViewProperty Prop in Relationship.Properties )
            if (FilterWhere != string.Empty)
            {
                Where += "and (" + FilterWhere + ")";
            }

            if (Relationship.NodeIdsToFilterOut.Count > 0)
            {
                string inclause = "";
                bool   first    = true;
                foreach (CswPrimaryKey NodeId in Relationship.NodeIdsToFilterOut)
                {
                    if (NodeId != null)
                    {
                        if (first)
                        {
                            first = false;
                        }
                        else
                        {
                            inclause += ",";
                        }
                        inclause += NodeId.PrimaryKey.ToString();
                    }
                }
                if (inclause != string.Empty)
                {
                    Where += " and n.nodeid not in ( " + inclause + " ) ";
                }
            }
            if (Relationship.NodeIdsToFilterIn.Count > 0)
            {
                string inclause = "";
                bool   first    = true;
                foreach (CswPrimaryKey NodeId in Relationship.NodeIdsToFilterIn)
                {
                    if (NodeId != null)
                    {
                        if (first)
                        {
                            first = false;
                        }
                        else
                        {
                            inclause += ",";
                        }
                        inclause += NodeId.PrimaryKey.ToString();
                    }
                }
                if (inclause != string.Empty)
                {
                    Where += " and n.nodeid in ( " + inclause + " ) ";
                }
            }

            // BZ 6008
            if (false == _IncludeSystemNodes)
            {
                Where += " and n.issystem = '0' ";
            }
            if (false == _IncludeHiddenNodes)
            {
                Where += " and n.hidden = '0' ";
            }
            if (false == _IncludeTempNodes)
            {
                Where += " and n.istemp= '0' ";
            }

            string Sql = string.Empty;

            if (With.Count > 0)
            {
                Sql = "with " + With.ToString(false);
            }
            Sql += " " + Select + " " + From + " " + Where + " " + OrderBy;


            CswArbitrarySelect Ret = _CswNbtResources.makeCswArbitrarySelect("TreeLoader_select", Sql);

            foreach (string Parameter in FilterParameters.Keys)
            {
                Ret.addParameter(Parameter, FilterParameters[Parameter]);
            }
            return(Ret);
        } //_makeNodeSql()
Exemple #9
0
        public static ICswNbtFieldTypeRule makeRule(CswNbtFieldResources CswNbtFieldResources, CswEnumNbtFieldType FieldType)
        {
            ICswNbtFieldTypeRule ReturnVal = null;

            //CswNbtFieldResources CswNbtFieldResources = new CswNbtFieldResources( CswNbtResources );

            switch (FieldType)
            {
            case CswEnumNbtFieldType.Barcode:
                ReturnVal = new CswNbtFieldTypeRuleBarCode(CswNbtFieldResources);
                break;

            case CswEnumNbtFieldType.Button:
                ReturnVal = new CswNbtFieldTypeRuleButton(CswNbtFieldResources);
                break;

            case CswEnumNbtFieldType.CASNo:
                ReturnVal = new CswNbtFieldTypeRuleCASNo(CswNbtFieldResources);
                break;

            case CswEnumNbtFieldType.ChildContents:
                ReturnVal = new CswNbtFieldTypeRuleChildContents(CswNbtFieldResources);
                break;

            case CswEnumNbtFieldType.Comments:
                ReturnVal = new CswNbtFieldTypeRuleComments(CswNbtFieldResources);
                break;

            case CswEnumNbtFieldType.Composite:
                ReturnVal = new CswNbtFieldTypeRuleComposite(CswNbtFieldResources);
                break;

            case CswEnumNbtFieldType.DateTime:
                ReturnVal = new CswNbtFieldTypeRuleDateTime(CswNbtFieldResources);
                break;

            case CswEnumNbtFieldType.External:
                ReturnVal = new CswNbtFieldTypeRuleExternal(CswNbtFieldResources);
                break;

            case CswEnumNbtFieldType.File:
                ReturnVal = new CswNbtFieldTypeRuleBlob(CswNbtFieldResources);
                break;

            case CswEnumNbtFieldType.Formula:
                ReturnVal = new CswNbtFieldTypeRuleFormula(CswNbtFieldResources);
                break;

            case CswEnumNbtFieldType.Grid:
                ReturnVal = new CswNbtFieldTypeRuleGrid(CswNbtFieldResources);
                break;

            case CswEnumNbtFieldType.Image:
                ReturnVal = new CswNbtFieldTypeRuleImage(CswNbtFieldResources);
                break;

            case CswEnumNbtFieldType.ImageList:
                ReturnVal = new CswNbtFieldTypeRuleImageList(CswNbtFieldResources);
                break;

            case CswEnumNbtFieldType.Link:
                ReturnVal = new CswNbtFieldTypeRuleLink(CswNbtFieldResources);
                break;

            case CswEnumNbtFieldType.List:
                ReturnVal = new CswNbtFieldTypeRuleList(CswNbtFieldResources);
                break;

            case CswEnumNbtFieldType.Location:
                ReturnVal = new CswNbtFieldTypeRuleLocation(CswNbtFieldResources);
                break;

            case CswEnumNbtFieldType.Logical:
                ReturnVal = new CswNbtFieldTypeRuleLogical(CswNbtFieldResources);
                break;

            case CswEnumNbtFieldType.LogicalSet:
                ReturnVal = new CswNbtFieldTypeRuleLogicalSet(CswNbtFieldResources);
                break;

            case CswEnumNbtFieldType.MetaDataList:
                ReturnVal = new CswNbtFieldTypeRuleMetaDataList(CswNbtFieldResources);
                break;

            case CswEnumNbtFieldType.Memo:
                ReturnVal = new CswNbtFieldTypeRuleMemo(CswNbtFieldResources);
                break;

            case CswEnumNbtFieldType.MOL:
                ReturnVal = new CswNbtFieldTypeRuleMol(CswNbtFieldResources);
                break;

            case CswEnumNbtFieldType.MTBF:
                ReturnVal = new CswNbtFieldTypeRuleMTBF(CswNbtFieldResources);
                break;

            //case CswEnumNbtFieldType.MultiRelationship:
            //    ReturnVal = new CswNbtFieldTypeRuleMultiRelationship( CswNbtFieldResources );
            //    break;

            case CswEnumNbtFieldType.MultiList:
                ReturnVal = new CswNbtFieldTypeRuleMultiList(CswNbtFieldResources);
                break;

            case CswEnumNbtFieldType.NFPA:
                ReturnVal = new CswNbtFieldTypeRuleNFPA(CswNbtFieldResources);
                break;

            case CswEnumNbtFieldType.NodeTypeSelect:
                ReturnVal = new CswNbtFieldTypeRuleNodeTypeSelect(CswNbtFieldResources);
                break;

            case CswEnumNbtFieldType.Number:
                ReturnVal = new CswNbtFieldTypeRuleNumber(CswNbtFieldResources);
                break;

            case CswEnumNbtFieldType.NumericRange:
                ReturnVal = new CswNbtFieldTypeRuleNumericRange(CswNbtFieldResources);
                break;

            case CswEnumNbtFieldType.Password:
                ReturnVal = new CswNbtFieldTypeRulePassword(CswNbtFieldResources);
                break;

            case CswEnumNbtFieldType.Permission:
                ReturnVal = new CswNbtFieldTypeRulePermission(CswNbtFieldResources);
                break;

            case CswEnumNbtFieldType.PropertyReference:
                ReturnVal = new CswNbtFieldTypeRulePropertyReference(CswNbtFieldResources);
                break;

            case CswEnumNbtFieldType.Quantity:
                ReturnVal = new CswNbtFieldTypeRuleQuantity(CswNbtFieldResources);
                break;

            case CswEnumNbtFieldType.Question:
                ReturnVal = new CswNbtFieldTypeRuleQuestion(CswNbtFieldResources);
                break;

            case CswEnumNbtFieldType.Relationship:
                ReturnVal = new CswNbtFieldTypeRuleRelationship(CswNbtFieldResources);
                break;

            case CswEnumNbtFieldType.ReportLink:
                ReturnVal = new CswNbtFieldTypeRuleReportLink(CswNbtFieldResources);
                break;

            case CswEnumNbtFieldType.Scientific:
                ReturnVal = new CswNbtFieldTypeRuleScientific(CswNbtFieldResources);
                break;

            case CswEnumNbtFieldType.Sequence:
                ReturnVal = new CswNbtFieldTypeRuleSequence(CswNbtFieldResources);
                break;

            case CswEnumNbtFieldType.Static:
                ReturnVal = new CswNbtFieldTypeRuleStatic(CswNbtFieldResources);
                break;

            case CswEnumNbtFieldType.Text:
                ReturnVal = new CswNbtFieldTypeRuleText(CswNbtFieldResources);
                break;

            //case CswEnumNbtFieldType.Time:
            //    ReturnVal = new CswNbtFieldTypeRuleTime( CswNbtFieldResources );
            //    break;

            case CswEnumNbtFieldType.TimeInterval:
                ReturnVal = new CswNbtFieldTypeRuleTimeInterval(CswNbtFieldResources);
                break;

            case CswEnumNbtFieldType.UserSelect:
                ReturnVal = new CswNbtFieldTypeRuleUserSelect(CswNbtFieldResources);
                break;

            case CswEnumNbtFieldType.ViewPickList:
                ReturnVal = new CswNbtFieldTypeRuleViewPickList(CswNbtFieldResources);
                break;

            case CswEnumNbtFieldType.ViewReference:
                ReturnVal = new CswNbtFieldTypeRuleViewReference(CswNbtFieldResources);
                break;

            default:
                throw (new CswDniException("There is no field rule class for field type " + FieldType.ToString()));
                //break;
            }//switch


            return(ReturnVal);
        } //makeRule()
Exemple #10
0
        public override void beforeWriteNode(bool IsCopy, bool OverrideUniqueValidation)
        {
            List <CswNbtNodePropWrapper> CompoundUniqueProps = new List <CswNbtNodePropWrapper>();

            foreach (CswNbtNodePropWrapper CurrentProp in _CswNbtNode.Properties)
            {
                if (CurrentProp.WasModified)
                {
                    // When a property changes, we need to:
                    // 1. recalculate composite property values which include changed properties on this node
                    foreach (CswNbtNodePropWrapper CompositeProp in _CswNbtNode.Properties[(CswEnumNbtFieldType)CswEnumNbtFieldType.Composite])
                    {
                        if (
                            CompositeProp.AsComposite.TemplateValue.Contains(
                                CswNbtMetaData.MakeTemplateEntry(CurrentProp.NodeTypePropId.ToString())))
                        {
                            CompositeProp.AsComposite.RecalculateCompositeValue();
                        }
                    }

                    // 2. recalculate property references attached to relationships whose values changed
                    if (CurrentProp.getFieldTypeValue() == CswEnumNbtFieldType.Relationship)
                    {
                        foreach (CswNbtNodePropWrapper PropRefPropWrapper in _CswNbtNode.Properties[(CswEnumNbtFieldType)CswEnumNbtFieldType.PropertyReference])
                        {
                            CswNbtNodePropPropertyReference PropRefProp = PropRefPropWrapper.AsPropertyReference;
                            if ((PropRefProp.RelationshipType == CswEnumNbtViewPropIdType.NodeTypePropId &&
                                 PropRefProp.RelationshipId == CurrentProp.NodeTypePropId) ||
                                (PropRefProp.RelationshipType == CswEnumNbtViewPropIdType.ObjectClassPropId &&
                                 PropRefProp.RelationshipId == CurrentProp.ObjectClassPropId))
                            {
                                PropRefProp.RecalculateReferenceValue();
                            }
                        }
                    }

                    // 3. mark any property references to this property on other nodes as pending update
                    if (CswTools.IsPrimaryKey(CurrentProp.NodeId))
                    {
                        //BZ 10239 - Fetch the cached value field name.
                        CswNbtFieldTypeRulePropertyReference PropRefFTR = (CswNbtFieldTypeRulePropertyReference)_CswNbtResources.MetaData.getFieldTypeRule(CswEnumNbtFieldType.PropertyReference);
                        CswEnumNbtPropColumn PropRefColumn = PropRefFTR.CachedValueSubField.Column;

                        string SQL = @"update jct_nodes_props 
                                      set pendingupdate = '" + CswConvert.ToDbVal(true) + @"',
                                          " + PropRefColumn.ToString() + @" = ''
                                    where jctnodepropid in (select j.jctnodepropid
                                                              from jct_nodes_props j
                                                              join nodes n on n.nodeid = j.nodeid
                                                              join nodetype_props p on p.nodetypepropid = j.nodetypepropid
                                                              join field_types f on p.fieldtypeid = f.fieldtypeid
                                                              left outer join jct_nodes_props jntp on (jntp.nodetypepropid = p.fkvalue
                                                                                                  and jntp.nodeid = n.nodeid
                                                                                                  and jntp.field1_fk = " + CurrentProp.NodeId.PrimaryKey.ToString() + @")
                                                              left outer join (select jx.jctnodepropid, ox.objectclasspropid, jx.nodeid
                                                                                  from jct_nodes_props jx
                                                                                  join nodetype_props px on jx.nodetypepropid = px.nodetypepropid
                                                                                  join object_class_props ox on px.objectclasspropid = ox.objectclasspropid
                                                                              where jx.field1_fk = " + CurrentProp.NodeId.PrimaryKey.ToString() + @") jocp 
                                                                                                  on (jocp.objectclasspropid = p.fkvalue 
                                                                                                  and jocp.nodeid = n.nodeid)
                                                              where f.fieldtype = 'PropertyReference'
                                                              and ((lower(p.fktype) = 'nodetypepropid' and jntp.jctnodepropid is not null)
                                                                  or (lower(p.fktype) = 'objectclasspropid' and jocp.jctnodepropid is not null))
                                                              and ((lower(p.valueproptype) = 'nodetypepropid' and p.valuepropid = " + CurrentProp.NodeTypePropId.ToString() + @") 
                                                                  or (lower(p.valueproptype) = 'objectclasspropid' and p.valuepropid = " + CurrentProp.ObjectClassPropId + @")))";

                        // We're not doing this in a CswTableUpdate because it might be a large operation,
                        // and we don't care about auditing for this change.
                        _CswNbtResources.execArbitraryPlatformNeutralSql(SQL);
                    }

                    // 4. For locations, if this node's location changed, we need to update the pathname on the children
                    if (CurrentProp.getFieldTypeValue() == CswEnumNbtFieldType.Location &&
                        CswTools.IsPrimaryKey(_CswNbtNode.NodeId))
                    {
                        _CswNbtResources.CswNbtNodeFactory.CswNbtNodeWriter.updateRelationsToThisNode(_CswNbtNode);
                    }

                    // 5. Prepare for compound unique validation
                    if (CswConvert.ToBoolean(CurrentProp[CswEnumNbtPropertyAttributeName.CompoundUnique]))
                    {
                        CompoundUniqueProps.Add(CurrentProp);
                    }
                } // if(CurrentProp.WasModified)
            }     // foreach (CswNbtNodePropWrapper CurrentProp in _CswNbtNode.Properties)

            if (CompoundUniqueProps.Count > 0 && NodeId != null)
            {
                if (false == IsCopy && false == OverrideUniqueValidation)
                {
                    //check for other compound unique props that were _not_ modified
                    foreach (CswNbtNodePropWrapper CurrentProp in _CswNbtNode.Properties)
                    {
                        if (CswConvert.ToBoolean(CurrentProp[CswEnumNbtPropertyAttributeName.CompoundUnique]) && (false == CompoundUniqueProps.Contains(CurrentProp)))
                        {
                            CompoundUniqueProps.Add(CurrentProp);
                        }
                    }

                    CswNbtView CswNbtView = this.NodeType.CreateDefaultView();
                    CswNbtView.ViewName = "For compound unique";

                    CswNbtViewRelationship ViewRelationship = CswNbtView.Root.ChildRelationships[0];

                    if (CswTools.IsPrimaryKey(NodeId))
                    {
                        ViewRelationship.NodeIdsToFilterOut.Add(NodeId);
                    }


                    foreach (CswNbtNodePropWrapper CurrentCompoundUniqueProp in CompoundUniqueProps)
                    {
                        //case 27670 - in order to reserve the right for compound unique props to be empty, it has to be explicitly stated when creating the ForCompundUnique view
                        CswNbtViewProperty   CswNbtViewProperty = CswNbtView.AddViewProperty(ViewRelationship, CurrentCompoundUniqueProp.NodeTypeProp);
                        ICswNbtFieldTypeRule ftRule             = CurrentCompoundUniqueProp.NodeTypeProp.getFieldTypeRule();
                        ftRule.AddUniqueFilterToView(CswNbtView, CswNbtViewProperty, CurrentCompoundUniqueProp, true);
                    }

                    ICswNbtTree NodeTree = _CswNbtResources.Trees.getTreeFromView(_CswNbtResources.CurrentNbtUser, CswNbtView, true, false, false);

                    if (NodeTree.getChildNodeCount() > 0)
                    {
                        NodeTree.goToNthChild(0);
                        CswNbtNode DuplicateValueNode = NodeTree.getNodeForCurrentPosition();

                        CswCommaDelimitedString CompoundUniquePropNames  = new CswCommaDelimitedString();
                        CswCommaDelimitedString CompoundUniquePropValues = new CswCommaDelimitedString();
                        foreach (CswNbtNodePropWrapper CurrentUniqueProp in CompoundUniqueProps)
                        {
                            CompoundUniquePropNames.Add(CurrentUniqueProp.PropName);
                            CompoundUniquePropValues.Add(CurrentUniqueProp.Gestalt);
                        }

                        string ExotericMessage = "The following properties must have unique values:  " + CompoundUniquePropNames.ToString();
                        string EsotericMessage = "The " + CompoundUniquePropNames.ToString() +
                                                 " of node " + NodeId.ToString() + " are the same as for node " + DuplicateValueNode.NodeId.ToString() + ": " + CompoundUniquePropValues.ToString();

                        if (false == _CswNbtNode.IsTemp && false == DuplicateValueNode.IsTemp)  //only throw an error if we're comparing two REAL nodes
                        {
                            throw (new CswDniException(CswEnumErrorType.Warning, ExotericMessage, EsotericMessage));
                        }
                    }//we have a duplicate value situation
                }

                else
                {
                    foreach (CswNbtNodePropWrapper CurrentPropWrapper in CompoundUniqueProps)
                    {
                        CurrentPropWrapper.ClearValue();
                        CurrentPropWrapper.clearModifiedFlag();
                    }
                } //if-else we're not a copy and not overridding
            }     //if we have at leaste one modified compound unique prop

            //_synchNodeName();
            // can't do this here, because we miss some of the onBeforeUpdateNodePropRow events
            // we do it in writer now instead
        } // beforeWriteNode()
Exemple #11
0
        private void _validateCompoundUniqueProps(bool IsCopy)
        {
            List <CswNbtNodePropWrapper> CompoundUniqueProps = new List <CswNbtNodePropWrapper>();

            if (false == IsCopy)
            {
                //check for other compound unique props that were _not_ modififed
                foreach (CswNbtNodePropWrapper CurrentProp in _CswNbtNode.Properties)
                {
                    if (CurrentProp.NodeTypeProp.IsCompoundUnique())
                    {
                        CompoundUniqueProps.Add(CurrentProp);
                    }
                }
                if (CompoundUniqueProps.Count > 0 && NodeId != null)
                {
                    CswNbtView CswNbtView = this.NodeType.CreateDefaultView();
                    CswNbtView.ViewName = "For compound unique";

                    CswNbtViewRelationship ViewRelationship = CswNbtView.Root.ChildRelationships[0];

                    if (CswTools.IsPrimaryKey(NodeId))
                    {
                        ViewRelationship.NodeIdsToFilterOut.Add(NodeId);
                    }

                    foreach (CswNbtNodePropWrapper CurrentCompoundUniqueProp in CompoundUniqueProps)
                    {
                        //case 27670 - in order to reserve the right for compound unique props to be empty, it has to be explicitly stated when creating the ForCompundUnique view
                        CswNbtViewProperty   CswNbtViewProperty = CswNbtView.AddViewProperty(ViewRelationship, CurrentCompoundUniqueProp.NodeTypeProp);
                        ICswNbtFieldTypeRule ftRule             = CurrentCompoundUniqueProp.NodeTypeProp.getFieldTypeRule();
                        ftRule.AddUniqueFilterToView(CswNbtView, CswNbtViewProperty, CurrentCompoundUniqueProp, true);
                    }

                    ICswNbtTree NodeTree = _CswNbtResources.Trees.getTreeFromView(_CswNbtResources.CurrentNbtUser, CswNbtView, true, false, false);

                    if (NodeTree.getChildNodeCount() > 0)
                    {
                        NodeTree.goToNthChild(0);
                        CswNbtNode DuplicateValueNode = NodeTree.getNodeForCurrentPosition();

                        CswCommaDelimitedString CompoundUniquePropNames  = new CswCommaDelimitedString();
                        CswCommaDelimitedString CompoundUniquePropValues = new CswCommaDelimitedString();
                        foreach (CswNbtNodePropWrapper CurrentUniqueProp in CompoundUniqueProps)
                        {
                            CompoundUniquePropNames.Add(CurrentUniqueProp.PropName);
                            CompoundUniquePropValues.Add(CurrentUniqueProp.Gestalt);
                        }

                        string ExotericMessage = "The following properties must have unique values:  " + CompoundUniquePropNames.ToString();
                        string EsotericMessage = "The " + CompoundUniquePropNames.ToString() +
                                                 " of node " + NodeId.ToString() + " are the same as for node " + DuplicateValueNode.NodeId.ToString() + ": " + CompoundUniquePropValues.ToString();

                        if (false == _CswNbtNode.IsTemp && false == DuplicateValueNode.IsTemp)  //only throw an error if we're comparing two REAL nodes
                        {
                            throw (new CswDniException(CswEnumErrorType.Warning, ExotericMessage, EsotericMessage));
                        }
                    }//we have a duplicate value situation
                }
            }
            else//[9:55:20 AM 11/21/2013] Steven Salter: I can't think of any other situation [that unique props should be blanked]
            {
                foreach (CswNbtNodePropWrapper CurrentPropWrapper in CompoundUniqueProps)
                {
                    CurrentPropWrapper.ClearValue();
                    CurrentPropWrapper.clearSubFieldModifiedFlags();
                }
            } //if-else we're not a copy and not overridding
        }