Skip Headers
Oracle® Fusion Middleware Developer's Guide for Imaging and Process Management
11g Release 1 (11.1.1)

Part Number E12784-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to current chapter
Up
Go to next page
Next
View PDF

2.3 Introductory Sample

The following example is a simple demonstration of some of some basic functionality provided by the Oracle I/PM integration API. The example simply logs in to the Oracle I/PM system, lists viewable applications, and logs out.

Example 2-1 Listing Viewable Applications

package devguidesamples;
 
import java.util.List;
import java.util.Locale;
 
import oracle.imaging.Application;
import oracle.imaging.ApplicationService;
import oracle.imaging.BasicUserToken;
import oracle.imaging.ImagingException;
import oracle.imaging.NameId;
import oracle.imaging.ServicesFactory;
import oracle.imaging.UserToken;
 
public class IntroSample {
   public static void main(String[] args) {
 
      try { // try-catch
         UserToken credentials = new BasicUserToken("ipmuser", "ipmuserpwd");
         ServicesFactory servicesFactory =
            ServicesFactory.login(credentials, Locale.US, "http://ipmhost:16000/imaging/ws");
 
         try { // try-finally to ensure logout
            ApplicationService appService = servicesFactory.getApplicationService();
           
            // List the viewable applications to confirm that "Invoices" exists
            List<NameId> appsList = appService.listApplications(Application.Ability.VIEW);
            for (NameId appNameId: appsList) {
               System.out.println( appNameId );
            }
         }
         finally {
            if (servicesFactory != null) {
               servicesFactory.logout();
            }
         }
      }
      catch (ImagingException e) {
         System.out.println(e.getMessage());
      }
   }
}