cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X

Resource bundle: how to manage in WNC 10+

rvecchiato
14-Alexandrite

Resource bundle: how to manage in WNC 10+

Hi everybody,

I would like to make a summary of how to customize a resource bundle for Windchill versions starting from 10, and to be sure that what I am writing is right.

I am listing all the possible cases and trying to understand how to manage them:

  1. Resource bundle custom in previous Windchill version
  2. Resource bundle overriding an OOTC RB in previous Windchill version (IE: roleAccessResource.rbInfo)
  3. Resource bundle in a new custom in WNC 10+
  4. Resource bundle overriding an OOTB RB in WNC 10+ (IE: roleAccessResource.java)

1. Resource bundle custom in previous Windchill version (IE: companyRB.rbInfo)

Based on the migration steps all the RBs are moved to the file resourceCustomize.rbInfo and the user has to follow these steps to customize one of the labels in this file:

  1. Copy the file from <WTHOME>/src/wt/util/resource to <WTHOME>/wtCustom/wt/util/resource (once, before editing any label)
  2. Modify the label already present in this file
  3. From a Windchill shell launch the command: ant -f bin/tools.xml bundle_custom
  4. From a Windchill shell launch the command (only if the label is used in applets): ant -f codebase/MakeJar.xml custUpdate

At the end of the conversion, RBs should not be existing anymore and hence never use again file *.rbInfo => never create other custom rbInfo files

References:

How to generate file resourceCustsomize.rbInfo: https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS75810

Steps to modify label in resourceCustomize.rbInfo: https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS179861

How to generate java files from rbInfo: https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS149158

2. Resource bundle overriding an OOTC rb in previous Windchill version (IE: roleAccessResource.rbInfo)

These RBs will be migrated "automatically" to the file resourceCustomize.rbInfo, so refer to point 1 if you need to modify them.

Reference: How to generate file resourceCustsomize.rbInfo: https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS75810

3. Resource bundle custom in WNC 10+

Administrators/developers can use WTListResourceBundle class and annotations as shown in the example below

Example from the "Windchill customization guide"

"

Listing 24: exampleResource.java

01 package com.acme.example;

02

03 import wt.util.resource.*;

04

05 /** This example blatantly plagiarized from the JavaDoc. **/

06 @RBUUID("com.acme.example.exampleResource")

07 public class exampleResource extends WTListResourceBundle {

08 @RBEntry("This is the localized text with a single

substitution: \"{0}\".")

09 @RBComment("An example entry.")

10 @RBArgComment0("Any string...")

11 public static final String EXAMPLE_STRING = "0";

12 }

"

References:

Windchill customization guide: http://support.ptc.com/WCMS/files/135892/en/10_MR030_WindchillCustomizationGuide.pdf

Customize OOTB java files: https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS219006

Question: the command in the referenced article is used to compile java file without the IDE (Eclipse, IntelliJ, ...) or is it mandatory to compile all the java files?

4. Resource bundle overriding an OOTB RB in WNC 10+ (IE: roleAccessResource.java)

Java file cannot be modified, but the user has to:

  1. Create/Modify entry in the file resourceCustomize.rbInfo
  2. Recompile the file using the commands

          ant -f bin/tools.xml bundle_custom

          ant -f codebase/MakeJar.xml custUpdate

References:

Customize OOTB java files: https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS219006

How to add entries in resourceCustomize: https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS179861

Scenario

I need to customize labels for the file roleAccessResource where some entries are coming from the previous version of Windchill and hence the file resourceCustomize.rbInfo has already some modified entries; I followed the steps in http://support.ptc.com/cs/help/windchill_hc/wc110_hc/WCCG_UICust_GenericUICust_CustomizeRoleBasedUIFunctions.html?queryI… but with no results.

Do I to use what I wrote in the 4th point?

And which method do I have to use to customize a state?

Conclusion

In Windchill 10+ I do not have to maintain any rbInfo file except the resourceCustomize.rbInfo to edit OOTB label or to add entries to OOTB files.

Custom rbInfo can be migrated to java files and removed the entries from resourceCustomize.rbInfo that is including all the found rbInfo.

Any custom resource bundle can be generated using the java style.

I hope everything is right, otherwise just let me know which errors I have done 🙂

4 REPLIES 4

Hi Riccardo,


StringResourceInfo, previously represented as RBINFO, are now (10.+) using as annotated Java files (WTListResourceBundle).

I confirm that the customization of out-of-the-box WTListResourceBundle must be done via the resourceCustomize.rbInfo file.

I would say that the reference article is How to customize out of the box Java Resource Bundles (WTListResourceBundle) in Windchill 10.0 and later

See also the WTListResourceBundle javadoc .

Other localized resources such as EnumResourceInfo and MetadataResourceInfo are still using RBINFO files in 10.+.

rvecchiato
14-Alexandrite
(To:smainente)

Thank you very much Stephane.

The question wanted to be a confirmation and a general description of how RBs/java files are working in the new version.

If I am finding still other problems I will write here 🙂

Thank you again,

Riccardo

rvecchiato
14-Alexandrite
(To:smainente)

Sorry Stephane for another post, but Windchill is not working as expected and as we wrote.

I am going to write the steps done to figure out the problem:

  • Added text uicomponent="UI_TEST" for the action "<action name="checkoutAndEdit" ajax="row" " in the file PartClient-actions.xml (I should use custom-actions.xml but it's faster to do a test in this way)
  • Added row "<uic name="UI_TEST" order="3008" enabled="true" defaultAll="true" defaultManager="true" defaultGuest="false" managerEnabled="true" guestEnabled="false"/>" only for libraries (again, it's only a test)
  • Added text "

               com.ptc.netmarkets.roleAccess.roleAccessResource/55555.value=Label test

               com.ptc.netmarkets.roleAccess.roleAccessResource/55555.constant=UI_TEST

          " in the file resourceCustomize.rbInfo

  • From a Windchill shell launched the command "ant -f bin/tools.xml bundle_custom -Dbundle.recurse=true"
  • Restarted Windchill

Expectation: in the "Manage roles for actions" for all the libraries, find the label "Label test"

In real: in the "Manage roles for actions" for all the libraries, found the label "UI_TEST"

In this case I am not changing any OOTB label, but adding a new one.

If I follow the guideline provided by the guide (http://support.ptc.com/cs/help/windchill_hc/wc110_hc/index.jspx?id=WCCG_UICust_GenericUICust_CustomizeRoleBasedUIFunctio…), when I launch the command "ResourceBuild com.ptc.netmarkets.roleAccess", the build is fine, but if I am launching the command "ant -f bin/tools.xml bundle_custom -Dbundle.recurse=true" (used for other customizations) it is failing showing "com.ptc.netmarkets.roleAccess.RoleAccessResource (resource info not found)"!

I need hence to understand what I have to do to set the label for a new action for roles.

BTW: I have also tried to change an OOTB and this is working:

com.ptc.netmarkets.roleAccess.roleAccessResource/14.value=View Notebook Test

com.ptc.netmarkets.roleAccess.roleAccessResource/14.constant=PROJECT_ALL_NOTEBOOKS

Adding a new key in resourceCustomize.rbInfo should be working, but the issue seems specific to the Profile page.

When you access this page, you should get the following log:

WARN  : wt.util.resource.WTListResourceBundle sma - com.ptc.netmarkets.roleAccess.roleAccessResource.UI_TEST added as key does not exist to override.

Which means that the resource is being picked up, but still the localized label does not show in the UI.

I will open an SPR, meanwhile you may have to add the entry to roleAccessResource.java (even if not recommended).

Announcements

Top Tags