Security through the Java ACI API NG

This section contains example code that demonstrates how to use the Java ACI API NG to obtain a securityinfo string for a user and perform queries against IDOL.

The sample code makes the following assumptions:

 

The sample code first creates an AciService to use for communicating with IDOL Server. For more information about creating an ACI service, refer to the ACI API Programming Guide.

    // Create the AciService to use when communicating with IDOL Server...
    final AciService aciService = new AciServiceImpl(
            new GssAciHttpClientImpl(new HttpClientFactory().createInstance()),
            new GssAciServerDetails(serviceName, host, port)
    );

The sample code then obtains a securityinfo string:

   final Document document = aciService.executeAction(
            new AciParameters(
                  new AciParameter(AciConstants.PARAM_ACTION, "UserRead"),
                  new AciParameter("UserName", userName),
                  new AciParameter("SecurityInfo", true)
            ),
            new DocumentProcessor()
    );

After extracting the securityinfo string from the XML response, the sample code then sends a query to IDOL:

   final Document results = aciService.executeAction(
          new AciParameters(
                 new AciParameter(AciConstants.PARAM_ACTION, "Query"),
                 new AciParameter("Text", queryText),
                 new AciParameter("combine", "simple"),
                 new AciParameter("maxResults", 10),
                 new AciParameter("totalResults", true),
                 new AciParameter("print", "none"),
                 new AciParameter("summary", "ParagraphConcept"),
                 new AciParameter("characters", 400),
                 new AciParameter("anyLanguage", true),
                 new AciParameter("outputEncoding", "utf8"),
                 new AciParameter("SecurityInfo", securityInfo)
          ),
          new DocumentProcessor()
    );

The sample code prints information about the result documents to the command line. You can modify this to suit your requirements.


_HP_HTML5_bannerTitle.htm