0% found this document useful (0 votes)
3 views

Day 1

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Day 1

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 32

Windchill Customization Overview

Day-1

Date: 05 SEP 2024


Version – 1.0

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

❑Servlet is a server side web component which is managed by web container


to provide dynamic response.
❑Servlet is an interface contains the following methods ,
❑init() : responsible for creating request , response objects
❑service() : request processing
❑destroy() : destroying request, response objects.

6
Session Object (1/2)

❑Client and Server communicates with HTTP protocol.


❑HTTP protocol is a state less protocol, this protocol will not remember
the client data among multiple requests.
❑To overcome this SUN micro systems has introduced ‘SESSION
MANAGEMENT’.

7
Session Object (2/2)

8
Filters

Pre processing of a request and Post processing of the response will


be taken care by Filter.

9
Design Pattern

❑ Design patterns are the solution for reoccurring problems in software


development.
❑ Singleton Design Pattern
❑ Page Controller Design Pattern.
❑ Front Controller Design Pattern.
❑ MVC architecture.

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

❑ The Client Architecture provides a


framework for building pages easily
and consistently by providing a
standard set of components and
services that are configurable and
customizable.
❑ The set of components includes, but
is not limited to, a table, a tree, an
information page, a wizard and a
dynamic JavaScript menu.
❑ At a lower level, these container
components use other common
components, called actions, action
models and GUI components, to
display data inside of them

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

GUI Services: Data Utilities:


• GUI Components are objects that define how • Data Utilities are delegates invoked during
an attribute is to be rendered. construction of the model that allow post-
• They are controlled though properties set in processing and/or augmentation of the data
the Data Utilities. returned by data acquisition APIs
• A GUI Component also contains a renderer
that is responsible for writing out the HTML Validation Services:
and/or JavaScript • Validation of actions and properties can be
done via logic encapsulated into a validator
Action Services:
that gets executed when a component such as
• Reads some xml files and manages the set of
a action menu, table, or property panel
actions and action models.
includes that action or property
• Interaction with the service is done via the
• When a page including one of these
components.
components is requested, the framework will
• Developers in general would not call the
call the validation service to determine which
service directly.
of the actions or properties should be
displayed, disabled, or hidden.

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)

Action Models are configured in


actionsModels.xml.

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)

Action Model,xml Action,xml Action,xml


Part.Menu 1 Part.Menu 1 addpart
Part.Menu2 Part.Menu2 Deletepart
Doc.Menu1 Doc.Menu1 adddocument
Doc.Menu2 Doc.Menu2 deletedocument

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)

Resource file in java


should end with ‘Resource’
or ‘RB’ then only windchill
consider them as resource
file.

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

If we changing the resource file, we have to restart the method server.


Before restarting the method server we have to remove cache from the following two locations
1) D:\ptc\Windchill_10.0\Windchill\tomcat\instances
2) D:\ptc\Windchill_10.0\Windchill\tasks\codebase\com\infoengine
Note : It is a good practice in windchill if we remove the cache each time before restarting the method server.

31
Navigator Tab Terminology & Exercise

o Create an action in custom-actions.xml to


register the actions for the tab to be added
o Create an action model in custom-
actionModels.xml to define the required
actions
o Add new action model to the existing
navigator definition by copying the existing
“navigator” definition from “navigation-
actionModels.xml”
o Define resource bundle entries to support the
new actions

32

You might also like