}
public ThreadList getThreadList(int userID, int curTicketID)
{
ThreadList threadList = new ThreadList();
CVDal cvdl = new CVDal(dataSource);
Collection colList = null;
cvdl.setSql("support.ticket.getthreadforticket");
cvdl.setInt(1, curTicketID);
colList = cvdl.executeQuery();
cvdl.clearParameters();
cvdl.destroy();
if (colList.size() > 0)
{
Iterator it = colList.iterator();
int i = 0;
while (it.hasNext())
{
i++;
HashMap hm = (HashMap)it.next();
int threadID = ((Long)hm.get("threadid")).intValue();
try
{
IntMember intThreadID = new IntMember("ThreadID", threadID, 10, "", 'T', false, 10);
/*
* Make sure that no more than 255 characters get passed to the list.
* For title and description.
*/
StringMember strTitle = null;
String str = (String)hm.get("title");
String subStr = null;
if (str != null)
{
if (str.length() >= 255)
subStr = str.substring(0, 255);
else
subStr = str;
strTitle = new StringMember("Title", subStr, 10, "", 'T', true);
} else {
strTitle = new StringMember("Title", null, 10, "", 'T', true);
}
StringMember strDesc = null;
str = (String)hm.get("detail");
if (str != null)
{
if (str.length() >= 255)
{
subStr = str.substring(0, 252);
subStr = subStr.concat("...");
} else {
subStr = str;
}
strDesc = new StringMember("Description", subStr, 10, "", 'T', false);
} else
{
strDesc = new StringMember("Description", null, 10, "", 'T', false);
}
StringMember strPriority = new StringMember("Priority", (String)hm.get("priorityname"), 10, "", 'T', false);
StringMember strCreatedBy = new StringMember("CreatedBy", (String)hm.get("createdby"), 10, "", 'T', true);
// StringMember strReference = new
// StringMember("Reference",(String)hm.get("reference"), 10, "", 'T',
// false);
IntMember intIndividualID = null;
IntMember intEntityID = null;
if ((hm.get("creator") != null))
intIndividualID = new IntMember("IndividualID", ((Long)hm.get("creator")).intValue(), 10, "", 'T', false, 10);
else
intIndividualID = new IntMember("IndividualID", 0, 10, "", 'T', false, 10);
if ((hm.get("entityid") != null))
intEntityID = new IntMember("EntityID", ((Long)hm.get("entityid")).intValue(), 10, "", 'T', false, 10);
else
intEntityID = new IntMember("EntityID", 0, 10, "", 'T', false, 10);
Timestamp dtCreated = null;
DateMember dmCreated = null;
String timezoneid = "EST";
if ((hm.get("created") != null))
{
dtCreated = (Timestamp)hm.get("created");
dmCreated = new DateMember("Created", dtCreated, 10, "", 'T', false, 1, timezoneid);
} else {
dmCreated = new DateMember("Created", null, 10, "", 'T', false, 1, timezoneid);
}
ThreadListElement threadlistelement = new ThreadListElement(threadID);
threadlistelement.put("ThreadID", intThreadID);
threadlistelement.put("Description", strDesc);
threadlistelement.put("Title", strTitle);
threadlistelement.put("Created", dmCreated);
threadlistelement.put("Priority", strPriority);
threadlistelement.put("CreatedBy", strCreatedBy);
// threadlistelement.put("Reference",strReference);
threadlistelement.put("IndividualID", intIndividualID);
threadlistelement.put("EntityID", intEntityID);
StringBuffer stringbuffer = new StringBuffer("00000000000");
stringbuffer.setLength(11);
String s3 = (new Integer(i)).toString();
stringbuffer.replace(stringbuffer.length() - s3.length(), stringbuffer.length(), s3);
String s4 = stringbuffer.toString();
threadList.put(s4, threadlistelement);
} catch (Exception e) {
logger.debug(" [Exception] SupportListEJB.getThreadList " + e);
e.printStackTrace();
}
}