Topic
  • 1 reply
  • Latest Post - ‏2010-06-10T17:33:41Z by kbauer
SystemAdmin
SystemAdmin
217 Posts

Pinned topic RAM API - Having an issue creating threads/posts in a forum

‏2009-05-21T01:20:01Z |
Posting code and hoping someone has an idea why this isn't working... It seems when I create a new forum with the API (e.g. the commented out line below) then I am able to create the forum along with the new thread/post. However if I simply try to lookup a forum and then create a thread/post those actions are ignored.

Any ideas will be greatly appreciated!




package com.ibm.billgrant.RAMImporter;   

import org.eclipse.core.runtime.NullProgressMonitor;   

import com.ibm.ram.client.RAMAsset; 

import com.ibm.ram.client.RAMAssetQueryBuilder; 

import com.ibm.ram.client.RAMForum; 

import com.ibm.ram.client.RAMSession; 

import com.ibm.ram.client.RAMTopic; 

import com.ibm.ram.common.data.SearchResult;     

public 

class ForumUpdater 
{ 

private 

static RAM ram; 

public 

static 

void main(String[] args) 
{ String assetType = 
"Application"; String community = 
"MyCommunity"; String user = 
"admin"; String pw = 
"admin"; RAMForum theForum = 

null; RAMAsset theAsset = 

null; RAMSession session = 

new RAMSession( 
"http://ramvmware:9080/ram.ws", 
"admin", 
"admin"); RAMAssetQueryBuilder queryBuilder = 

new RAMAssetQueryBuilder(session); queryBuilder.addQueryField(queryBuilder.QUERY_FIELD_NAME, 
"Forum Test"); queryBuilder.addQueryField(queryBuilder.QUERY_FIELD_VERSION, 
"1.0"); SearchResult searchResult = session.getAssets(queryBuilder); 

if ( searchResult.getTotalResultsCount() == 0 ) 
{ System.out.println(
"Asset not found."); 

return; 
} 

else 

if ( searchResult.getTotalResultsCount() > 1 ) 
{ System.out.println(
"Multiple assets found."); 

return; 
} 

else 
{ theAsset = (RAMAsset)searchResult.getAssetSearchResults()[0].getAsset(); System.out.println(
"Found asset " + theAsset.getName()); 
} 
// The code that actually works when uncommented 
//theForum = theAsset.createForum("Forum Test", "Forum Test"); 
// The code that does not let the topic/post get saved RAMForum[] theForums = (RAMForum[])theAsset.getForums(); 

for (

int i=0; i<theForums.length; i++) 
{ theForum = (RAMForum)theForums[i]; 

if ( theForum.getTitle().equals(
"Forum Test") ) 

break; 
} 

if ( theForum != 

null ) 
{ System.out.println( 
"Found forum " + theForum.getTitle() ); 
} 

else 
{ System.out.println( 
"Can't find forum." ); 

return; 
} 
// END: The code that does not let the topic/post get saved RAMTopic theTopic = theForum.createTopic(
"Topic", 
"Topic"); theTopic.createPost(
"Post", 
"Post"); session.put(theAsset, 

new NullProgressMonitor()); System.out.println(
"Done processing"); 
} 
}
Updated on 2010-06-10T17:33:41Z at 2010-06-10T17:33:41Z by kbauer
  • kbauer
    kbauer
    22 Posts

    Re: RAM API - Having an issue creating threads/posts in a forum

    ‏2010-06-10T17:33:41Z  
    This problem has been resolved in the 7.5 development stream...

    http://jazz.net/jazz02/web/projects/Rational%20Asset%20Manager#action=com.ibm.team.workitem.viewWorkItem&id=34047

    This forum is not be monitored.

    Please use the jazz.net forum for future questions...

    http://jazz.net/forums/viewforum.php?f=12