Windchill: Using custom actions in profiles

 IT, Java  Kommentare deaktiviert für Windchill: Using custom actions in profiles
Jan 272015
 

Windchills profile mechanism allows the administrator to show or hide UI components such as attributes and actions. Profiles can be defined on site or organisation level. The Product or Library manager is able to override the profiles from the team page on the product / library by using the Configure Actions for Roles mechanism.

The custom actions (defined in Windchill\codebase\config\actions\customActions.xml) are not directly visible when creating or changing a profile. To make them visible (and selectable) inside the profiles, you have to add them to the config file for profiles (Windchill\codebase\roleaccessprefs.xml)

Example customActions.xml:

<listofactions>
	<objecttype name="object" class="java.lang.Object" resourceBundle="com.pbo.resource.NavigationRB">
		<action name="testPhilipp">
			<command url="netmarkets/jsp/test.jsp" windowType="popup"/>
		</action>
	</objecttype>
</listofactions>

To make the action „testPhilipp“ available in the profiles, you have to add an <uic> element in the roleaccessprefs.xml file:

<product labelId="productLabel">
	 <!-- Adding the action "testPhilipp" to the product level -->
	  <uic name="testPhilipp" order="1010" enabled="true" defaultAll="false" defaultManager="true" 
	          defaultGuest="false" managerEnabled="true" guestEnabled="false"/>

The value of the attribte name in the action-tag must be equal to the name attribute in the uic tag. It is also possible to add a uicomponent attribute when defining your custom action and use its value to reference the action in the roleaccessprefs.xml:

<listofactions>
	<objecttype name="object" class="java.lang.Object" resourceBundle="com.pbo.resource.NavigationRB">
		<action name="testPhilipp" uicomponent="myUicName">
			<command url="netmarkets/jsp/test.jsp" windowType="popup"/>
		</action>
	</objecttype>
</listofactions>

roleaccessprefs.xml:

<product labelId="productLabel">
	 <!-- Adding the action "testPhilipp" to the product level -->
	  <uic name="myUicName" order="1010" enabled="true" defaultAll="false" defaultManager="true" 
	          defaultGuest="false" managerEnabled="true" guestEnabled="false"/>

 

Now you can restart Windchill and you will see your action „testPhilipp“ when changing or creating a profile. To show a more detailed (and maybe localized) name you can use ResourceBundles. Add an entry to the roleAccessResource.rbInfo file.

InfoEngine for Beginners: Setup Tomcat and write your first jsp-task

 IT  Kommentare deaktiviert für InfoEngine for Beginners: Setup Tomcat and write your first jsp-task
Dez 072014
 

There are two different types of IE tasks. The first type is based on JSP technology (file-ending *.jsp). This enables you to run that task in a browser. The second type is a „pure“ IE task (file-ending *.xml).

In this small introduction to InfoEngine I will use the first one (JSP). Before we start with the development of an IE task, we should setup Tomcat to run in DEV-Mode. Run the following command in a Windchill shell (see Windchill Instal Config Guide):

cd Windchill/tomcat
ant -f config.xml configureJspEngine -Dmode=dev

To switch back to production setup, just replace mode=dev with mode=prod. Then (re-) start your Windchill Server.

Open the IE Taskeditor (from Windchill-Shell):

// on Windows:
taskeditor\bin\modeler.bat

// or on unix:
taskeditor\bin\modeler

Create a new JSP. Store them inside codebase or inside a subfolder of codebase:

Create new JSP Task

Create new JSP Task

Add the following lines to your JSP:

<%@ page language="java" session="false" %>

<%@ taglib uri="http://www.ptc.com/infoengine/taglib/core" prefix="ie" %>

<html>
    <body>
    <h1>
       List of WTParts with Name : klotz_001.prt
    </h1>

    <!-- Get all WTParts with name=klotz_001.prt -->
    <ie:webject name="Query-Objects" type="OBJ">
        <ie:param name="INSTANCE" data="net.mymhp.pboss.Windchill"/>
        <ie:param name="PAGE_COUNT" data="10"/>
        <ie:param name="TYPE" data="wt.part.WTPart"/>
        <ie:param name="WHERE" data="name=klotz_001.prt"/>
        <!-- The "Return-Group" is named to outputGroup -->
        <ie:param name="GROUP_OUT" data="outputGroup"/>
    </ie:webject>

    <!-- Display the queried group from above webject (WTParts) in a HTML Table -->
    <ie:webject name="Display-Table" type="DSP">
        <ie:param name="GROUP_IN" data="outputGroup"/>
    </ie:webject>

    </body>
</html>

Your Result should look like this:

IE Task Source

IE Task Source

At the bottom there is a button named „Execute“. With this button you can test your task, but you will probably get the following error:

Error JSP Task

Error JSP Task

The root-cause is, that this request to Tomcat was not authenticated. Add the blue marked part to your URL and re-execute the script:

protocolAuth

protocolAuth

The task has been executed successfully.