Customizing Column Lengths
A column length for a modeled attribute can be customized. These column lengths are obtained through the wt.introspection package. The value of this property can be overridden 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 customization property for the attribute
2. Override attribute length in appropriate customizations property file
3. Generate the class info objects
4. Verify the customization.
5. Alter 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 hold 350 characters. The following steps describe how to determine which customizations property file entry contains the new column length, and how to set the value. The customization is 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 properties. Create this directory if it does not already exist.
* 
See the “tools.properties file” and “user.properties file” descriptions in The Windchill Development Environment.
1. Determine which customization property entry must be added:
a. Obtain an info report for the class by executing the following command from a Windchill shell:
infoReport wt.doc.WTDocumentMaster
The info report file is created in<Windchill>/temp and is nameddoc.WTDocumentMaster.out for this class.
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 <Windchill>\wtCustom\wt\doc\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 <Windchill>\wtCustom\wt\doc\docModel.properties (create this file if it does not exist):
WTDocumentMaster.name.UpperLimit=350

# Ignore multi-byte database character sets when setting value.
# UpperLimit is constrained by database VARCHAR limit : max value is
4000/wt.db.maxBytesPerChar
3. Generate the class info objects. Update the serialized info object by entering the following command from a Windchill shell:
ant -f bin\tools.xml custom_column -Dgen.input=wt.doc
This updates introspection information for descendant classes that are concrete, for example wt.federation.ProxyDocumentMaster in the case of wt.doc.WTDocumentMaster.
4. Verify the customization. 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. If the info report value is unchanged, verify that the generate step actually updated the following serialized info file:
<Windchill>\codebase\wt\doc\WTDocumentMaster.ClassInfo.ser
5. Adjust the length of the customized column by taking the following steps:
a. Execute the Windchill Upgrade Manager to run the Compare Schema step only.
Start the Windchill Upgrade Manager within a Windchill shell as follows: UpgradeManager -cs
b. Inspect the generated output to find the SQL script(s) related to this customization in:
<Windchill>\Upgrade\UpgradeReports\CompareSchema\CompareSchema-<timestamp>.html#AlteredTables - section 'Tables to be Altered'.
Tables corresponding to descendant classes must also be altered (e.g. PROXYDOCUMENTMASTER).
* 
Review the output carefully to ensure the results are what you expect. You should never execute any SQL that you do not understand, or that does not seem related to your intended customizations
c. Execute the relevant SQL scripts as Windchill database schema owner.
In this example, WTDocumentMaster.name is also the source for the derived attribute WTDocument.name. This derived attribute, WTDocument.name, gets its UpperLimit from the source attribute, WTDocumentMaster.name. A derived attribute cannot set the UpperLimit property in the annotation. Therefore, the derived attribute cannot be customized in this manner.
¿Fue esto útil?