ossiejhmoore icon

DemonstrateLiveReportIssue

ossiejhmoore | PRO | 11/05/12 01:12:43 PM UTC | 0 ⭐ | 329 👁️ | Never ⏰ | []
Java |

1.72 KB

|

None

|

0 👍

/

0 👎

import com.opentext.api.LAPI_DOCUMENTS;
import com.opentext.api.LLSession;
import com.opentext.api.LLValue;
import com.opentext.api.LLValueEnumeration;
 
public class DemonstrateLiveReportIssue {
    private static LLSession session;
    
    public static void main(String [] args) {
        /* YOUR HOSTNAME AND LAPI PORT */
        String host = "yourhostname";
        int port = 2099;
        /* YOUR USERNAME AND PASSWORD */
        String user = "yourusername";
        String pass = "yourpassword";
        /* DATAID OF REPORT */
        int reportId = 163687730; 
 
        session = new LLSession(host, port, null, user, pass);
        LAPI_DOCUMENTS apiDoc = new LAPI_DOCUMENTS(session);
        
        LLValue rptInfo = (new LLValue()).setAssocNotSet();
        check(apiDoc.GetObjectInfo(0, reportId, rptInfo));
        
        //set first input parameter to "Enterprise"
        rptInfo.toValue("extendeddata").toValue("inputs").toValue(0).add("value", "Enterprise");
        
        LLValue results = (new LLValue()).setAssocNotSet();
        check(apiDoc.RunReport(
                rptInfo.toInteger("VOLUMEID"), rptInfo.toInteger("ID"), 
                rptInfo.toValue("extendeddata").toValue("inputs"), results));
        
        LLValueEnumeration values = results.enumerateValues();
        while(values.hasMoreElements()) {
            LLValue next = values.nextValue();
            System.out.printf("id: %s, name: %s%n", 
                    next.toInteger("DATAID"),
                    next.toString("NAME"));
        }
    }
    
    private static void check(int retval) {
        if (retval != 0) {
            throw new RuntimeException(session.getStatusMessage());
        }
    }
}

Comments