`
xiaogyiy
  • 浏览: 79018 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
文章分类
社区版块
存档分类
最新评论

xxx6

阅读更多
Exercise 6-1: Extend WTDocument
Objectives
● Create a new package structure.
● Extend a Windchill class.
● Model new attributes.
● Implement the customization.
Scenario
A customer has identified a requirement for a new business information type similar to WTDocument with some additional attributes. In this exercise, you will model a custom WTDocument with the required attributes.
Step 1. Open the Windchill model.
a. Start Rational Rose.
b. Open WT_HOME/src/wt/WTDesigner.mdl.
c. When asked to Load subunits of WTdesigner.mdl?, select Yes:
Example:
Step 2. Create the package structure in Rational Rose.
a. Using the Browser, navigate to Logical View > <<assembly>> wnc and open the diagram SystemGeneration diagram.
Result:
SystemGeneration Diagram
b. Select Tools > Create > Package.
There is also an icon to create a package.
c. Use the cross-hairs to position the package.
d. The default name for a package will be NewPackage.
e. Rename the package from NewPackage to com. To rename the package, select the name on the package and type the new name com.
Step 3. Open the com package and create another package named customer.
Step 4. Open the customer package and create another package named doc.
a. This package will conflict with an existing package by the same name, so a different package creation process will be used.
b. To create a package with the same name as an existing package, first create the package.
c. Instead of renaming the package in the diagram window, use the browser window on the left side in Rational Rose to rename the package to doc.
d. To open the new package in the browser window, right-click on the new package and select Select In Browser.
You can also expand the “Logical View” structure in the Rational Rose
browser and navigate to com > customer.
e. When the warning message appears Package "doc" now exists in multiple name spaces, select OK.
Example:
Step 5. Control the custom units.
a. Point out that there are OOTB packages in the com directory, e.g., com.ptc. Therefore com should not be controlled; com.customer should be controlled. Nested packages under com.customer could be controlled, as well.
b. In Rational Rose, right-click on a package in the browser window and select Units > Control… > customer .
c. Select the filename for the controlled unit.
d. Now, all changes anywhere under the controlled package will be stored in the *.cat file just specified.
1. Store the controlled unit with the same name as the package and
locate it in the same directory relative to src. For example, the
sub-unit file for the customer.doc package will be stored in the WT_HOME/src/com/customer/doc/doc.cat.
2. It’s up to the development team to identify the appropriate number and name of packages required, and which packages will be controlled.
Step 6. Add existing classes that will be extended.
a. Navigate to the appropriate package.
b. Select Tools > Create > Class. There is also an icon to create classes.
c. The cross-hairs will appear to locate the class.
d. Rational Rose will give the class a default name (“NewClass”). Begin typing WTDocument;
when WTDocument appears in the drop down list, select it.
Example:
Selecting an Existing Class as Reference
When referencing an existing class, after the existing class has been
selected, Rational Rose will open a dialog box:
Deleting Default NewClass
This indicates that the class that was created with the default name
(NewClass) will no longer be referenced and can be deleted from the
model. This is OK; WTDocument is being referenced, not NewClass.
Select Yes.
Step 7. Create a generalization between the extended class and the extension.
a. Select Tools > Create > Generalization. Use the mouse to select the extension – do not let go of the mouse button – and drag the mouse to the parent class.
There is also an icon to create generalizations.
b. Save the changes.
Step 8. System generate.
a. Select a modeled class, not an OOTB class.
b. Select Tools > Windchill > System Generate.
c. Select all of the check boxes except Module Descriptor. Module Descriptor is a function reserved for R&D.
Example:
System Generation
d. Select OK.
e. The system generation will open a script. Read the output for errors, and then close this script box:
Example:
Step 9. Compile all Java sources created by system generation.
If this step is not completed, the Method Server will not start with a
java.lang.ClassNotFoundException exception:
(wt.introspection.introspectionResource/6) wt.introspection.WTIntrospectionException:
An introspection error has occured. System message follows:
Nested exception is:
java.lang.ClassNotFoundException: com.customer.doc.CustomerOrder
...
Specifically it will be missing the class files to match the registry
properties.
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics