Upgrading a Viewpoint 13.0 Portlet to 13.0.1

Extensibility covers the mechanisms by which you, as the user or developer, can extend the functionality of the Teradata Database, for example with the use of User Defined Functions, or UDFs.
Teradata Employee

Upgrading a Viewpoint 13.0 Portlet to 13.0.1

 If you have a portlet developed for Viewpoint 13.0, here are the steps you'll need to take in order to get it working correctly under Viewpoint 13.0.1.

Modify ivy.xml to use 13.0.1 jars

If you are developing inside of the Teradata network you will need to modify the ivy.xml file for your portlet. If you are not then go to the next step.

Edit ivy.xml. Change the rev to "" for all "tdcommons-X" projects, "3.0-SNAPSHOT" for "anterage", and "" for "TeraJDBC". Here's an example of what the end result should look like:


<dependency org="teradata" name="tdcommons-portlets" rev="" conf="runtime->runtime" changing="true" />
<dependency org="teradata" name="tdcommons-model" rev="" conf="runtime->runtime" changing="true" />
<dependency org="teradata" name="tdcommons-security" rev="" conf="runtime->runtime" changing="true" />
<dependency org="teradata" name="tdcommons-testutil" rev="" conf="build->build" changing="true" />
<dependency org="teradata" name="tdcommons-taglib" rev="" conf="runtime->runtime" changing="true" />
<dependency org="teradata" name="anterage" rev="3.0-SNAPSHOT" conf="runtime->runtime" changing="true" />
<dependency org="teradata" name="TeraJDBC" rev="" conf="runtime->default" />

Manually move new jar files to your portlet

If you are developing external to the Teradata network you will need to manually update your portlet with new jar files. First delete all of the old jar files from your WEB-INF folder. There are located here:


Now grab the new jar files from one of the demo portlets that were generated with the PDK, and put them in the folders that you just removed the old ones from. If you were to grab them from the DynamicQuery portlet, you would find them here:


Support internationalization

This guide should help you to update an existing Viewpoint portlet to be internationalizable, in several straightforward steps.

Edit your web.xml.

Add the following filter. This sets the character encoding to UTF-8. Also, wire up the internationalization message server for your portlet.


<!-- This sets the encoding on every request and response to be UTF-8 -->


<!-- Add the i18n message servlet and its mapping -->


Edit your ehcache.xml file

Add the following cache to cache the locale values for the user.


<cache name="locale" maxElementsInMemory="1000" eternal="false" timeToIdleSeconds="1800"  timeToLiveSeconds="1800" overflowToDisk="true" />

Add an i18n-servlet.xml file

Copy it from another portlet or from below. You do not need to edit anything in this file.


<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<!-- - Application context definition for "springapp" DispatcherServlet. -->
<description>Contains definitions for beans used by the Sample Portlet user interface</description>

<!-- map requests to controllers by mapping url to the controller name -->
<bean id="handlerMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="mappings">
<prop key="/messages">MessageController</prop>

<!-- controllers -->
<bean id="methodNameResolver"
class="org.springframework.web.servlet.mvc.multiaction.InternalPathMethodNameResolver" />

<bean id="MessageController" class="com.teradata.portlets.i18n.MessageServer">
<description>controller for javascript data requests</description>

Edit your portlet.xml

Add a resource-bundle element pointing to the properties file containing portlet metadata.




Edit your viewpoint-portlet.xml

Add the supported-locale and resource-bundle element to your viewpoint-portlet.xml


<portlet id="FilteredQueries" label="Filtered Queries">
<domain id="FilteredQueries">
<permission scope="domain" name="SET_PREFS" description="If granted, the user can access the preferencess view" />

Add/update properties files

Properties files are extensively used for localization. We use two different properties files to localize portlet text, one for portlet content (e.g. use by the fmt:message tag), and another for portlet metadata (title, category, permission, etc.)


This is the properties file to use to store text that will be retrieved by the JSTL tag library, your custom tags, controllers etc. In order for tooltips to localized correctly, it needs to be called messages.properties. It is typically stored at \src\resources\messages.properties, although it can be anywhere in your classpath.




This message source will be loaded when you define a messageSource bean in your applicationContext.xml. Again, PDK generated portlets will have this automatically.


<bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
<property name="basename" value="messages" />


This is what you will use to localize portlet titles, categories and permissions. It is good practice use the naming convention <portletname>-portlet.properties, especially if you have multiple portlets in one war.


javax.portlet.title=Filtered Queries


com.teradata.viewpoint.permission.SET_PREFS=SET PREFS
com.teradata.viewpoint.permission.SHARE_PORTLET=SHARE PORTLET

com.teradata.viewpoint.permission.VIEW_SUMMARY=VIEW SUMMARY
com.teradata.viewpoint.permission.VIEW_DETAIL=VIEW DETAIL

That's it! This lays the groundwork for i18n-izing your portlet.

Update tool tips

Tool tip messages are now stored with all of your other strings (see How to use Internationalized messsages) insrc/resources/messages.properties; the separate tool tip properties files should be removed. The format is also slightly different. Tool tip .properties files used to look like this:

propertyKeyName = 'teradata_portlets_test';
myStaticTip = 'This is my static tooltip. The text will never change.';
myDynamicTip = 'This my dynamic tooltip. The time is now {time}. The day is {day}.';

The messages.properties file format instead looks like this:

myStaticTip=This is my static tooltip. The text will never change.
myDynamicTip=This my dynamic tooltip. The time is now {time}. The day is {day}.

Note the lack of whitespace around =, the lack of quotes around the message, and the lack of line-ending semicolons.

TDTTM's registerToolTips() function's arguments have changed:

TDPortalManager.onPortletReady('${context}', function() {
TDToolTipManager.registerToolTips('${context}', {

The registerToolTips() function requires two parameters:

  1. The first parameter is the unique context id of portlet that is registering the tooltips.
  2. The second parameter is a javascript hash map that requires two elements in the hash map:
    • propertyMap: The propertyMap hash should contain a javascript hash of all the tool tip sources that will be loaded and used for tool tips on this portlet. Each key in the hash specifies the propertyKeyName used in your JSP (see below), and each value is the internationalization context which contains your tool tips (XXX XREF).
    • elementId: The elementId hash is the string name id that represents the outer-most element in which all tool tips reside. Usually, this is the id of the outer-most container div for the portlet in getting tool tips.

Run your new 13.0.1-compatible portlet

Your portlet is now ready to be deployed within the Viewpoint 13.0.1 environment.