Day 1
Day 1
Day-1
1
Agenda
Basic Concepts of Web Application 30m
Servlet Concepts 10m
Session Objects 10m
Design Pattern 40m
MVC Architecture 30m
Windchill Client Architecture 30m
Development Environment 30m
Actions and ActionModels 60m
Exercises 300m
2
Pre-requisite
Java Programming Language
OOPS Concepts
Spring MVC Framework
XML
JSP/HTML
Javascript
HTTP Protocol
SQL
Networking concepts
3
Basic Concepts of Web Application
❑Request
❑Response
❑Servlet
❑Session
❑Listener
❑Filter
❑Design Patterns
4
Basic Concepts of Web Application
5
Servlet Concepts
6
Session Object (1/2)
7
Session Object (2/2)
8
Filters
9
Design Pattern
10
Page Controller Design Pattern
11
Front Controller Design Pattern
12
MVC Architecture
Model : Contains Business Logic
View : Presentation Layer
Controller : Controls the request and
response
13
Windchill Application Architecture
14
Windchill Client Architecture
15
Windchill Client Architecture – URL Strategy
The URL begins with the host information and the Windchill web app name. Then
the URL has the following components
16
Windchill Client Architecture – Common Java Services
17
Windchill Client Architecture – Common Objects (1/3)
NmCommandBean
❑ Provides Windchill Client Architecture state information to other Windchill Client Architecture layers.
❑ It wraps the request object and adds value by parsing the parameters into related items.
❑ Once initialized by the request, the NmCommandbean can answer Windchill Client Architecture related
questions. It essentially carries the request and helper methods to access the jca state information.
Interesting attributes:
Context: the where compcontext, parentContext, element context etc., are used to determine what page is
displayed and where actions are launched.
• oids : the objects that actions or pages apply to.
• Contains a number of helper APIs:
• getActionOid() : gets the object that is the target of the action.
• getPageOid(): gets object that the page is being displayed in this page.
• getViewingContainer() : gets the container that the page is displayed in
18
Windchill Client Architecture – Common Objects (2/3)
NmAction
❑ NmAction represents a line from actions.xml which describes a page in Windchill. It is rendered as all the
icons and links that one can click to make changes to the Windchill system.
❑ Each jsp page should be described by an NmAction in an xml file
NmOid
❑ A Netmarkets version of a WTReference that hides some details of the different reference types and provides
helper apis to aid in caching.
❑ It is the object that understands how to parse any string format from the request that represents an object in
the database
NmSimpleOid
❑ NmSimpleOid represents a non-persisted business object. It is often to represent some item that has not
been created yet or some object that wraps a Persistable with more information.
❑ String parsing of the NmSimpleOid is completely handled by the code for the relevant table and actions and
should be in an NmObjectUtility
19
Windchill Client Architecture – Common Objects (3/3)
NmContext
❑ NmContext represents a UI address of a page
•Component is a jsp page
•Jsp page can include multiple components
•Component address includes addresses of ancestor components
•Context (address) of a component B is “Address 1 - Address B”
20
Windchill Directory Structure
Codebase
Directory
wtSafeArea
Source
Directory Basic Customization (ptc.com)
21
Development Environment
❑ Install Eclipse
❑ Java source file and will reside in the <load point>/src directory.
❑ The Ant script, tools.xml, found in <load point>/bin provides the following targets which
will be used throughout the example:
❑ eclipse_project :- generates an Eclipse project
❑ class:- compiles Java source code
❑ Bundle:- builds the resource bundles for enumerations
❑ sql_script:- generates SQL scripts for persistent classes.
❑ Configure Windchill Eclipse project
❑ windchill shell
❑ ant -f bin/tools.xml eclipse_project
❑ Each of these targets provides help (simply append .help to the names above).
❑ ant -f bin/tools.xml eclipse_project.help
22
Some Key Commands
❑ ant -f bin/tools.xml eclipse_project
❑ ant -f bin/swmaint.xml createSafeArea
❑ ant -f bin/tools.xml class -Dclass.includes=navigationRB.java -Dclass.source=
%wt_home%/src/com/ptc/core/ui
❑ ant -f codebase/MakeJar.xml
❑ ant -f bin/tools.xml class -Dclass.includes=partNameValidator.java -Dclass.source=
%wt_home%/src/com/ptc/training/mvc/validator
❑ xconfmanager -i %wt_home%/codebase/com/ptc/training/customServices.xconf
❑ xconfmanager -p
❑ ant -f bin/tools.xml class -Dclass.includes=PartService.java -Dclass.source=
%wt_home%/src/com/ptc/training/service/
23
Windchill Action Model (1/3)
24
Windchill Action Model (2/3)
❑ Actions : Any operation performed on the Windchill page is an action.
❑ StandardNmActionService service manages the actions and action models in the system
❑ Action Model : set of actions is a MODEL – Managed using actionModels*.xml
❑ Actions are managed using action*.xml
❑ Custom actions and action models are managed using
❑ custom-action.xml
❑ custom-actionModels.xml
❑ Labels : Display labels are handled through the resource files[java]
❑ All out of the box actions are available in <WT_HOME>/codebase/config/actions
❑ Default actions like cut, copy and other commonly used action models are in action.xml
and actionModels.xml
❑ Actions related to functional areas are in action*.xml and actionModels*.xml
❑ PartManagement-action.xml
25
Windchill Action Model (3/3)
Actual command
Addpart.java
Deletepart.java
AddDoc.java
DeleteDoc.java
26
Adding an Action Model
❑ To add an action, first we have to identify the model where we have to add
❑ In this example we need to add action under the 'more part actions’ menu item
❑ Hence ‘more part action’ is the model
❑ 'more part actions' model available in PartClient-actionsModels.xml
%WT_HOME%/codebase/config/actions]
❑ As we are customizing we have to copy this model [‘more part actions’] in custom-
actionModels.xml
27
Configure an Action – Action.xml (1/2)
❑ As we adding custom action, we have to configure action in custom-actions.xml file as
follows:
❑ Create a jsp [demoOne.jsp] in the following location
❑ %WT_HOME%/codebase/netmarkets/jsp/training/demoOne.jsp].
❑ All the JSP’s in windchill will be placed under this folder
❑ %WT_HOME%/codebase/netmarkets/jsp
28
Configure an Action – Action.xml (2/2)
29
Final Steps
❑ The ‘trainingResource.java’ resource file should be placed under /src folder
❑ In windchill all the .class files will be placed in this location
%WT_HOME%\codebase\com\wip\training\trainingResource.class
Note : If we are modifying any actions/actionModels xml files to reflect the changes
we have to run the following command in windchill shell
❑ java ‘com.ptc.netmarkets.util.misc.NmActionServiceHelper’
❑ The jsp file should be placed under the codebase folder in the following location
❑ %WT_HOME%\codebase\netmarkets\jsp\<objecttype>\<actionname>.jsp]
❑ Eg. demoOne.jsp which displays the following message
❑ Hi Test Action ……
30
TIPS
If we are modifying the JSP files frequently , then before restarting the method server, we have to run the
following command
1) Navigate to ‘tomcat’ folder in windchill shell
31
Navigator Tab Terminology & Exercise
32