public override void update() { CswNbtMetaDataObjectClass BatchOpOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.BatchOpClass ); foreach( CswNbtMetaDataNodeType BatchOpNT in BatchOpOC.getNodeTypes() ) { CswNbtMetaDataNodeTypeProp BatchOpIdNTP = BatchOpNT.getNodeTypeProp( "Batch Op Id" ); CswNbtView batchOpView = _CswNbtSchemaModTrnsctn.makeNewView( "BatchOps_51743", CswEnumNbtViewVisibility.Hidden ); CswNbtViewRelationship parent = batchOpView.AddViewRelationship( BatchOpNT, false ); batchOpView.AddViewPropertyAndFilter( parent, BatchOpIdNTP, FilterMode : CswEnumNbtFilterMode.Null ); ICswNbtTree batchOpsTree = _CswNbtSchemaModTrnsctn.getTreeFromView( batchOpView, true ); for( int i = 0; i < batchOpsTree.getChildNodeCount(); i++ ) { batchOpsTree.goToNthChild( i ); CswNbtObjClassBatchOp batchNode = batchOpsTree.getNodeForCurrentPosition(); batchNode.Node.Properties[BatchOpIdNTP].AsSequence.setSequenceValue(); batchNode.postChanges( false ); batchOpsTree.goToParentNode(); } } } // update()
public override void update() { CswNbtMetaDataObjectClass DesignSequenceOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.DesignSequenceClass ); CswNbtMetaDataNodeType DesignSequenceNT = DesignSequenceOC.getNodeTypes().FirstOrDefault(); if( null == DesignSequenceNT ) { throw new CswDniException( CswEnumErrorType.Error, "No design sequence nodetype exists", "Cannot create a Sequence property for batch operations when no Design Sequence NT exists" ); } Collection<CswNbtNode> Sequences = _getNodesByPropertyValue( DesignSequenceOC, CswNbtObjClassDesignSequence.PropertyName.Name, "BatchOpId" ); CswNbtObjClassDesignSequence SequenceNode = null; if( Sequences.Count > 0 ) { SequenceNode = Sequences[0]; } else { SequenceNode = _CswNbtSchemaModTrnsctn.Nodes.makeNodeFromNodeTypeId( DesignSequenceNT.NodeTypeId, delegate( CswNbtNode NewNode ) { CswNbtObjClassDesignSequence AsSequence = NewNode; AsSequence.Name.Text = "BatchOpId"; AsSequence.Pre.Text = "Bat"; AsSequence.Pad.Value = 6; } ); } CswNbtMetaDataFieldType SequenceFT = _CswNbtSchemaModTrnsctn.MetaData.getFieldType( CswEnumNbtFieldType.Sequence ); CswNbtMetaDataObjectClass BatchOpOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.BatchOpClass ); foreach( CswNbtMetaDataNodeType BatchOpNT in BatchOpOC.getNodeTypes() ) { CswNbtMetaDataNodeTypeProp BatchOpIdNTP = BatchOpNT.getNodeTypeProp( "Batch Op Id" ); if( null == BatchOpIdNTP ) { BatchOpIdNTP = _CswNbtSchemaModTrnsctn.MetaData.makeNewProp( new CswNbtWcfMetaDataModel.NodeTypeProp( BatchOpNT, SequenceFT, "Batch Op Id" ) ); CswNbtMetaDataNodeTypeProp DesignSequenceNTP = BatchOpIdNTP.DesignNode.NodeType.getNodeTypeProp( "Sequence" ); if( null == DesignSequenceNTP ) { throw new CswDniException(CswEnumErrorType.Error, "Cannot add sequence to Batch Operation when no Sequence relationship exists on the Sequence NTP Node", "The design node for Sequences does not have a Sequence NTP"); } BatchOpIdNTP.DesignNode.Node.Properties[DesignSequenceNTP].AsRelationship.RelatedNodeId = SequenceNode.NodeId; BatchOpIdNTP.DesignNode.postChanges( false ); } } } // update()