All Forums Viewpoint
MSkiLLz 40 posts Joined 05/09
28 May 2009
Widgets

Hi, I'm currently trying to create a graph widget which displays the data from the teradata database. I'm thinking that in order for the data to be populated to my widget then I need a postgres username and password and the jdbcUrl. These changes are supposed to go into the content.xml and server.xml file but the problem is trying to figure out what is the username, password and Url? Will that be all the change that is needed to get information to be displayed on a widget?

If possible, It would make it easier for me if anyone had a same of a widget being populated with some simple data. Thanks.

LewisDawson 54 posts Joined 11/08
28 May 2009

What kind of data are you trying to retrieve/display from Teradata?

MSkiLLz 40 posts Joined 05/09
28 May 2009

Well, the place I work for wants me to display information for the users like cpu performance, state of system, users online...stuff like that.

LewisDawson 54 posts Joined 11/08
28 May 2009

The reason I ask is that we may already be logging this data into postgresql with our current collector(s). If we are, you will already have the data you are looking for. Is it possible to provide more specifically what you are looking for in terms of metrics? If not, there's another approach you can probably take, but one thing at a time...

MSkiLLz 40 posts Joined 05/09
29 May 2009

I'm not sure what you mean when you talk about metrics but if there is another method of doing this then I would like to know. We are already receiving data on our tdviewpoint portal but now we are trying to develop a portlet which would be displaying information that is in some existing portlets but it will be displayed using graphs. i.e. CPU performance. I just don't think we have access to that information on the dev kit. For example, I can't get the SkewedSessions tutorial to work because we don't have access to our DCS.


I just wanted to make it clear what I'm trying to do.

LewisDawson 54 posts Joined 11/08
29 May 2009

I was referring to the display information you were talking about in the quoted post with regards to my inquiry about "metrics".

I would assume you are using the Portlet Development Kit (PDK), so the following would be the best solution:

1. Take a look the API documentation (should be in tdpdk-xx.xx.xx.xx\doc\api). Find the documentation for the package com.teradata.dcs.data.model. All the classes in that package represent the metrics that are collected by the DCS and logged to PostgreSQL currently. Look through the classes and find the metrics (ie. the information you want to display) and take note of what class they are associated with.
2. Each class should have a corresponding Data Access Object (DAO) class that resides under com.teradata.data.dcs.dao. The DAO is what you use to retrieve the data from PostgreSQL.
3. To use a DAO, you need to create a bean in the dataSourceiBatis.xml file that references an implementation of that DAO. For example, if you wanted to get QueryLog data, you would create your bean as follows:

bean id="queryCountDAO" class=" com.teradata.dcs.data.dao.ibatis.QueryCountDAOiBatis" >
description>DAO for accessing Query Count table
property name="sqlMapClient" ref="dcsSqlMapClient" />
/bean>

The class attribute references the actual implementation of the DAO. DAO implementations reside under the package com.teradata.dcs.data.dao.ibatis. The property tag injects a sql map which allows you to retrieve data from PostgreSQL that was collected by the DCS. The sql map uses a datasource (ie. a connection) that is connected to PostgreSQL.
4. Now you inject that bean into your manager implementation, which is defined in applicationContext.xml. So you would do the following:

bean id="myManager" class=" com.teradata.portlets.myPortletName.myManagerImpl">
description>The business delegate for this application
property name="myJavaQueryCountDAO" ref="queryCountDAO"/>
/bean>

You just need a corresponding java setter for the myJavaQueryCountDAO variable of type QueryCountDAO. Now you can access the data from PostgreSQL.

The DAOs give you indirect access to PostgreSQL. If you have a working DCS instance, which it sounds like your portal does based upon your comments above, then you will be able to retrieve any/all of the data you see displayed by the viewpoint portlets. You don't need a URL/Username/Password as you can see.

NOTE: I have taken out the less than from the .xml examples because it wouldn't post the .xml if i left it there.

LewisDawson 54 posts Joined 11/08
29 May 2009

The forum software really hacked up my previous post badly. It took out words and examples before posting it for some reason. I have edited and it should be good now. Let me know if you still have more questions.

MSkiLLz 40 posts Joined 05/09
29 May 2009

Thanks. Ok, that made sense so far but bear with me on this because this is the first time i've used Teradata. I'm trying to implement your Query example over here. So after I follow those steps do I only have to add a few lines of code to the Manager and ManagerImpl file for it to display? I also think there might be some changes I will have to make in the summary.jsp file.

LewisDawson 54 posts Joined 11/08
29 May 2009

Yes, you need to add a couple of things to your manager class. You need:

1. A reference to your injected DAO object:

private QueryCountDAO myJavaQueryCountDAO;

2. A setter for the DAO:

public void setMyJavaQueryCountDAO(QueryCountDAO myJavaQueryCountDAO)
{
this.myJavaQueryCountDAO = myJavaQueryCountDAO;
}

3. A manager function that retrieves the data:

public List getMyQueryCountData(int systemId, Timestamp startTime, Timestamp endTime)
{
return myJavaQueryCountDAO.getQueryCountSumOverTime(systemId, startTime, endTime);
}

4. Some function that creates a collection of widget model objects for your desired widget type from the data your have retrieved from the DAO. Widget model objects are under the package com.teradata.tags.widgets.model.

I would highly recommend you go through the skewed sessions portlet tutorial as this will give you knowledge of all the basic concepts. Let me know if you have more questions.

MSkiLLz 40 posts Joined 05/09
29 May 2009

Thanks. I actually went through that tutorial but it bugged me that I couldn't get anything to display. Thats one of the reasons why I figured that maybe I didn't have access to a DCS so I asked for a username and password.

MSkiLLz 40 posts Joined 05/09
01 Jun 2009

I tired to redo the skewsessions and it still doesn't display anything on the summary page. It doesn't even show the columns or anything is just says its temporarily unavailable which is pretty weird. Wonder what the problem is...



Well, I'm trying to use the SystemHealthDAO with a sparkline widget and I trying to use your post as reference but now i'm stuck.



How do you find out the property name and ref for both the manager implementation and the one you did prior to that? Would I use the same property name a ref for all the DAOs I use?



I also wanted to know if the Java setter you called "myJavaQueryCount" is what is actually going to be input or its something different? I looked at the skewedsessions code and it didn't that but the name of the DAO.



Does all this look good so far?



1. A reference to your injected DAO object:

private SystemHealthDAO systemHealthDAO;

2. A setter for the DAO:

public void setSystemHealthDAO(SystemHealthDAO systemHealthDAO

{

this.systemHealthDAO = systemHeatlthDAO;

}

3. A manager function that retrieves the data:



public List getSystemHealth(int systemId, Timestamp startTime, Timestamp endTime)

{

return systemHealthDAO.getSystemHealthOverview(systemId, startTime, endTime);

}



Would it be possible if you gave me an example of how to use a widget to display useful information? That way I can just follow those steps.

MSkiLLz 40 posts Joined 05/09
02 Jun 2009

Can I get help with these errors?

compile:
[mkdir] Created dir: C:\QueryCount\build\classes
[javac] Compiling 6 source files to C:\QueryCount\build\classes
[javac] C:\QueryCount\src\java\com\teradata\portlets\ querycount\service\impl
\QueryCountManagerImpl.java:27: cannot find symbol
[javac] symbol : class QueryCountDao
[javac] location: class com.teradata.portlets.querycount.service.impl.QueryC
ountManagerImpl
[javac] private QueryCountDao myJavaQueryCountDAO;
[javac] ^
[javac] C:\QueryCount\src\java\com\teradata\portlets\ querycount\service\impl
\QueryCountManagerImpl.java:45: cannot find symbol
[javac] symbol : class Timestamp
[javac] location: class com.teradata.portlets.querycount.service.impl.QueryC
ountManagerImpl
[javac] public List getMyQueryCountData(int systemId, Timestamp startTim
e, Timestamp endTime)
[javac] ^
[javac] C:\QueryCount\src\java\com\teradata\portlets\ querycount\service\impl
\QueryCountManagerImpl.java:45: cannot find symbol
[javac] symbol : class Timestamp
[javac] location: class com.teradata.portlets.querycount.service.impl.QueryC
ountManagerImpl
[javac] public List getMyQueryCountData(int systemId, Timestamp startTim
e, Timestamp endTime)
[javac]
^
[javac] 3 errors

LewisDawson 54 posts Joined 11/08
02 Jun 2009



You probably need to add the imports for the missing symbols. Ie.

import com.teradata.dcs.data.dao.QueryCount;
import java.sql.Timestamp;

MSkiLLz 40 posts Joined 05/09
02 Jun 2009

Alright. I deployed it and so far so good. Nothing displays because I know I have to edit the summary page but is that all?

LewisDawson 54 posts Joined 11/08
02 Jun 2009

In regards to your first inquiry on this page. Since you are getting an error with SkewedSessions, take a look at the stack trace that is generated when you add the portlet to the page. It will give you loads of information about the issue(s) you are having. This will answer your "Wonder what the problem is..." statement. ;^)

MSkiLLz 40 posts Joined 05/09
02 Jun 2009

Thanks. Could I get feedback on the other questions?

MSkiLLz 40 posts Joined 05/09
10 Jun 2009

Does anyone have any kind of sample project involving widgets other than the one included in the PDK? I'm really in need on some sort of material I can use for reference.

LewisDawson 54 posts Joined 11/08
12 Jun 2009

Take a look at the Widgetopia portlet in the PDK for examples. The Widgetopia portlet has examples of how to use all the different widgets that are available.

MSkiLLz 40 posts Joined 05/09
12 Jun 2009

Yeah, I looked at that but It really doesn't go into details as far as coding. I'm trying to learn how to create widgets populated with meaningful data.

LewisDawson 54 posts Joined 11/08
12 Jun 2009

It shows you exactly what you need to know to populate each widget with meaningful data. It is the simplest available example you will find. The WidgetopiaManagerImpl.java creates all of the models with data. Each model is then put into the view in the WidgetopiaViewController.java. Each model is then passed to its proper tag in the summary.jsp. I would highly recommend you got back and understand this portlet in its entirety if you want to learn widgets.

MSkiLLz 40 posts Joined 05/09
12 Jun 2009

I'll probably do that but all I learned from it was how to create those Widgets in the sample. I've successfully created all of them but I'm trying to display information from our database. I don't know if I missed it but it doesn't explain that.

MSkiLLz 40 posts Joined 05/09
16 Jun 2009

Is there a way to edit the DynamicQuery portlet to just run a certain SQL statement each time without having to type it?

LewisDawson 54 posts Joined 11/08
19 Jun 2009

"I'll probably do that but all I learned from it was how to create those Widgets in the sample. I've successfully created all of them but I'm trying to display information from our database. I don't know if I missed it but it doesn't explain that. "

On the first page of this topic, I talked about the API documentation (my third post) and explained how "All the classes in that package represent the metrics that are collected by the DCS and logged to PostgreSQL currently". This is where the two pieces fit together. All the data collected from Teradata is logged to PostgreSQL. To retrieve the data, you use the provided DAO function(s) (see my third post for the package locations), which usually return a java.util.List of model objects where each model object contains the data for a single row from PostgreSQL. Now you have the data you need to populate a widget with meaningful data. Now you take that data you have received from the DAO (your List of model objects), create the object for the widget type that you wish to use and populate the widget object with the data you have received from the DAO. This is exactly what the Skewed Sessions portlet does. The getCurrentSkewedSessions() function in SkewedSessionsManagerImpl.java gets the data from the DAO and the summary() function in SkewedSessionsViewController creates a SkewedSessionsTableWidget object that contains the data. The SkewedSessionsTableWidget object extends the TableWidget class and defines the data that the table widget will display.

LewisDawson 54 posts Joined 11/08
19 Jun 2009

"Is there a way to edit the DynamicQuery portlet to just run a certain SQL statement each time without having to type it?"

The DynamicQuery portlet already does this for you. It saves the last query, system and username that you have run as a portlet preference.

In the executeQuery() function of the DynamicQueryDataserverController.java, the query, system and username are saved to preferences:

// Set the system name in the preferences object
preferences.setSystemName(manager.getSystem(systemId) .getName());
// Set the username in the preferences object
preferences.setUsername(username);
// Set the SQL query in the preferences object
preferences.setSqlQuery(sql);
// Save the last query
ctx.savePreferences("DynamicQuery", preferences);

In the summary() function of the DynamicQueryViewController.java, the preferences are loaded:

// Retrieve the previous query data
final DynamicQueryPreferences preferences = (DynamicQueryPreferences) ctx.loadPreferences(
"DynamicQuery", new DynamicQueryPreferences());
// Add the data for the previous query
ctx.addViewObject("preferences", preferences);

MSkiLLz 40 posts Joined 05/09
19 Jun 2009

I understand what you're saying but I'm trying to figure out how to do this. Your first post indicated how to put the QueryCountDAO into the two .xml files but I wasn't even sure if that same method could be used for every DAO I use. How do you figure out which property name and reference to use?


I also know that the DAOs also have to be implemented in Impl file as well. I followed the skewed sessions and it doesn't completely work. Will following the SkewedSessions sample and using the same method be enough to use any type of DAO?

LewisDawson 54 posts Joined 11/08
19 Jun 2009

"I understand what you're saying but I'm trying to figure out how to do this. Your first post indicated how to put the QueryCountDAO into the two .xml files but I wasn't even sure if that same method could be used for every DAO I use. How do you figure out which property name and reference to use?

I also know that the DAOs also have to be implemented in Impl file as well. I followed the skewed sessions and it doesn't completely work. Will following the SkewedSessions sample and using the same method be enough to use any type of DAO?"

Take a look at the "What is Dependency Injection" article bundled with the PDK for a brief overview of what is going on here. My earlier post with the QueryCountDAO in the .xml files is essentially a generic template for what you need to be doing for any DAO you will need. You can cut and paste and then change the id, class and any properties being injected and you will have a working bean.

The property tag injects a java object into the configured bean at runtime; in the earlier example, the java object is the DAO and the configured bean is the manager. The "name" attribute is that name that corresponds to the variable you are trying to set in the manager. It is case sensitive, so this must be the same as the manager variable name. The "ref" attribute is a reference to the DAO bean you have declared in your dataSourceiBatis.xml file. The value of the "ref" attribute must exactly match the "id" attribute of the bean that you are trying to inject into your Java Bean.

Yes. You can use the same method in SkewedSessions for any type of DAO. You just need to figure out what DAO(s) you will be using to retrieve data and what widget(s) you will be using to display the data. The SkewedSessions example is definitely a good template for almost anything you will need to do.

MSkiLLz 40 posts Joined 05/09
22 Jun 2009

Yeah, I know DynamicQuery saves your last statement but what I meant was if there was a way to just set all the infomation that is inputted into the code so that whenever the DQ portlet is deployed it just runs it automatically. Would it work if I just replaced "username" and "sql" with an actual username and sql statement?

MSkiLLz 40 posts Joined 05/09
24 Jun 2009

Alright, I'll just walk you through what I've done now. I'm not sure these are right. Have I made any mistakes or left anything out?































bean id="systemHealthDAO"







class=" com.teradata.dcs.data.dao.ibatis.SystemHealthDAOiBatis ">







description>DAO for accessing System Health







property name="sqlMapClient" ref="dcsSqlMapClient" />







/bean>























!-- The SystemHealth manager implemenation -->







bean id="systemHealthManager" class=" com.teradata.portlets.systemhealth.service.impl.System HealthManagerImpl">







description>The business delegate for this application







property name="myJavaSystemHealthDAO" ref="systemHealthDAO"/>







/bean>















1. A reference to your injected DAO object:















private SystemHealthDAO myJavaSystemHealthDAO;































2. A setter for the DAO:























public void setMyJavSystemHealthDAO(SystemHealthDAO myJavaSystemHealthDAO)







{







this.myJavaSystemHealthDAO = myJavaSystemHealthDAO;







}































3. A manager function that retrieves the data:















I wasn't sure of what I do here because I think this get function is only for query count































public List getMyQueryCountData(int systemId, Timestamp startTime, Timestamp endTime)







{







return myJavaQueryCountDAO.getQueryCountSumOverTime(systemId, startTime, endTime);







}































4. "Some function that creates a collection of widget model objects for your desired widget type from the data your have retrieved from the DAO. Widget model objects are under the package com.teradata.tags.widgets.model."















I've already created sample widgets but can you use every type of widget for system health?

LewisDawson 54 posts Joined 11/08
25 Jun 2009

You can display any type of data with any type of widget. A widget is simply a tool to meaningfully display otherwise boring and/or confusing data. Deciding how to display meaningful data is the decision of the programmer and/or portlet designer.

MSkiLLz 40 posts Joined 05/09
25 Jun 2009

Alright. Well, I followed the skewedsessions tutorial and I created a project for the systemhealthDAO. Could I get help with these errors?

[javac] C:\SystemHealth\src\java\com\teradata\portlets\ systemhealth\service\
impl\SystemHealthManagerImpl.java:93: cannot find symbol
[javac] symbol : variable lastPercentInState
[javac] location: class com.teradata.portlets.systemhealth.service.impl.Syst
emHealthManagerImpl
[javac] lastPercentInState.put(preferences.getSystem(), st
atistics.getPercentInState());
[javac] ^
[javac] C:\SystemHealth\src\java\com\teradata\portlets\ systemhealth\service\
impl\SystemHealthManagerImpl.java:98: cannot find symbol
[javac] symbol : class Session
[javac] location: class com.teradata.portlets.systemhealth.service.impl.Syst
emHealthManagerImpl
[javac] List sessions = sessionDAO.getCurrentActiveSe
ssions(systemIds);
[javac] ^
[javac] C:\SystemHealth\src\java\com\teradata\portlets\ systemhealth\service\
impl\SystemHealthManagerImpl.java:98: cannot find symbol
[javac] symbol : variable sessionDAO
[javac] location: class com.teradata.portlets.systemhealth.service.impl.Syst
emHealthManagerImpl
[javac] List sessions = sessionDAO.getCurrentActiveSe
ssions(systemIds);
[javac] ^
[javac] C:\SystemHealth\src\java\com\teradata\portlets\ systemhealth\service\
impl\SystemHealthManagerImpl.java:100: cannot find symbol
[javac] symbol : class Session
[javac] location: class com.teradata.portlets.systemhealth.service.impl.Syst
emHealthManagerImpl
[javac] for (Session session : sessions)
[javac] ^
[javac] C:\SystemHealth\src\java\com\teradata\portlets\ systemhealth\service\
impl\SystemHealthManagerImpl.java:121: cannot find symbol
[javac] symbol : variable lastPercentInState
[javac] location: class com.teradata.portlets.systemhealth.service.impl.Syst
emHealthManagerImpl
[javac] return lastPercentInState.get(systemName);
[javac] ^
[javac] 17 errors





*
* SystemHealthManagerImpl.java
*/

package com.teradata.portlets.systemhealth.service.impl;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.teradata.portlets.systemhealth.service.SystemHealt hManager;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import java.util.ArrayList;
import com.teradata.dcs.data.dao.SystemHealthDAO;
import com.teradata.dcs.config.model.System;
import com.teradata.dcs.config.model.SystemHealthCanaryThresh old;
import com.teradata.dcs.config.model.SystemHealthMetricThresh old;
import com.teradata.dcs.data.model.SystemHealth;
import com.teradata.portlets.systemhealth.model.SystemHealthP references;
import com.teradata.dcs.data.model.SystemStatistics;
import com.teradata.dcs.data.dao.SystemStatisticsDAO;


/**
* This class implements the Business Delegate pattern. (see
* http://java.sun.com/blueprints/corej2eepatterns/ Patterns/BusinessDelegat...).
* This class is used to interface between the DAO's (see
* http://java.sun.com/blueprints/corej2eepatterns/ Patterns/DataAccessObjec...)
* and the controllers. Business logic should be implemented here.
*/
public class SystemHealthManagerImpl implements SystemHealthManager
{
private static Log log = LogFactory.getLog(SystemHealthManagerImpl.class);

private SystemHealthDAO systemHealthDAO;

private SystemStatisticsDAO statisticsDAO;

private Map ();

/**
* Set the statistics DAO.
*
* @param value The Statistics DAO.
*/
public void setStatisticsDAO(SystemStatisticsDAO value)
{
statisticsDAO = value;
}

/**
* Set the systemhealth DAO
*
* @param value The Systemhealth DAO.
*/
public void setSystemHealthDAO(SystemHealthDAO value)
{
systemHealthDAO = value;
}

/**
* Retrieves a list of the names of the systems that are monitored by the
* Data Collector.
*
* @return A list of system names.
*/
public List getMonitoredSystems()
{
List systems = systemHealthDAO.getAvailableSystems();
List ();
for (System system : systems)
{
systemNames.add(system.getName());
}
return systemNames;
}
/**
* Gets a list of active system health on the specified system. Eacg list
* item is a system health model.
*
*@param preferences The user's portlet preferences for this portlet instance.
*/
public List getHealth(SystemHealthPreferences preferences)
{
List ();
Integer id = getSystemId(preferences.getSystem());
if (id != null)
{
SystemStatistics statistics = statisticsDAO.getCurrentSystemStatistics(id);
// save the system value
if (statistics != null && statistics.getPercentInState() > preferences.getSystemHealthMetricThreshold())
{
lastPercentInState.put(preferences.getSystem(), statistics.getPercentInState());
List ();
systemIds.add(id);

// fetch the data
List sessions = sessionDAO.getCurrentActiveSessions(systemIds);

for (Session session : sessions)
{
if ((session.getComputedState().equals("ACTIVE"))
&&(session.getPercentInState() > preferences.getSystemHealthMetricThreshold()))
{
result.add(session);
}
}
}
}
return result;
}

/**
* Get the most recent percent in state for the specified system.
*
* @param systemName the system to monitor.
* @return the percent in state or null if no value has been fetched.
*/
public Float getCurrentPercentInState(String systemName)
{
return lastPercentInState.get(systemName);
}
}

LewisDawson 54 posts Joined 11/08
25 Jun 2009

These are very elementary compilation errors. There are symbols in your code that the compiler cannot find. You need to go through all the errors and figure out what symbols the compiler is complaining about. For example, this line:

lastPercentInState.put(preferences.getSystem(), statistics.getPercentInState());

lastPercentInState is a variable that is never declared.

MSkiLLz 40 posts Joined 05/09
01 Jul 2009

Could you tell me how I can edit the sample Heatmap widget which is included in the Widgetopia to display information from my database? I think it will really further help me with what I am doing.

LewisDawson 54 posts Joined 11/08
01 Jul 2009

You will need to provide more information:

1. What database are you referring to? The Teradata database, the DCS cache database, a third-party database?
2. What information do you want to display?

MSkiLLz 40 posts Joined 05/09
01 Jul 2009

The DCS cache database. You know how you can display information from your DCS with the DynamicQuery portlet? Well, I'm trying to use that same DCS to display information on one of those sample portlets. Preferably the Heatmap widget on Widgetopia.

LewisDawson 54 posts Joined 11/08
01 Jul 2009

You have yourself confused here.

The DynamicQuery portlet displays query result sets from queries run directly against the Teradata database. It connects directly to the Teradata database and runs the query you type in, displaying the results of the query.

The DCS cache database is where DCS data collectors persist the data they have collected from the Teradata database.

I have given you a basic template to retrieve and display data from the DCS cache database on earlier pages of this thread. It is virtually a cut and paste template that you can reuse for retrieving all types of data. To retrieve data from the DCS cache database, you use the DAOs that have been supplied to you. These DAOs return a List of Model objects with the data. The key to understanding the data is the javadocs. The javadocs for the DAOs and the Models contain the documentation that describes the data associated with them.

1. Take a look the API documentation (should be in tdpdk-xx.xx.xx.xx\doc\api). Find the documentation for the package com.teradata.dcs.data.model. All the classes in that package represent the metrics that are collected by the DCS and logged to PostgreSQL currently. Look through the classes and find the metrics (ie. the information you want to display) and take note of what class they are associated with.
2. Each class should have a corresponding Data Access Object (DAO) class that resides under com.teradata.data.dcs.dao. The DAO is what you use to retrieve the data from PostgreSQL.

I cannot give you specific help beyond that without you giving me more specific information related to the type of data you are trying to retrieve and display. Different types of information are associated with different DAOs, Models, etc.

MSkiLLz 40 posts Joined 05/09
02 Jul 2009

Ok let me just throw away that question and explain whats going on. I'm building a portlet that displays system health. I wasn't sure if I could display systemhealth on any widget but you explained to me that it was possible to do that. I've decided to use the TableWidget which was used the the SkewedSessions Tutorial. Now, I was confused about how you fetch the data because on the SkewedSessions tutotial the "getCurrentActiveSessions" was used with List and I tried the same with my code but I get this error.

[javac] C:\SystemHealth\src\java\com\teradata\portlets\ systemhealth\service\
impl\SystemHealthManagerImpl.java:53: getCurrentSystemHealth(int) in com.teradat
a.dcs.data.dao.SystemHealthDAO cannot be applied to (java.util.List<java.lang.In
teger>)
[javac] result = systemHealthDAO.getCurrentSystemHealth(systemId
s);
[javac]


I have also copied the section I am talking about and the copy of my code. I wasn't sure where the data is being fetched from so I think thats where I confused myself. Could you help me with this code?

/**
* Gets a list of active skewed sessions running on the specified system. Each list
* item is a session model.
*
* @param preferences The user's portlet preferences for this portlet instance.
*/
public List getCurrentSkewedSessions(SkewedSessionsPreferences preferences)
{
List ();
Integer id = getSystemId(preferences.getSystem());
if (id != null)
{
List ();
systemIds.add(id);

// fetch the data
result = sessionDAO.getCurrentActiveSessions(systemIds);
}
return result;
}



------------------------------MY CODE-------------------------------------------------- -----------

public List getCurrentActiveSystemHealth(SystemHealthPreferences preferences)
{
List ();
Integer id = getSystemId(preferences.getSystem());
if (id != null)
{
List ();
systemIds.add(id);

// fetch the data
result = systemHealthDAO.getCurrentSystemHealth(systemIds);
}
return result;
}

LewisDawson 54 posts Joined 11/08
02 Jul 2009

You are trying to pass in a List of Integer objects to the getCurrentSystemHealth(int) function. This function takes a single system id int (or Integer) only:

public List getCurrentActiveSystemHealth(SystemHealthPreferences preferences)
{
Integer id = getSystemId(preferences.getSystem());
if (id != null)
{
// fetch the data
result = systemHealthDAO.getCurrentSystemHealth(id);
}
return result;
}

MSkiLLz 40 posts Joined 05/09
02 Jul 2009

What about the result variable? It won't be able to find the symbol for that and "Id"

LewisDawson 54 posts Joined 11/08
02 Jul 2009

Sure, you will need that as well:

public List getCurrentActiveSystemHealth(SystemHealthPreferences preferences)
{
SystemHealth result;
Integer id = getSystemId(preferences.getSystem());
if (id != null)
{
// fetch the data
result = systemHealthDAO.getCurrentSystemHealth(id);
}
return result;
}

MSkiLLz 40 posts Joined 05/09
02 Jul 2009

I'm getting a new error.



[javac] C:\SystemHealth\src\java\com\teradata\portlets\ systemhealth\service\

impl\SystemHealthManagerImpl.java:57: incompatible types

[javac] found : com.teradata.dcs.data.model.SystemHealth

[javac] required: java.util.List

[javac] return result;

MSkiLLz 40 posts Joined 05/09
02 Jul 2009

I have Java.util.list already imported so I don't get why i have that error.

LewisDawson 54 posts Joined 11/08
02 Jul 2009

Change the function header to return a SystemHealth object type instead of a List Object.

On a side note, I highly recommend you install/use an IDE such as Eclipse, ItelliJ, or NetBeans to help you solve some of these compilation errors. A good IDE will highlight these simple compilation errors and give you tips to help you resolve them.

MSkiLLz 40 posts Joined 05/09
02 Jul 2009

I actually got Eclipse the other day and I had a hard time importing the source code from the project. My whole project got deleted that way too.

You must sign in to leave a comment.