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
评论