Customizing Column Lengths
A column length for a modeled attribute can be customized. These column lengths are obtained through the wt.introspection package. The default column lengths are defined in the delivered Rose models with the attribute’s UpperLimit property.The value of this property can be verridden by placing entries in the customizations property file for modeled packages.
To change the column length for a modeled attribute, perform. the following steps:
1. Determine which customization property entry must be added.
2. Add the customization entry to the appropriate customizations property file.
3. Generate the class info objects and sql scripts.
4. Verify the customization.
5. Create the database tables.
6. Restart the method servers if they were running during the procedure.
The following example sets the column length for the name attribute of the wt.doc.WTDocumentMaster class to 350. The following steps describe how to determine which customizations property file entry will contain the new column length, and how to set the value. The customization will be made in a location parallel with the originally modeled attribute.
The default location for these customizations is $(wt.home)\wtCustom, as defined by the wt.generation.custom.dir entry in the tools properties1. Create this directory if it does not already exist.
1. Determine which customization property entry must be added:
a. Obtain an info report for the class by executing the following command:
infoReport wt.doc.WTDocumentMaster
b. Inspect the value of the WTIntrospector.UPPER_LIMIT property (the value being customized) of the name PropertyDescriptor: getValue( WTIntrospector.UPPER_LIMIT ) : 60
c. Inspect the value of the WTIntrospector.DEFINED_AS property of the name PropertyDescriptor:
getValue( WTIntrospector.DEFINED_AS ) :
wt.doc.WTDocumentMaster.name
d. Based on this information, use the following values:
• The customization property file is
docModel.properties.
• The customization property entry is
"WTDocumentMaster.name.UpperLimit".
2. Add the customization property entry to the appropriate customizations
property file. In this example, add the following entry to
# ignore multi-byte database character sets when setting value
3. Generate the class info objects and the sql scripts:
a. Update the serialized info object and the sql script. for the customized
class by entering the following command (on one line):
ant -f
b. Inspect the infoReport’s descendents list for the WTDocumentMaster
class:
getDescendentInfos():
ClassInfo wt.build.buildtest.SourceMaster
ClassInfo wt.federation.ProxyDocumentMaster
c. If the customized class has descendants that are concrete, their tables
must also be adjusted with the following commands (one line each):
ant -f
Dgen.input="wt.build.buildtest.SourceMaster
ant -f
-Dgen.input=wt.federation.ProxyDocumentMaster
4. Verify the customization:
a. Obtain an info report for the class and inspect the UPPER_LIMIT value
as described in the preceding steps. The value should reflect the
customization.
b. If the info report value is unchanged, perform. the following steps:
i. Verify that the generate step actually updated the following serialized info file:
ii. Verify that a class or interface in WTPartMaster’s hierarchy does not also define the name attribute. This is done most easily by viewing the Attributes tab of the Class Specification dialog in Rose, with Show inherited selected. If the name attribute is defined in the hierarchy, the name attribute that was modeled originally must be customized.
Create the database tables. If the tables already exist,adjust the length of the customized column.Because, in this example, WTDocumentMaster.name is also the source for the derived attribute WTDocument.name, the derived attribute must also be customized in this manner. This customization is necessary because the derived attribute, WTDocument.name, does not get its UpperLimit from the source attribute, WTDocumentMaster.name. The derived attribute also explicitly set the UpperLimit property in the model. Therefore, the customization must be defined
explicitly for the derived attribute WTDocument.name. Following the preceding
steps would determine that a WTDocument.name.UpperLimit entry would be set
in the customization property file
docModel.properties. This additional step applies specifically to the way derived
attributes work and is not necessary for normal attributes.
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/22453766/viewspace-614454/ ,如需转载,请注明出处,否则将追究法律责任。