public override void update()
        {
            CswNbtMetaDataObjectClass PrinterOc = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.PrinterClass );
            foreach( CswNbtMetaDataNodeType JobNt in PrinterOc.getLatestVersionNodeTypes() )
            {
                CswNbtMetaDataNodeTypeProp GridNtp = JobNt.getNodeTypePropByFirstVersionName( "Jobs" );
                if( null != GridNtp && CswEnumNbtFieldType.Grid == GridNtp.getFieldType().FieldType )
                {
                    CswNbtView GridView = _CswNbtSchemaModTrnsctn.ViewSelect.restoreView( GridNtp.ViewId );
                    if( null != GridView )
                    {
                        GridView.Root.ChildRelationships.Clear();

                        CswNbtViewRelationship RootVr = GridView.AddViewRelationship( PrinterOc, IncludeDefaultFilters : true );

                        CswNbtMetaDataObjectClass PrintJobOc = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.PrintJobClass );
                        CswNbtMetaDataObjectClassProp PrinterOcp = PrintJobOc.getObjectClassProp( CswNbtObjClassPrintJob.PropertyName.Printer );
                        CswNbtViewRelationship PrinterVr = GridView.AddViewRelationship( RootVr, CswEnumNbtViewPropOwnerType.Second, PrinterOcp, IncludeDefaultFilters: true );

                        GridView.AddViewProperty( PrinterVr, PrintJobOc.getObjectClassProp( CswNbtObjClassPrintJob.PropertyName.JobNo ) );
                        GridView.AddViewProperty( PrinterVr, PrintJobOc.getObjectClassProp( CswNbtObjClassPrintJob.PropertyName.RequestedBy ) );
                        GridView.AddViewProperty( PrinterVr, PrintJobOc.getObjectClassProp( CswNbtObjClassPrintJob.PropertyName.CreatedDate ) );
                        GridView.AddViewProperty( PrinterVr, PrintJobOc.getObjectClassProp( CswNbtObjClassPrintJob.PropertyName.JobState ) );
                        GridView.AddViewProperty( PrinterVr, PrintJobOc.getObjectClassProp( CswNbtObjClassPrintJob.PropertyName.Label ) );

                        GridView.save();
                    }
                }
            }

        } //Update()
Exemple #2
0
        }     //isPropWritable

        private bool _isPropWritableImpl(CswNbtMetaDataNodeTypeTab MetaDataTab, CswNbtMetaDataNodeTypeProp MetaDataProp, CswNbtNodePropWrapper NodePropWrapper)
        {
            bool ret = _CswNbtPermitInfo.IsUberUser;

            if ((false == ret) ||
                (MetaDataProp.ServerManaged) ||
                ((MetaDataProp.ReadOnly) || (null != NodePropWrapper && NodePropWrapper.ReadOnly)))        // case 29321
            {
                if (_CswNbtPermitInfo.shouldPermissionCheckProceed())
                {
                    ret = _CswNbtPermitInfo.NoExceptionCases;
                    if (ret)
                    {
                        if (null != MetaDataTab && false == canTab(_CswNbtPermitInfo.NodeTypePermission, _CswNbtPermitInfo.NodeType, MetaDataTab))
                        {
                            ret = false;
                            _CswNbtResources.CswLogger.reportAppState("The property " + MetaDataProp.PropName + " (" + MetaDataProp.PropId + ") has been displayed as non-editable because the viewer cannot see tab " + MetaDataTab.TabId + ".", "ReadOnlyConditions");
                        }
                        else if (_CswNbtPermitInfo.NodeTypePermission == CswEnumNbtNodeTypePermission.View)
                        {
                            ret = false;
                            _CswNbtResources.CswLogger.reportAppState("The property " + MetaDataProp.PropName + " (" + MetaDataProp.PropId + ") has been displayed as non-editable because the viewer does not have edit permissions on nodetype " + MetaDataProp.NodeTypeId + ".", "ReadOnlyConditions");
                        }
                        else if (MetaDataProp.ServerManaged)
                        {
                            ret = false;
                            _CswNbtResources.CswLogger.reportAppState("The property " + MetaDataProp.PropName + " (" + MetaDataProp.PropId + ") has been displayed as non-editable because this property is server managed.", "ReadOnlyConditions");
                        }
                        else if (MetaDataProp.getFieldType().FieldType != CswEnumNbtFieldType.Button)
                        {
                            if (false == (MetaDataProp.IsRequired && _CswNbtResources.EditMode == CswEnumNbtNodeEditMode.Add && null != MetaDataProp.getAddLayout()))
                            {
                                if (MetaDataProp.ReadOnly)
                                {
                                    ret = false;
                                    _CswNbtResources.CswLogger.reportAppState("The property " + MetaDataProp.PropName + " (" + MetaDataProp.PropId + ") has been displayed as non-editable because this property is read only.", "ReadOnlyConditions");
                                }
                                else if (null != NodePropWrapper)
                                {
                                    if (NodePropWrapper.ReadOnly)
                                    {
                                        ret = false;
                                        _CswNbtResources.CswLogger.reportAppState("The property " + MetaDataProp.PropName + " (" + MetaDataProp.PropId + ") has been displayed as non-editable because this property's nodepropwrapper is read only.", "ReadOnlyConditions");
                                    }
                                    else if (NodePropWrapper.Node.ReadOnly)
                                    {
                                        ret = false;
                                        _CswNbtResources.CswLogger.reportAppState("The property " + MetaDataProp.PropName + " (" + MetaDataProp.PropId + ") has been displayed as non-editable because this property's nodepropwrapper's node is read only.", "ReadOnlyConditions");
                                    }
                                } //else if( null != NodePropWrapper )
                            }     //if( false == ( MetaDataProp.IsRequired && _CswNbtResources.EditMode == CswEnumNbtNodeEditMode.Add && null != MetaDataProp.getAddLayout() )
                        }         //else if MetaDataProp.getFieldType().FieldType != CswEnumNbtFieldType.Button
                    }             // if( _CswNbtPermitInfo.shouldPermissionCheckProceed() )
                }
            }
            return(ret);
        }//_isPropWritableImpl()
Exemple #3
0
        public override void update()
        {
            // clean up existing auditlevels set as 0 or 1
            CswTableSelect NodeTypesSelect = _CswNbtSchemaModTrnsctn.makeCswTableSelect( "52670_nt_select", "nodetypes" );
            DataTable NodeTypesTable = NodeTypesSelect.getTable( new CswCommaDelimitedString() { "nodetypeid", "auditlevel" }, "where auditlevel in ('0', '1')" );
            foreach( DataRow NodeTypeRow in NodeTypesTable.Rows )
            {
                CswNbtMetaDataNodeType NodeType = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( CswConvert.ToInt32( NodeTypeRow["nodetypeid"] ) );
                if( null != NodeType )
                {
                    if( NodeTypeRow["auditlevel"].ToString() == "0" )
                    {
                        NodeType.DesignNode.AuditLevel.Value = CswEnumAuditLevel.NoAudit.ToString();
                        NodeType.DesignNode.AuditLevel.setSubFieldModified( CswEnumNbtSubFieldName.Value, true );
                    }
                    else if( NodeTypeRow["auditlevel"].ToString() == "1" )
                    {
                        NodeType.DesignNode.AuditLevel.Value = CswEnumAuditLevel.PlainAudit.ToString();
                        NodeType.DesignNode.AuditLevel.setSubFieldModified( CswEnumNbtSubFieldName.Value, true );
                    }
                }
            } // foreach( DataRow NodeTypeRow in NodeTypesTable.Rows )

            // clean up existing auditlevels set as 0 or 1
            CswTableSelect NodeTypePropsSelect = _CswNbtSchemaModTrnsctn.makeCswTableSelect( "52670_ntp_select", "nodetype_props" );
            DataTable NodeTypePropsTable = NodeTypePropsSelect.getTable( new CswCommaDelimitedString() { "nodetypepropid", "auditlevel" }, "where auditlevel in ('0', '1')" );
            foreach( DataRow PropRow in NodeTypePropsTable.Rows )
            {
                CswNbtMetaDataNodeTypeProp NodeTypeProp = _CswNbtSchemaModTrnsctn.MetaData.getNodeTypeProp( CswConvert.ToInt32( PropRow["nodetypepropid"] ) );
                if( null != NodeTypeProp )
                {
                    if( PropRow["auditlevel"].ToString() == "0" )
                    {
                        NodeTypeProp.DesignNode.AuditLevel.Value = CswEnumAuditLevel.NoAudit.ToString();
                        NodeTypeProp.DesignNode.AuditLevel.setSubFieldModified( CswEnumNbtSubFieldName.Value, true );
                    }
                    else if( PropRow["auditlevel"].ToString() == "1" )
                    {
                        NodeTypeProp.DesignNode.AuditLevel.Value = CswEnumAuditLevel.PlainAudit.ToString();
                        NodeTypeProp.DesignNode.AuditLevel.setSubFieldModified( CswEnumNbtSubFieldName.Value, true );
                    }
                }
            } // foreach( DataRow NodeTypeRow in NodeTypesTable.Rows )
            // set audit info as provided in the CIS-52670
            Collection<Tuple<string, string>> AuditInfo = _makeAuditInfo();

            foreach( Tuple<string, string> a in AuditInfo )
            {
                CswNbtMetaDataNodeType AuditNT = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( a.Item1 );
                if( null != AuditNT )
                {
                    AuditNT.DesignNode.AuditLevel.Value = CswEnumAuditLevel.PlainAudit.ToString();

                    CswNbtMetaDataNodeTypeProp AuditPropNTP = AuditNT.getNodeTypeProp( a.Item2 );
                    if( null != AuditPropNTP && false == AuditPropNTP.getFieldType().IsDisplayType() )
                    {
                        AuditPropNTP.DesignNode.AuditLevel.Value = CswEnumAuditLevel.PlainAudit.ToString();
                    }
                }
            } // foreach( Tuple<string, string> a in AuditInfo )

            foreach( CswNbtMetaDataNodeType AuditedNT in _CswNbtSchemaModTrnsctn.MetaData.getNodeTypes().Where( nt => nt.AuditLevel == CswEnumAuditLevel.PlainAudit ) )
            {
                //assure that for every nodetype where anything is audited, the required (not servermanaged) properties are audited.
                foreach( CswNbtMetaDataNodeTypeProp RequiredNTP in AuditedNT.getNodeTypeProps().Where( ntp => ntp.IsRequired ) )
                {
                    if( false == RequiredNTP.getFieldType().IsDisplayType() )
                    {
                        RequiredNTP.DesignNode.AuditLevel.Value = CswEnumAuditLevel.PlainAudit.ToString();
                    }
                }

                //assure that for every audited nodetype with a "name"-like property the property is audited
                foreach( Int32 NamePropId in AuditedNT.NameTemplatePropIds.ToIntCollection() )
                {
                    CswNbtMetaDataNodeTypeProp NamePropNTP = AuditedNT.getNodeTypeProp( NamePropId );
                    if( null != NamePropNTP && false == NamePropNTP.getFieldType().IsDisplayType() )
                    {
                        NamePropNTP.DesignNode.AuditLevel.Value = CswEnumAuditLevel.PlainAudit.ToString();
                    }
                }
            } // foreach( CswNbtMetaDataNodeType AuditedNT in _CswNbtSchemaModTrnsctn.MetaData.getNodeTypes().Where( nt => nt.AuditLevel == CswEnumAuditLevel.PlainAudit ) )
        } // update()
Exemple #4
0
 /// <summary>
 /// Reference to FieldType Meta Data object for this property
 /// </summary>
 public CswNbtMetaDataFieldType getFieldType()
 {
     return(_CswNbtMetaDataNodeTypeProp.getFieldType());
 }
        public override void update()
        {

            CswTableUpdate ftsTbl = _CswNbtSchemaModTrnsctn.makeCswTableUpdate( "field_types_subfields_upd", "field_types_subfields" );
            DataTable ftsDataTbl = ftsTbl.getTable();

            AddRow( ftsDataTbl, _CswNbtSchemaModTrnsctn.MetaData.getFieldType( CswEnumNbtFieldType.CASNo ).FieldTypeId, "gestalt", "", "1", "1" );
            ftsTbl.update( ftsDataTbl );


            //iterate objectclasses and set their viewname
            CswTableUpdate UpdObClass = _CswNbtSchemaModTrnsctn.makeCswTableUpdate( "objclassUpd", "object_class" ); //for each objectclass
            CswCommaDelimitedString cols = new CswCommaDelimitedString();
            cols.Add( "objectclassid" );
            cols.Add( "objectclass" );
            cols.Add( "oraviewname" );
            DataTable tblUpdObClass = UpdObClass.getTable( cols );
            foreach( DataRow r in tblUpdObClass.Rows )
            {
                r["oraviewname"] = CswConvert.ToDbVal( CswTools.MakeOracleCompliantIdentifier( r["objectclass"].ToString() ) );
            }
            UpdObClass.update( tblUpdObClass );

            //objprops too
            CswTableUpdate UpdObProp = _CswNbtSchemaModTrnsctn.makeCswTableUpdate( "objclasspropUpd", "object_class_props" ); //for each objectclass
            CswCommaDelimitedString colsp = new CswCommaDelimitedString();
            colsp.Add( "objectclasspropid" );
            colsp.Add( "propname" );
            colsp.Add( "oraviewcolname" );
            DataTable tblUpdObProp = UpdObProp.getTable( colsp );
            foreach( DataRow r2 in tblUpdObProp.Rows )
            {
                r2["oraviewcolname"] = CswConvert.ToDbVal( CswTools.MakeOracleCompliantIdentifier( r2["propname"].ToString() ) );
            }
            UpdObProp.update( tblUpdObProp );

            // nodetypes like objectclasses
            CswTableUpdate UpdNT = _CswNbtSchemaModTrnsctn.makeCswTableUpdate( "ntUpd", "nodetypes" ); //for each objectclass
            CswCommaDelimitedString ntcols = new CswCommaDelimitedString();
            ntcols.Add( "nodetypeid" );
            ntcols.Add( "nodetypename" );
            ntcols.Add( "oraviewname" );
            DataTable tblUpdNT = UpdNT.getTable( ntcols );
            foreach( DataRow r in tblUpdNT.Rows )
            {
                r["oraviewname"] = CswConvert.ToDbVal( CswTools.MakeOracleCompliantIdentifier( r["nodetypename"].ToString() ) );
            }
            UpdNT.update( tblUpdNT );

            //nodetypeprops, only the ones where oraviewcolname is null direct to table
            CswTableUpdate UpdNtProp = _CswNbtSchemaModTrnsctn.makeCswTableUpdate( "ntpropUpd", "nodetype_props" ); //for each objectclass
            CswCommaDelimitedString ntcolsp = new CswCommaDelimitedString();
            ntcolsp.Add( "nodetypeid" );
            ntcolsp.Add( "nodetypepropid" );
            ntcolsp.Add( "objectclasspropid" );
            ntcolsp.Add( "propname" );
            ntcolsp.Add( "oraviewcolname" );
            //case 30627 -- do ntprivateprops after objectclasprops to get the important unique names first
            Collection<OrderByClause> OrderBy = new Collection<OrderByClause>() { new OrderByClause( "nodetypeid", CswEnumOrderByType.Ascending ), new OrderByClause( "objectclasspropid", CswEnumOrderByType.Ascending ) };
            DataTable tblUpdNtProp = UpdNtProp.getTable( ntcolsp, "", Int32.MinValue, "", false, OrderBy );

            StringCollection DefinedProps = new StringCollection();
            int mynodetypeid = Int32.MinValue;

            foreach( DataRow r2 in tblUpdNtProp.Rows )
            {
                if( mynodetypeid.ToString() != r2["nodetypeid"].ToString() )
                {
                    mynodetypeid = CswConvert.ToInt32( r2["nodetypeid"] );
                    DefinedProps.Clear();
                }


                DataRow arow = null;
                if( CswConvert.ToDbVal( r2["objectclasspropid"] ) != null )
                {
                    DataRow[] foundRows;
                    string criteria = "objectclasspropid=" + CswConvert.ToInt32( r2["objectclasspropid"] ).ToString();
                    foundRows = tblUpdObProp.Select( criteria );
                    if( foundRows.GetLength( 0 ) > 0 )
                    {
                        arow = foundRows[0];
                    }
                }
                if( arow != null )
                {
                    r2["oraviewcolname"] = arow["oraviewcolname"]; //use the objectclassprop oraviewcolname if we have it
                    DefinedProps.Add( r2["oraviewcolname"].ToString() );
                }
                else
                {
                    //questions do not use the propname...
                    CswNbtMetaDataNodeTypeProp ntp = _CswNbtSchemaModTrnsctn.MetaData.getNodeTypeProp( CswConvert.ToInt32( r2["nodetypepropid"] ) );
                    if( ntp.getFieldType().FieldType == CswEnumNbtFieldType.Question )
                    {
                        r2["oraviewcolname"] = CswConvert.ToDbVal( CswTools.MakeOracleCompliantIdentifier( ntp.FullQuestionNo.Replace( ".", "x" ) ) );
                        DefinedProps.Add( r2["oraviewcolname"].ToString() );
                    }
                    else
                    {
                        //duplicate check for case 30627
                        //DataRow[] foundRows;
                        string colname = CswTools.MakeOracleCompliantIdentifier( r2["propname"].ToString() );
                        int i = 0;
                        string testcolname = colname;
                        while( DefinedProps.IndexOf( testcolname ) > -1 )
                        {
                            ++i;
                            if( colname.Length > 29 - i.ToString().Length )
                            {
                                testcolname = colname.Substring( 0, 29 - i.ToString().Length );
                            }
                            testcolname = colname + i.ToString();
                        }
                        colname = testcolname;
                        r2["oraviewcolname"] = CswConvert.ToDbVal( colname );
                        DefinedProps.Add( r2["oraviewcolname"].ToString() );
                    }
                }

            }
            UpdNtProp.update( tblUpdNtProp );


        } // update()