Code to Create and Populate Lookup using Java API

Hi All,
I wish to write a java code to first create a lookup in OIM and then populate with some custom values.
For creating Lookup, I used the following function and it worked:
tcLookupOperationsIntf useLookup=(tcLookupOperationsIntf)factory.getUtility
("Thor.API.Operations.tcLookupOperationsIntf");
useLookup.addLookupCode("Lookup.Custom");
However, If I try using the following function to populate this lookup:
useLookup.addLookupValue("value1","value2",value3",value4");
I got this error:
Thor.API.Exception.tcInvalidLookupException
Please help.
Cheers,
Sunny

You are using the correct API
("value1","value2",value3",value4");
The values which you are providing are wrong.
TRY THIS
addLookupValue("Lokkup.Test", codeValue,decodevalues, "en", "US")
Lookup.Test should be there.

Similar Messages

  • Create group in OID using java api

    Hi all!
    I need to create group in OID using java api. Java api documentation contains examples for creating users but not for groups. I search oracle.com (and google) and didn't find any hint.
    Anybody know the way?
    thank you.

    Andrew,
    a group is created like any other entry in OID. You need to specify the dn, objectclass(es) and (mandatory) attributes.
    e.g.
    objectclass=groupOfUniqueNames
    with
    uniquemember=cn=orcladmin, cn=Users, dc=de,dc=oracle,dc=com
    as an example take a look at
    cn=iASAdmins, cn=Groups,cn=OracleContext,dc=de,dc=oracle,dc=com
    to see the schema (data) for groupofuniquenames you can either use ODM or query the directory server
    ldapsearch -p 3060 -b "cn=subschemasubentry" -s base "objectclass=*"
    regards,
    --Olaf                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Example code for each and every class in java API

    hi,
    Is there any place where i can get example code for eacha and every class in java API.
    for eample...if i wanna find sample codes for all the clases in java.lang.*
    please let me know ASAP.
    thanks in advance

    Crossposted here: http://forum.java.sun.com/thread.jsp?thread=570264&forum=54&message=2820774

  • GetSelectedFields()  for time stamp and user stamp using java api

    using Java API's
    getSelectedFields() returns NULL  value if values presented also, for Time stamp and User stamp
    properties in Flat tables , is there any other alternative way to get the SelectedFields values ?
    Edited by: Vijaya Sekhar Reddy Alla on Mar 19, 2008 3:16 PM

    Well, I can't say I solved the problem, because I got another one afterwards.
    As usually I created a GetFieldListCommand, set its needed attributes and executed it. Then I read all the field properties out:
    FieldProperties[] fieldProp = getFieldListCommand.getFields();
    Afterwards it is possible to do what you want. Using a for-loop.
    for (FieldProperties fp : fieldProperties) {
        UserStampFieldProperties usfp = (UserStampFieldProperties) fp; // <= Cast error
        FieldId[] fieldIDs = usfp.getSelectedFields();
    And this is what I get now:
    Exception in thread "main" java.lang.ClassCastException: com.sap.mdm.schema.fields.FixedWidthTextFieldProperties cannot be cast to com.sap.mdm.schema.fields.UserStampFieldProperties
    Why this happens, I don't know. But it should somehow be solveable.

  • Create User in OID using Java API

    I read the documentation, read javadoc for Java API for OID, but still am not clear "how can I create a user in OID using Java API for OID."
    It tells us how to create a java object User, but then how do we write this object to OID ?
    I searched every where, metalink, forums, google...and am still looking for answere...
    Thanks in Advance
    Cheers
    Puneet

    I did it using the Novell LDAP java api:
    import com.novell.ldap.*;
    public class LdapAdmin {
    public static final String ldap_base = "dc=your,dc=company,dc=com";
    public static final String ldap_user_base = "cn=Users," + ldap_base;
    public static final String ldap_portal_base = "cn=PORTAL_GROUPS,cn=Groups," + ldap_base;
    public static final String ldap_extended_base = "cn=Extended Properties,cn=OracleContext," + ldap_base;
    public static final String ldap_dbdomain_base = "cn=OracleDefaultDomain,cn=OracleDBSecurity,cn=Products,cn=OracleContext," + ldap_base;
    public static final String ldap_context_base = "cn=COMMON,cn=OracleDBAppContext," + ldap_dbdomain_base;
    private static final String default_ldap_host = "infrastructure.your.company.com";
    private static final int default_ldap_port = 4032;
    private static final String default_ldap_login = "cn=orcladmin," + ldap_user_base;
    private static final String default_ldap_pwd = "welcome1";
    private static final String default_user_pwd = "secret";
    private static final String[] personclass_values = { "top", "person", "organizationalPerson", "inetOrgPerson", "orcluser", "orcluserv2" };
    public static LDAPConnection getConnection (String host, int port, String user, String pwd) {
    LDAPConnection lc = new LDAPConnection();
    try {
    lc.connect(host,port);
    lc.bind(user,pwd);
    } catch (LDAPException lex) {
    System.out.println("LDAP Error in getConnection: "+lex.getResultCode()+"-"+lex.getLDAPErrorMessage());
         return lc;
    public static LDAPConnection getConnection (String host, int port) {
    LDAPConnection lc = new LDAPConnection();
    try {
    lc.connect(host,port);
    } catch (LDAPException lex) {
    System.out.println("LDAP Error in getConnection: "+lex.getResultCode()+"-"+lex.getLDAPErrorMessage());
         return lc;
    public static LDAPConnection getConnection (String user, String pwd) {
    LDAPConnection lc = new LDAPConnection();
    try {
    lc.connect(default_ldap_host,default_ldap_port);
    lc.bind(user,pwd);
    } catch (LDAPException lex) {
    System.out.println("LDAP Error in getConnection: ("+lex.getResultCode()+") - "+lex.getLDAPErrorMessage());
    lex.printStackTrace();
         return lc;
    public static LDAPConnection getConnection () {
    return getConnection(default_ldap_host,default_ldap_port);
    public static void bind (LDAPConnection conn, String user, String pwd) {
    try {
    conn.bind(user,pwd);
    } catch (LDAPException lex) {
    System.out.println("LDAP Error in bind: ("+lex.getResultCode()+") - "+lex.getLDAPErrorMessage());
    lex.printStackTrace();
    private static void bind (LDAPConnection conn) {
    bind(conn,default_ldap_login,default_user_pwd);
    public static void modifyAttribute (LDAPConnection conn, String dn, String attr, String val, int mod) {
    LDAPAttribute attribute = new LDAPAttribute(attr,val);
    LDAPModification[] modification = new LDAPModification[] { new LDAPModification(mod,attribute) };
    try {
    conn.modify(dn,modification);
    } catch (LDAPException lex) {
    System.out.println("LDAP Error in modifyAttribute: ("+lex.getResultCode()+") - "+lex.getLDAPErrorMessage());
    public static void modifyAttribute (LDAPConnection conn, String dn, String attr, String val) {
    modifyAttribute(conn,dn,attr,val,LDAPModification.REPLACE);
    public static void addAttribute (LDAPConnection conn, String dn, String attr, String val) {
    modifyAttribute(conn,dn,attr,val,LDAPModification.ADD);
    public static void deleteAttribute (LDAPConnection conn, String dn, String attr, String val) {
    modifyAttribute(conn,dn,attr,val,LDAPModification.DELETE);
    public static void deleteEntry (LDAPConnection conn, String dn) {
    try {
    conn.delete(dn);
    } catch (LDAPException lex) {
    System.out.println("LDAP Error in deleteEntry: ("+lex.getResultCode()+") - "+lex.getLDAPErrorMessage());
    public static boolean isValidDn(LDAPConnection conn, String dn) {
    try {
    LDAPSearchResults res = conn.search(dn);
    } catch (LDAPException lex) {
    System.out.println("LDAP Error in deleteEntry: ("+lex.getResultCode()+") - "+lex.getLDAPErrorMessage());
    return false;
    public static void createPerson (LDAPConnection conn, String net_id, String lname, String fname, String office, String email, String id, String fullname) {
         LDAPAttributeSet attributeSet = new LDAPAttributeSet();
    attributeSet.add(new LDAPAttribute("cn", net_id));
    attributeSet.add(new LDAPAttribute("sn", lname));
    attributeSet.add(new LDAPAttribute("objectclass", personclass_values));
    attributeSet.add(new LDAPAttribute("l", office));
    attributeSet.add(new LDAPAttribute("mail", email));
    attributeSet.add(new LDAPAttribute("employeeNumber", id));
    attributeSet.add(new LDAPAttribute("givenName", fname));
    attributeSet.add(new LDAPAttribute("uid", net_id));
    // attributeSet.add(new LDAPAttribute("fullName", fullname));
    attributeSet.add(new LDAPAttribute("orclpkcs12hint", default_user_pwd));
    attributeSet.add(new LDAPAttribute("orclpassword", VerifyPassword.getHash(net_id,default_user_pwd)));
    attributeSet.add(new LDAPAttribute("userpassword", default_user_pwd));
    attributeSet.add(new LDAPAttribute("orcldefaultprofilegroup", "cn=DEFAULT,"+ldap_portal_base));
    LDAPEntry entry = new LDAPEntry("cn="+net_id+","+ldap_user_base,attributeSet);
    try {
    conn.add(entry);
    } catch (LDAPException lex) {
    System.out.println("LDAP Error in createPerson: ("+lex.getResultCode()+") - "+lex.getLDAPErrorMessage());
    public static void updatePerson (LDAPConnection conn, String net_id, String lname, String fname, String office, String email, String id, String fullname) {
    LDAPModification[] mod = new LDAPModification[8];
    mod[0] = new LDAPModification(LDAPModification.REPLACE,new LDAPAttribute("cn", net_id));
    mod[1] = new LDAPModification(LDAPModification.REPLACE,new LDAPAttribute("sn", lname));
    mod[2] = new LDAPModification(LDAPModification.REPLACE,new LDAPAttribute("l", office));
    mod[3] = new LDAPModification(LDAPModification.REPLACE,new LDAPAttribute("mail", email));
    mod[4] = new LDAPModification(LDAPModification.REPLACE,new LDAPAttribute("employeeNumber", id));
    mod[5] = new LDAPModification(LDAPModification.REPLACE,new LDAPAttribute("givenname", fname));
    mod[6] = new LDAPModification(LDAPModification.REPLACE,new LDAPAttribute("fullName", fullname));
    mod[7] = new LDAPModification(LDAPModification.REPLACE,new LDAPAttribute("uid", net_id));
    try {
    conn.modify("cn="+net_id+","+ldap_user_base,mod);
    } catch (LDAPException lex) {
    System.out.println("LDAP Error in updatePerson: ("+lex.getResultCode()+") - "+lex.getLDAPErrorMessage());
    public static void main (String[] args) {
    try {
    LDAPConnection conn = getConnection(default_ldap_login,default_ldap_pwd);
    // updatePerson(conn,"ID1","Somebody","Joe","CLE","[email protected]","1","Joe Somebody 2");
    // modifyAttribute(conn,"cn=ID1,"+ldap_user_base,"fullName","Joe Somebody",LDAPModification.REPLACE);
    // modifyAttribute(conn,"cn=ID1,"+ldap_user_base,"displayName","Joe Somebody");
    createPerson(conn,"ID1","Somebody","Joe","CLE","[email protected]","1","Joe Somebody");
    // deleteEntry(conn,"cn=ID1,"+ldap_user_base);
    conn.disconnect();
    } catch (LDAPException lex) {
    System.out.println("LDAP Error in main: ("+lex.getResultCode()+") - "+lex.getLDAPErrorMessage());
    }

  • Java API for images retriveal, Create and update in New Java API for SP05 ?

    Hello Everyone,
        Does any one know Which Java API Can be used to Display an Image in main table & API to add an image to Image table and link to Main Table in new release of Java API for MDM SP05.
    Really Appreciate all help.
    Thanks
    Vinita

    Hello Everyone,
        Does any one know Which Java API Can be used to Display an Image in main table & API to add an image to Image table and link to Main Table in new release of Java API for MDM SP05.
    Really Appreciate all help.
    Thanks
    Vinita

  • Problem while creating a custom document using JAVA API in the current Folder

    I am trying to create an instance of a custome type from the API. I have created a custom type via XML. I have associated a JSP with the custom type thru iFS manager. This jsp provides an interface for the user to enter various data. On submit I call some other jsp also loaded into the /ifs/webui/jsps which calls a method in the java class to create an instance of the above mentioned type. This instance needs to be created in the current directory and not in the home directory of the user. I have written a java program which when run from JDeveloper connects to the repository and creates the object, but not as a foldered object. If I load this class into custom_classes directory, I get an exception. I am attaching the code also here which does the actual processing.
    package cms;
    import oracle.ifs.agents.common.*;
    import oracle.ifs.agents.manager.*;
    import oracle.ifs.agents.server.*;
    import oracle.ifs.beans.*;
    import oracle.ifs.common.*;
    public class ContentModule extends Object {
    public static final String CLASSNAME = "CONTENT";
    public static final String TOPICID_ATTRIBUTE = "TOPICID";
    public static final String SITEID_ATTRIBUTE = "SITEID";
    LibrarySession m_session;
    public ContentModule() {
    connectToRepository();
    createDocument("AM5","s");
    public void connectToRepository(){
    try{
    LibraryService l_service=new LibraryService();
    CleartextCredential l_credential = new CleartextCredential("system","manager");
    ConnectOptions l_options=new ConnectOptions();
    l_options.setServiceName("IfsDefault");
    l_options.setServicePassword("ifssys");
    m_session=l_service.connect(l_credential,l_options);
    }catch(IfsException ex){
    ex.setVerboseMessage(true);
    ex.printStackTrace();
    public void createDocument(String p_docName,String p_docContent){
    try{
    DocumentDefinition l_doc=new DocumentDefinition(m_session);
    l_doc.setClassname(CLASSNAME);
    long newId1=5;
    long newId2=5;
    FolderPathResolver l_currentPath=new FolderPathResolver(m_session);
    Folder l_currentFolder=l_currentPath.getCurrentDirectory();
    l_doc.setAddToFolderOption(l_currentFolder);
    l_doc.setName(p_docName);
    l_doc.setContent(p_docContent);
    AttributeValue av1 = AttributeValue.newAttributeValue(newId1);
    l_doc.setAttribute(TOPICID_ATTRIBUTE,av1);
    AttributeValue av2 = AttributeValue.newAttributeValue(newId2);
    l_doc.setAttribute(SITEID_ATTRIBUTE,av2);
    Document l_document=(Document) m_session.createPublicObject(l_doc);
    }catch(IfsException ex){
    ex.setVerboseMessage(true);
    ex.printStackTrace();
    public static void main(String[] args) {
    ContentModule contentModule = new ContentModule();
    Any help will be highly appreciated.
    Thanks

    Please print out the Verbose Stack Trace generated when you run this application.
    I suspect that you FolderPathResolver is not pointed at the directory you think it is. You might want to try printing out
    I_CurrentFolder.getAnyFolderPath();
    and I_CurrentFolder.getName();
    null

  • Image not displayed in pdf generated using Java API for Forms service

    Hi,
    I am creating a pdf document using Java API for Forms Service.
    I am able to generate the pdf but the images are not visible in the generated pdf.
    The image relative path is coming in the xml as defined below. The images are stored dynamically in the Livecycle repository each time a request is fired with unique name before the xml is generated.
    <imageURI xfa:contentType="image/png" href="../Images/logo.png"></imageURI>
    Not sure if I need to specify specify specific URI values that are required to render a form with image.
    The same thing is working when I generate pdf document using Java API for Output Service.
    As, I need to generate interactive form, I have to use Forms service to generate pdfs.
    Any help will be highly appreciated.
    Thanks.

    Below is the code snippet:
                //Create a FormsServiceClient object
                FormsServiceClient formsClient = new FormsServiceClient(myFactory);
                //Specify URI values that are required to render a form
                URLSpec uriValues = new URLSpec();
                                  // Template location contains the whole rpository path for the form
                uriValues.setContentRootURI(templateLocation);
               // The base URL where form resources such as images and scripts are located.  Whole Image path is passed in BaseUrl in the http format.
                      String baseLocation = repositoryPath.concat(serviceName).concat(imagesPath);   
                                  uriValues.setBaseURL(baseLocation);                                        
                // Set run-time options using a PDFFormRenderSpec instance
                PDFFormRenderSpec pdfFormRenderSpec = new PDFFormRenderSpec();
                pdfFormRenderSpec.setCacheEnabled(new Boolean(true));           
                pdfFormRenderSpec.setAcrobatVersion(com.adobe.livecycle.formsservice.client.AcrobatVersio n.Acrobat_8);
                                  //Invoke the renderPDFForm method and write the
                //results to a client web browser
                String tempTemplateName =templateName;
                FormsResult formOut = formsClient.renderPDFForm(tempTemplateName,
                                              inXMDataTransformed,pdfFormRenderSpec,uriValues,null);
                //Create a Document object that stores form data
                Document outputDocument = formOut.getOutputContent();
                InputStream inputStream = outputDocument.getInputStream();

  • Search Measurement field using Java APIs

    Hi All
    I have a measurement field in the repos, which has to be searched using Java APIs. Can you please put in the code to search a measurement field using Java APIs
    Thanks
    Suresh

    HI,
    I have the following environments.
    - SAP Portal 7.01 SP5
    - SAP MDM 7.1 SP3
    - SAP NWDS 7.01.05
    --> I created a Development Component of Type "External Library" and add all MDM Jars in library folder, created Public Parts for Compilation & Assembly with both Build Time & Run Time.
    --> Created a new Development Component of Type J2EE Server Component (Library) and add the above two Public Parts as used DCs with only Build Time. Deployed this project in Portal Server (I can see the MDM Jars files when i view the project in Visual Administrator)
    --> Created a new Development Component of Type WEBDYNPRO, and add the above J2EE Server Component DC as a Used DC with Build Time only. Add an entry under Library References for the above J2EE DC. Build the project and deployed in Portal. When i run the project, i get "NoClassDefFoundException".
    We downloaded MDMJ71003_13-10006189.zip from Service Marketplace in which u201Cmdm-api-7.1.03.62-java1.4.2.zipu201D has MDM Jars.
    Could any one please help me? Your help is really appreciated.
    Thanks
    Vijay Budati

  • Modifying record in MDM using JAVA API

    hello all
    I have created record in MDM using JAVA API now I want to update record using API. I used ModifyRecordCommand. But this requires input as Record but I have RecordID of the record to be modified. How do I get Record value from RecordID.

    Hi,
                      You can use RetrieveRecordsByIdCommand to get the record by Record Id.
                RetrieveRecordsByIdCommand recordbyidcom = new  RetrieveRecordsByIdCommand(con);
                recordbyidcom.setSession(session);
                recordbyidcom.addId(recordid);
                recordbyidcom.setResultDefinition(resultdefinition);
                recordbyidcom.execute();
                RecordResultSet rs = recordbyidcom.getRecords();
                Record record = rs.getRecord(0);
                //Modify the record
                record.setFieldValue(fieldid,value);
                ModifyRecordCommand modify = new ModifyRecordCommand(con);
                modify.setSession(session);
                modify.setRecord(record);
                modify.execute();
    Regards,
    Sreenivasulu Thimmanapalli.
    Edited by: Sreenivasulu Thimmanapalli on Dec 8, 2008 2:36 AM

  • Create and Populate a Hyperion Planning Cube using Hyperion Data Integratio

    Friends,
    I am new to Essbase and have worked extensively in Informatica. Hyperion DIM (OEM version of Informatica) is chosen to create and populate a Hyperion Planning System (with Essbase cube in the backend).
    I am using Hyperion DIM 9.3.
    Can someone let me know (or share a document) how I can do the following
    1) Create a Planning application with a Essbase Cube in the backend using Hyperion Data Integration Management
    2) How to populate the Essbase outline and the actuals Essbase cube with data using DIM.
    Thanks a lot for all help.

    Hi,
    You cannot create planning applications using DIM.
    To load metadata have a look at :- http://www.oracle.com/technology/obe/hyp_fp/DIM_Planning/OBE_Dim_Planning.html
    You can refresh planning database in DIM by
    To enable the Refresh Database property for a session:
    In Workflow Manager, right-click the session and select Edit.
    Click the Mapping tab.
    Select a Planning target.
    Check the Refresh Database box.
    Ok?
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • Need Sample Code for Vendor creation using JAVA API

    Hi,
    I have a scenario like Vendor creation using <b>Java API</b>.
    1.I have Vendors (Main) Table.
    2.I have <b>look up</b> tables like Account Group.
    3.Also <b>Qualifier table</b>(Phone numbers) too.
    Could you please give me the sample code which helps me to create Vendor records using Java API?
    <b>I need Code samples which should cover all of the above scenario.</b>
    <b>Marks will be given for the relevent answers.</b>
    Best Regards
    PK Devaraj

    Hi Devraj,
    I hope the below code might solve all your problem:-
    //Adding Qualified field
    //Creating empty record in Qualifed table 
    //Adding No Qualifiers
    Record qualified_record = RecordFactory.createEmptyRecord(new TableId(<TableId>));
    try {
    qualified_record.setFieldValue(new FieldId(<fieldId of NoQualifier), new StringValue(<StringValue>));//Adding No Qualifier
    catch (IllegalArgumentException e2) {
    // TODO Auto-generated catch block
    e2.printStackTrace();
    catch (MdmValueTypeException e2) {
    // TODO Auto-generated catch block
    e2.printStackTrace();
    //Creating Record in Qualified table
    CreateRecordCommand create_command = new CreateRecordCommand(connections);
    create_command.setSession(sessionId);
    create_command.setRecord(qualified_record);
    try
    create_command.execute();
    catch(Exception e)
    System.out.println(e.toString());
    RecordId record_id = create_command.getRecord().getId();
    //Adding the new record to Qualifed Lookup value and setting the Yes Qualifiers
    QualifiedLookupValue lookup_value = new QualifiedLookupValue();
    int link = lookup_value.createQualifiedLink(new QualifiedLinkValue(record_id));
    //Adding Yes Qualifiers
    lookup_value.setQualifierFieldValue(0 , new FieldId(<FieldID of Yes Qualifier>) , new StringValue(<StringValue>));
    //Now adding LookUP values
    //Fetch the RecordID of the value selected by user using the following function
    public RecordId getRecordID(ConnectionPool connections , String sessionID , String value , String Fieldid , String tableid)
    ResultDefinition rsd = new ResultDefinition(new TableId(tableid));
    rsd.addSelectField(new FieldId(Fieldid));
    StringValue [] val = new StringValue[1];
    val[0] = new StringValue(value);
    RetrieveRecordsByValueCommand val_command = new RetrieveRecordsByValueCommand(connections);
    val_command.setSession(sessionID);
    val_command.setResultDefinition(rsd);
    val_command.setFieldId(new FieldId(Fieldid));
    val_command.setFieldValues(val);
    try
         val_command.execute();
    catch(Exception e)
    RecordResultSet result_set = val_command.getRecords();
    RecordId id = null;
    if(result_set.getCount()>0)
         for(int i = 0 ; i < result_set.getCount() ; i++)
         id = result_set.getRecord(i).getId();     
    return id;
    //Finally creating the record in Main table
    com.sap.mdm.data.Record empty_record = RecordFactory.createEmptyRecord(new TableId("T1"));
    try {
         empty_record.setFieldValue(new FieldId(<FieldId of text field in Main table>),new StringValue(<StringValue>));
         empty_record.setFieldValue(new FieldId(<FieldId of lookup field in Main table>), new LookupValue(<RecordID of the value retrieved using the above getRecordID function>));
    empty_record.setFieldValue(new FieldId(<FieldId of Qualified field in Main table>), new QualifiedLookupValue(<lookup_value>));//QualifiedLookUp  value Retrieved above
    } catch (IllegalArgumentException e1) {
    // TODO Auto-generated catch block
         e1.printStackTrace();
    } catch (MdmValueTypeException e1) {
         // TODO Auto-generated catch block
         e1.printStackTrace();
    //Actually creating the record in Main table
    CreateRecordCommand create_main_command = new CreateRecordCommand(connections);
    create_main_command.setSession(sessionId);
    create_main_command.setRecord(empty_record);
    try
         create_main_command.execute();
    catch(Exception e)
         System.out.println(e.toString());
    Thanks
    Namrata

  • Creating a sample report using JAVA SDK

    Hi,
    I am trying to create a sample report using JAVA SDK.
    I slelect 4 "free cells" and pass 4 different strings to it.
    I even slelect the font colour and size. When i run the class and try to view the report in Infoview, I only seeblank blocks without any data. Now if I edit the report from infoview, and save the changes, I am able to see the data.
    My issue is, Why am I not able to see the data when I run the java code.
    Please find teh code below.
    package com;
    import java.awt.Color;
    import java.io.FileOutputStream;
    import java.util.ArrayList;
    import java.util.Date;
    import java.util.List;
    import com.businessobjects.rebean.wi.BinaryView;
    import com.businessobjects.rebean.wi.DataProvider;
    import com.businessobjects.rebean.wi.DataProviders;
    import com.businessobjects.rebean.wi.DataSource;
    import com.businessobjects.rebean.wi.DataSourceObject;
    import com.businessobjects.rebean.wi.DocumentInstance;
    import com.businessobjects.rebean.wi.DocumentLocaleType;
    import com.businessobjects.rebean.wi.FontImpl;
    import com.businessobjects.rebean.wi.FreeCell;
    import com.businessobjects.rebean.wi.HTMLView;
    import com.businessobjects.rebean.wi.OutputFormatType;
    import com.businessobjects.rebean.wi.PageHeaderFooter;
    import com.businessobjects.rebean.wi.Query;
    import com.businessobjects.rebean.wi.Recordset;
    import com.businessobjects.rebean.wi.Report;
    import com.businessobjects.rebean.wi.ReportBody;
    import com.businessobjects.rebean.wi.ReportCell;
    import com.businessobjects.rebean.wi.ReportContainer;
    import com.businessobjects.rebean.wi.ReportElement;
    import com.businessobjects.rebean.wi.ReportEngine;
    import com.crystaldecisions.sdk.framework.CrystalEnterprise;
    import com.crystaldecisions.sdk.framework.IEnterpriseSession;
    import com.crystaldecisions.sdk.framework.ISessionMgr;
    import com.crystaldecisions.sdk.occa.infostore.IInfoObject;
    import com.crystaldecisions.sdk.occa.infostore.IInfoObjects;
    import com.crystaldecisions.sdk.occa.infostore.IInfoStore;
    import com.crystaldecisions.sdk.plugin.CeKind;
    public class Aug7th {
          * @param args
         public static void main(String[] args) {
              // TODO Auto-generated method stub
              String CMS = "pundl8136:6400";
              String userID = "srivas";
              String password = "morcom123";
              String auth = "secEnterprise";
              List<String> entire =new ArrayList<String>();
              List<String> country =new ArrayList<String>();
              List<String> resort =new ArrayList<String>();
              IEnterpriseSession enterpriseSession;
              try
                   ISessionMgr mySessionMgr = CrystalEnterprise.getSessionMgr();
                   enterpriseSession = mySessionMgr.logon(userID, password, CMS,auth);
                   if (enterpriseSession != null)
                   {//Create and store useful objects for the session.
                        IInfoStore iStore = (IInfoStore)enterpriseSession.getService("InfoStore");
                        ReportEngine reportEngine = (ReportEngine)enterpriseSession.getService("WebiReportEngine");
                        IInfoObject infoView = null;
                        String str = "SELECT SI_ID, SI_NAME, SI_PARENTID FROM CI_INFOOBJECTS WHERE (SI_KIND = '"+CeKind.WEBI+"' OR SI_KIND='FullClient') " +
                        "AND SI_INSTANCE = 'false' AND SI_NAME='Structure Test_001_Java' ORDER BY SI_NAME ASC ";
                        //String str = "SELECT SI_ID, SI_NAME, SI_PARENTID FROM CI_INFOOBJECTS ORDER BY SI_NAME ASC ";
                        IInfoObjects objInfoObjectsWIDs = (IInfoObjects) iStore.query(str);
                        System.out.println(objInfoObjectsWIDs.size());
                        IInfoObject objInfoObjectWID = (IInfoObject) objInfoObjectsWIDs.get(0);
                        DocumentInstance doc = reportEngine.openDocument(objInfoObjectWID.getID());
                        DataProviders dps = doc.getDataProviders();
    //                     Retrieve the 1st data provider
                        DataProvider dp = dps.getItem(0);
    //                     Retrieve the universe objects
                        DataSource ds = dp.getDataSource ();
                        Query q = dp.getQuery();
                        Recordset rs = dp.getResult(0);
    //                     0: assume query has one flow
                        rs.first();
    //                     Print the column types. They can be Integer, String,
    //                     or Date.
                        for (int i = 0; i < rs.getColumnCount(); i++) {
                        Class c = rs.getColumnType(i);
                        StringBuffer sbt = new StringBuffer();
                        if ( c.equals(Integer.class) )
                        sbt.append("Integer");
                        if ( c.equals(String.class) )
                        sbt.append("String");
                        if ( c.equals(Date.class) )
                        sbt.append("Date");
                        sbt.append(";");
                        System.out.println(sbt.toString());
                        System.out.println(rs.getColumnCount());
                        while (!rs.isLast()) {
    //                          column names
                             StringBuffer sbn = new StringBuffer();
                             StringBuffer sbd = new StringBuffer();
                             for (int j = 0; j < rs.getColumnCount(); j++) {
                             sbn.append( rs.getColumnName(j).toString() );
                             sbn.append(";");
                             System.out.println("sbn "+sbn.toString());
    //                          data
                             for (int k= 0; k< rs.getColumnCount(); k++) {
                             sbd.append( rs.getCellObject(k).toString() );
                             sbd.append(";");
                             entire.add(rs.getCellObject(k).toString());
                             System.out.println("sbd "+sbd.toString());
                             rs.next();
                        System.out.println(entire.size());
                        for(int i=0;i<entire.size();i++){
                             country.add(entire.get(i));
                             i++;
                             System.out.println("entireList "+entire.get(i));
                             resort.add(entire.get(i));
                        DataSourceObject city = ds.getClasses().getChildByName("Country");
                        DataSourceObject resorts = ds.getClasses().getChildAt(1);
                        dp.runQuery();
                        ReportContainer report = doc.createReport("Resort");
                        PageHeaderFooter header = report.getPageHeader();
                        FreeCell headerCell = header.createFreeCell("Resort Report");
                        PageHeaderFooter footer = report.getPageFooter();
                        FreeCell footerCell = footer.createFreeCell("Report Ends");
                        ReportBody body =  report.createReportBody();
                        for(int k=0;k<resort.size();k++){
                        FreeCell res=body.createFreeCell(resort.get(k));
                        res.getAttachTo();
                        res.setHeight(15d);
                        res.setWidth(30d);
                        Color c = new Color(255,255,255);
                        Color c1 = new Color(255,0,0);
                        FontImpl fnt = (FontImpl)res.getFont();
                        fnt.getDecoration().setTextColor(c1);
                        res.setFont(fnt);
                        //res.deleteAttachment();
                        //res.setAttachTo(body,VAnchorType.BOTTOM,HAnchorType.NONE);
                        doc.applyFormat();
                        doc.refresh();
                        final String l_docToken = doc.getStorageToken();
                        final DocumentInstance l_docToSave = reportEngine.getDocumentFromStorageToken(l_docToken);
                        doc.saveAs("mor31",835,null,null);
                        doc.closeDocument();
                        str = "SELECT SI_ID, SI_NAME, SI_PARENTID FROM CI_INFOOBJECTS WHERE (SI_KIND = '"+CeKind.WEBI+"' OR SI_KIND='FullClient') " +
                        "AND SI_INSTANCE = 'false' AND SI_NAME='mor31' ORDER BY SI_NAME ASC ";
                        //String str = "SELECT SI_ID, SI_NAME, SI_PARENTID FROM CI_INFOOBJECTS ORDER BY SI_NAME ASC ";
                        objInfoObjectsWIDs = (IInfoObjects) iStore.query(str);
                        System.out.println(objInfoObjectsWIDs.size());
                        objInfoObjectWID = (IInfoObject) objInfoObjectsWIDs.get(0);
                        DocumentInstance doc1 = reportEngine.openDocument(objInfoObjectWID.getID());
                        String token = doc1.getStorageToken();
                        DocumentInstance doc2 = reportEngine.getDocumentFromStorageToken(token);
                        doc2.saveAs("123123", 835, null, null);
                   //     doc.refresh();
                        //doc.save();
                   enterpriseSession.logoff();
              catch(Exception e)
                   e.printStackTrace();

    duplicate post:
    Sample report using JAVA SDK

  • I need to create  .pst  ext . file using java,whi will import in ms outlook

    {color:#ff0000}*I need to create .PST extension file using java which will be able to import in ms outlook,and that .pst file will contain root folder (like Personal Folders) and inbox,sent mail*{color}
    give me some hint It is essential task .we have to implement code in  java

    I'm using the thin drivers.
    The answer to your question is no, you do not need to create a DSN to connect to Oracle. The Oracle thin driver is all that is required. Your code looks OK to me, I'm assuming that you xxx'd out the IP, and that you are using a real IP in the actual code.
    The message you got back is pretty generic, but can indicate that the Oracle database listener isn't available. Perhaps the database is on a different port, or perhaps the listerner isn't running. Perhaps you have the IP address wrong.
    So, to be very basic:
    1) Can you ping the server you are trying to connect to? This makes sure you are using a valid IP address.
    2) Can you connect to the Oracle server from an Oracle client? This makes sure the listener is running properly, and that you know the correct port number and login information (The port number could be in a local or server based TNS file, or available through an Oracle names server. You might try using the program tnsping if it is available on the client for validation.
    3) If you can do 1 and 2, then be sure you are using the same connection parameters (server, port userid and password) that worked with 2.
    4) Verify that you are using (pointing to) the correct set of Oracle classes for the thin connection. This can be tricky if you have different versions of Oracle on the client then on the server, but is documented on the Oracle website.
    5) If everything checks out, you might want to verify that you are using the most recent versions of the thin drivers, including the Oracle patches.
    Hope it helps - good luck,
    Joel

  • How to create the groups in OID Using Java API.

    Hi,
    I need to create the group in OID Using Java API's only(i.e., javax.naming.* only).
    I need to achieve it without using any oracle specific jars.
    Is there any way to achieve it?.If there's a option to achieve it,do let me know.
    I also need to create the users in that group ,after creating it.
    If you share any useful link or ideas for the same would be great.
    Thanks
    Balaji

    bobws wrote:
    Hi,
    I want to find the installed JREs in windows using java. I couldn't fine any java API. So I am using the below code to fetch the JRE list from windows registries & parse the returned collection to know the installed JRE.Why? If you are running java you already have a JRE. So why not just use it?
    >
    String key = "HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Runtime Environment";
    Runtime.getRuntime().exec(
    "reg query " + "\"" + key + "\"");
    Is it legal to retrieve the installed JREs in this way? Legal? It is OS specific, and to a certain extent dependent on vendor and what the vendor wants to do. Could also be impacted by permissions. Other than that it is ok.
    I am feeling like its a type of hacking. So I couldn't decide whether this is legal (recommended) way of using. Does anybody can answer me. I can see the similar posts in google. Somebody suggests this way & somebody suggests to use preference API which is similar to this. Appreciate your help.Preferences won't work. It doesn't allow access to the registry in general, only a part of it. There are discussions in the JNI forum about retrieving VM versions. Prior to actually using the VM though.

Maybe you are looking for

  • IDOC is posting with Errors in File to IDOC scenario

    Hi,    I did the File  to IDOC scenario for CREMAS  . IDOC is posting with Errors .. i.e. in the status record it was showing  56- EDI: Partner profile inbound not available  .. If I manually process that IDOC in WE19 , then it was processing success

  • Alert System for playbook

    Hi guy, i read up a little with regards to the playbook. it uses bluetooth connecting to the blackberry mobile to surf the internet,therefore i would like to ask, should 1 day, you forget your playbook and left it on the table, if it's possible to ha

  • How to configure port in oracle

    dear all i want to install oracle database 10g and application server 10.1.2.0.2 on same machine .but while doing so i am getign error that already listener port is used by another object .so how and what should i do as i want to install bothe oracle

  • Checking Time Dimension

    Hi experts! I have a Time dimension with next members: Year--> INT-----> Exemple: 2011 Quarter-> Char--> Exemple: Q1/11 Month-> Char --> Exemple: January Day-> Char ------> Exemple: 1 January Date-> Date ---> Exemple: 01/01/2011 When I try to get a r

  • Allow Aspect Ratio Save as Default or Preset

    Requesting feature; aspect ratios can be saved as camera default or as a develop preset.