暂无图片
暂无图片
暂无图片
暂无图片
暂无图片
SQLDeveloperDataModelerScripting
518
21页
2次
2020-07-02
免费下载
I. XML metadata files are part of the product
XML files in XML metadata directory ( datamodeler\datamodeler\xmlmetadata ) describe properties and
structure of objects that can be created with Oracle SQL Developer Data Modeler UI or using scripting. They
are used by Data Modeler (DM) in its functionality thus any changes introduced to them could break normal
functionality of DM.
II. Information described in XML files
XML files follow internal object model used by DM and all properties of specific object can be found following
parent class link. There is an HTML presentation of XML files in doc directory (use index.html) which allow
faster navigation in class hierarchy – direct descendents of each class are also presented there.
Two important groups can be found in each XML file – properties and collections. They can be marked as
external which means that property or collection is stored outside the file that represents the object. As
example – Table has internal collection “columns” i.e. columns are stored in the file that represents table;
RelationalDesign class (representing relational model) has external collection Tables. Design class
(representing the whole design) has external property LogicalModel and external collection RelationalModels.
Each property has getter and setter method defined that can be used to get property or set it using scripting.
There are simple and complex properties. Simple properties (data types String, boolean, int, long…) are parts
of persistence of the object. Complex properties can be contained (their persistence is part of persistence of
the object) or referred - ID of referred object is stored in objects persistence though object is involved in setter
and getter method:
<property name="structuredType" dataType="oracle.dbtools.crest.model.design.datatypes.StructuredType" defaultValue=""
xmlName="structuredType" relatedProperty="use" relatedValue="3" xmlType="element" getter="getStructuredType" setter="setStructuredType"
reffered="true" search="true"/>
In some case simple String property holds object ID or list of object IDs – that’s related to dependencies
between objects during loading – it’s possible that referred object(s) may not be loaded when that property is
set.
Property can be marked as searchable and thus can be used in search, custom reports and set common
properties functionality. Some read only properties also are marked as searchable.
Complex properties could have methods for creating them or nullifying them (example – listOfValues in
ContainedObjectWithDomain) :
<property name="listOfValues" dataType="oracle.dbtools.crest.model.design.constraint.ConstraintEnumeration" isPropertyMap="true"
xmlName="listOfValues" xmlType="element" getter="getOwnValueList" setter="setOwnValueList" createPMap="createConstraintEnumeration"
itemXmlName="valueDef" keyXmlName="value" valueXmlName="description" removeItem="clearOwnValueList"/>
So listOfvalues can be created using instance of Column or Attribute – here is an example (script is bound to
logical model, gets entity by name, gets attribute by name, creates list of values if it’s not set for attribute, set it
on attribute and adds two values with description; :
ent = model.getEntitySet().getByName("PRODUCT INFORMATION");
if(ent!=null){
attr = ent.getElementByName("PRODUCT STATUS");
if(attr!=null){
attr.setUseDomainConstraints(false);
ce = attr.getOwnValueList();
if(ce==null){
ce = attr.createConstraintEnumeration();
attr.setOwnValueList(ce);
}
// clear existing properties if need that
//ce.clearProperties();
ce.add("aaa","desc aaa");
ce.add("bbb","desc bbb");
attr.setDirty(true);
}
}
Collection definition provide createItem method that can be used to create item of that collection using instance
of surrounding object – back to Tables collection we see that table can be created using model.createTable().
And columns collection in Table shows the method for creating column:
col = table.createColumn();
ModelObject is the root of the hierarchy and each model is also instance of DesignPart class.
Changed object should be marked as changed using setDirty(true) method otherwise they won’t be saved
during save operation.
Each collection with type xxxxxSet (EntitySet – logModel.getEntitySet(),TableSet – relModel.getTableSet())
allows objects to be found by name ( method getByName(name) ) and by object ID (method
getObjectByID(objectID) ). Collections for tables and views in relational model also allows object to be found by
of 21
免费下载
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文档的来源(墨天轮),文档链接,文档作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论

关注
最新上传
暂无内容,敬请期待...
下载排行榜
Top250 周榜 月榜