/// <summary> /// Returns true if the relationship is invalid /// </summary> private bool _isInvalidRelationship(CswEnumNbtViewRelatedIdType RelatedIdType, Int32 FkValue, CswEnumNbtViewPropIdType inValuePropType, Int32 inValuePropId) { bool RetIsInvalid = false; //if( RelatedIdType == NbtViewRelatedIdType.NodeTypeId ) //{ // CswNbtMetaDataNodeType FkRelationshipTargetNt = _CswNbtFieldResources.CswNbtResources.MetaData.getNodeType( FkValue ); // RetIsInvalid = ( null == FkRelationshipTargetNt ); // if( false == RetIsInvalid ) // { // CswNbtMetaDataNodeTypeProp ValueNtp = _CswNbtFieldResources.CswNbtResources.MetaData.getNodeTypeProp( inValuePropId ); // RetIsInvalid = ( null == ValueNtp || // _CswNbtFieldResources.CswNbtResources.MetaData.getNodeTypeFirstVersion( ValueNtp.NodeTypeId ) != FkRelationshipTargetNt.getFirstVersionNodeType() ); // } //} //else if( RelatedIdType == NbtViewRelatedIdType.ObjectClassId ) //{ // CswNbtMetaDataObjectClass FkRelationshipTargetOc = _CswNbtFieldResources.CswNbtResources.MetaData.getObjectClass( FkValue ); // RetIsInvalid = ( null == FkRelationshipTargetOc ); // if( false == RetIsInvalid ) // { // CswNbtMetaDataObjectClassProp ValueOcp = _CswNbtFieldResources.CswNbtResources.MetaData.getObjectClassProp( inValuePropId ); // RetIsInvalid = ( null == ValueOcp || ( ValueOcp.getObjectClass().ObjectClass != FkRelationshipTargetOc.ObjectClass ) ); // } //} //else if( RelatedIdType == NbtViewRelatedIdType.PropertySetId ) //{ // CswNbtMetaDataPropertySet FkRelationshipTargetPs = _CswNbtFieldResources.CswNbtResources.MetaData.getPropertySet( FkValue ); // RetIsInvalid = ( null == FkRelationshipTargetPs ); // if( false == RetIsInvalid ) // { // CswNbtMetaDataObjectClassProp ValueOcp = _CswNbtFieldResources.CswNbtResources.MetaData.getObjectClassProp( inValuePropId ); // RetIsInvalid = ( null == ValueOcp || // null == ValueOcp.getObjectClass().getPropertySet() || // ValueOcp.getObjectClass().getPropertySet().Name != FkRelationshipTargetPs.Name ); // } //} if (inValuePropType == CswEnumNbtViewPropIdType.NodeTypePropId) { CswNbtMetaDataNodeTypeProp ValuePropNTP = _CswNbtFieldResources.CswNbtResources.MetaData.getNodeTypeProp(inValuePropId); RetIsInvalid = false == (CswNbtViewRelationship.Matches(_CswNbtFieldResources.CswNbtResources, RelatedIdType, FkValue, ValuePropNTP.getNodeType())); } else if (inValuePropType == CswEnumNbtViewPropIdType.ObjectClassPropId) { CswNbtMetaDataObjectClassProp ValuePropOCP = _CswNbtFieldResources.CswNbtResources.MetaData.getObjectClassProp(inValuePropId); RetIsInvalid = false == (CswNbtViewRelationship.Matches(_CswNbtFieldResources.CswNbtResources, RelatedIdType, FkValue, ValuePropOCP.getObjectClass())); } return(RetIsInvalid); }
private void _addOptionsRecurse( CswNbtResources NbtResources, Dictionary<CswPrimaryKey, string> Options, ICswNbtTree CswNbtTree, CswEnumNbtViewRelatedIdType TargetType, Int32 TargetId ) //, Int32 TargetNodeTypeId, Int32 TargetObjectClassId ) { for( Int32 c = 0; c < CswNbtTree.getChildNodeCount(); c++ ) { CswNbtTree.goToNthChild( c ); CswPrimaryKey currentNodeId = CswNbtTree.getNodeIdForCurrentPosition(); CswNbtMetaDataNodeType NodeType = NbtResources.MetaData.getNodeType( CswNbtTree.getNodeKeyForCurrentPosition().NodeTypeId ); if( currentNodeId != this.NodeId && // No self-referencing relationships CswNbtViewRelationship.Matches( NbtResources, TargetType, TargetId, NodeType ) ) { Options.Add( CswNbtTree.getNodeIdForCurrentPosition(), CswNbtTree.getNodeNameForCurrentPosition() ); } _addOptionsRecurse( NbtResources, Options, CswNbtTree, TargetType, TargetId ); CswNbtTree.goToParentNode(); } // for( Int32 c = 0; c < CswNbtTree.getChildNodeCount(); c++ ) } // _addOptionsRecurse()
private void _setRootRelationship( CswNbtView View ) { // case 27488 // If the root nodetype or object class of the Relationship options view matches the current nodetype or object class, // and the view is more than one level deep, // limit the root to the current node. if( CswTools.IsPrimaryKey( this.NodeId ) && null != this.NodeTypeProp ) { //if( false == CswNbtViewRelationship.Matches( _CswNbtResources, TargetType, TargetId, this.NodeTypeProp.getNodeType() ) ) if( ( View.Root.ChildRelationships.Count > 0 && View.Root.ChildRelationships[0].ChildRelationships.Count > 0 ) ) { foreach( CswNbtViewRelationship RootRel in View.Root.ChildRelationships ) { if( CswNbtViewRelationship.Matches( _CswNbtResources, RootRel.SecondType, RootRel.SecondId, this.NodeTypeProp.getNodeType() ) ) { RootRel.NodeIdsToFilterIn.Add( this.NodeId ); } } } // if( ( View.Root.ChildRelationships.Count > 0 && View.Root.ChildRelationships[0].ChildRelationships.Count > 0 ) ) } // if( CswTools.IsPrimaryKey( this.NodeId ) && this.NodeTypeProp != null ) } // _setRootRelationship()
public bool FkMatches(CswNbtMetaDataPropertySet ComparePS) { return(CswNbtViewRelationship.Matches(_CswNbtMetaDataResources.CswNbtResources, FKType, FKValue, ComparePS)); }
public bool FkMatches(CswNbtMetaDataObjectClass CompareOC) { return(CswNbtViewRelationship.Matches(_CswNbtMetaDataResources.CswNbtResources, FKType, FKValue, CompareOC)); }
public bool FkMatches(CswNbtMetaDataNodeType CompareNT) { return(CswNbtViewRelationship.Matches(_CswNbtMetaDataResources.CswNbtResources, FKType, FKValue, CompareNT)); }
public bool TargetMatches( ICswNbtMetaDataDefinitionObject Compare, bool IgnoreVersions = false ) { return CswNbtViewRelationship.Matches( _CswNbtResources, TargetType, TargetId, Compare, IgnoreVersions ); }