ossiejhmoore

DemonstrateLiveReportIssue

Nov 5th, 2012
336
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.72 KB | None | 0 0
  1. import com.opentext.api.LAPI_DOCUMENTS;
  2. import com.opentext.api.LLSession;
  3. import com.opentext.api.LLValue;
  4. import com.opentext.api.LLValueEnumeration;
  5.  
  6. public class DemonstrateLiveReportIssue {
  7.     private static LLSession session;
  8.    
  9.     public static void main(String [] args) {
  10.         /* YOUR HOSTNAME AND LAPI PORT */
  11.         String host = "yourhostname";
  12.         int port = 2099;
  13.         /* YOUR USERNAME AND PASSWORD */
  14.         String user = "yourusername";
  15.         String pass = "yourpassword";
  16.         /* DATAID OF REPORT */
  17.         int reportId = 163687730;
  18.  
  19.         session = new LLSession(host, port, null, user, pass);
  20.         LAPI_DOCUMENTS apiDoc = new LAPI_DOCUMENTS(session);
  21.        
  22.         LLValue rptInfo = (new LLValue()).setAssocNotSet();
  23.         check(apiDoc.GetObjectInfo(0, reportId, rptInfo));
  24.        
  25.         //set first input parameter to "Enterprise"
  26.         rptInfo.toValue("extendeddata").toValue("inputs").toValue(0).add("value", "Enterprise");
  27.        
  28.         LLValue results = (new LLValue()).setAssocNotSet();
  29.         check(apiDoc.RunReport(
  30.                 rptInfo.toInteger("VOLUMEID"), rptInfo.toInteger("ID"),
  31.                 rptInfo.toValue("extendeddata").toValue("inputs"), results));
  32.        
  33.         LLValueEnumeration values = results.enumerateValues();
  34.         while(values.hasMoreElements()) {
  35.             LLValue next = values.nextValue();
  36.             System.out.printf("id: %s, name: %s%n",
  37.                     next.toInteger("DATAID"),
  38.                     next.toString("NAME"));
  39.         }
  40.     }
  41.    
  42.     private static void check(int retval) {
  43.         if (retval != 0) {
  44.             throw new RuntimeException(session.getStatusMessage());
  45.         }
  46.     }
  47. }
Add Comment
Please, Sign In to add comment