Forum Stats

  • 3,758,598 Users
  • 2,251,417 Discussions
  • 7,870,259 Comments

Discussions

Transformation to Set Schema and User on Tables in Relational and Physical

marcusafs
marcusafs Member Posts: 294

I have imported my Designer Repository into SDDM 4.0.1.836.  Now I want to use the APP_SYS* sub-views to set the schema on the tables in the relational model and the user on the physical model.  Our application systems in Designer are 90% schema based.  Below is what I have so far based on the example OE and HR Schemes that I imported, engineered to logical and then back to relational.  At this point I have the tables by subview..  Obviously line 24 is incorrect.  Can someone give me a step by step approach to figuring out what I need to set the table schema and user?  I have looked through the readme, the xml files, the index and have searched the known universe and am still clueless.

importPackage(javax.swing);
// variable to keep a status message for later

var message="";
var schema="";

// Get all subviews for Relational
    subviews = model.getListOfSubviews().toArray();
for (var isub = 0; isub<subviews.length;isub++){
    subview = subviews[isub];
    message = message + '\n'+isub+" "+ subviews[isub];
    if(subviews[isub]!=null){
          if(subview == "HR_ERD"){
             shema = "HR";
            }else if(subview == "OE_ERD"){
             schema = "OE";
            }
         tables = model.getTableSet().toArray();
         for (var t = 0; t<tables.length;t++){
             table = tables[t];
             //check for presentation in subview
             tv = table.getFirstViewForDPV(subviews[isub]);
             if(tv!=null){
                 table.setSchemaObject(schema);  
                  message = message + '\n    '+ t +" " +shema+"."+ tables[t] ;
            }
        }
    }
}  

JOptionPane.showMessageDialog(null, message);
//Packages.oracle.dbtools.crest.swingui.ApplicationView.log(message);
Tagged:

Best Answer

  • David Last-Oracle
    David Last-Oracle Member Posts: 1,057 Silver Trophy
    Accepted Answer

    Hi Marcus,

    First you should make sure the Schema already exists in your Relational Model.

    Then you can use the method

        public void setSchema(String schemaName)

    to associate your Table with that Schema.

    (This method is defined on ContainerObject, so it can also be used for TableViews and Indexes.)

    If you already have a User in your Physical Model that implements your Schema, then it is not normally necessary to set a User on the TableProxyOracle in the Physical Model.

    However if you do want to set it, then the method to use is

        public void setUser(UserOracle user)

    David

Answers

  • David Last-Oracle
    David Last-Oracle Member Posts: 1,057 Silver Trophy
    Accepted Answer

    Hi Marcus,

    First you should make sure the Schema already exists in your Relational Model.

    Then you can use the method

        public void setSchema(String schemaName)

    to associate your Table with that Schema.

    (This method is defined on ContainerObject, so it can also be used for TableViews and Indexes.)

    If you already have a User in your Physical Model that implements your Schema, then it is not normally necessary to set a User on the TableProxyOracle in the Physical Model.

    However if you do want to set it, then the method to use is

        public void setUser(UserOracle user)

    David

  • marcusafs
    marcusafs Member Posts: 294

    Thanks for the great info.  I don't know how I overlooked the user implements schema property.  And the method works like a charm. 

    Once again someone has given me a fish.  Can someone tell me how to fish for methods on my own so I don't have to keep coming back to the list for fish?  I can find methods but they are never the right ones.  For instance I found setSchemaObject in the docs but the actual method was setSchema.  Is it a convention of javascript?

  • Philip Stoyanov-Oracle
    Philip Stoyanov-Oracle Member Posts: 3,348 Employee

    Hi Marcus,

    your line 24 is almost correct - that property is related to SchemaObject , so input parameter is SchemaObject not string. So you need to get that SchemaObject firsst:

    so = model.getSchemaObjectSet().getByName(schema);

    Well as David explained setSchema(String schema) will do the same if SchemaObject with same name is already created.

    Otherwise if you want to set some properties using script then you should check file that represents that object in file system - you'll find the name of the property and probably possible values you can use. Then you can check html doc or XML meta data file for setter and getter methods. That will work in most of he cases.

    Philip

    Philip Stoyanov-Oracle
This discussion has been closed.