Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Urgent:Need help in searching for users thru LAPI

Status
Not open for further replies.

chsatish

Programmer
Jul 22, 2003
9
US
I am trying to search for users based on users LASTNAME. I am getting the following Java Exception.

get(name) not implemented for this datatype
com.opentext.api.LLIllegalOperationException: get(name) not implemented for this
datatype
at com.opentext.api.LLInstance.get(LLInstance.java:77)
at com.opentext.api.LLValue.toValue(LLValue.java:800)
at com.opentext.api.LLConnect.unMarshall(LLConnect.java:303)
at com.opentext.api.LAPI_USERS.ListUserGroup(LAPI_USERS.java:914)
at GetUserInfo.main(GetUserInfo.java:106)


I am not sure where I am doing wrong. I am new to LAPI and any help will be hightly appreciated. I am attaching the code here.

Thanks & Regards,
Satish

########################################################

import com.opentext.api.*;
import java.io.*;
import java.util.*;

public class GetUserInfo
{
private static String Server = "kpvf058.mis.amat.com";
private static int Port = 2099;
private static String DFT = "";
private static String User = "Admin";
private static String Pass = "livelink";

public static void main (String [] args)
{
try
{
//variables
LLSession session;
LAPI_USERS user;
LLValue attribs = new LLValue();
LLValue searchParams = (new LLValue()).setAssoc();
LLValue usersList = new LLValue();
String name, lName;

session = new LLSession (Server, Port, DFT, User, Pass);
user = new LAPI_USERS (session);

searchParams.add("TargetType",LAPI_USERS.SYSTEM);
searchParams.add("SearchType",LAPI_USERS.USER);
searchParams.add("SearchValue","chiluvuri");
searchParams.add("Action",LAPI_USERS.NEXT);
searchParams.add("SearchColumn","LASTNAME");
searchParams.add("SearchOpr","SOUNDSLIKE");

if (user.ListUserGroup( 10, 0, "", 0, searchParams, usersList) != 0)
{
System.out.println("Failed to get User Info");
int ErrorNo = session.getStatus();
String StatusMessage = session.getStatusMessage();
String ErrMsg = session.getErrMsg();
String ApiError = session.getApiError();
System.out.println( "\n Output userInfo -2 -- ErrorNo:" + ErrorNo);
System.out.println( "\n Output userInfo -2 -- StatusMessage:" + StatusMessage);
System.out.println( "\n Output userInfo -2 -- ErrMsg:" + ErrMsg);
System.out.println( "\n Output userInfo -2 -- ApiError:" + ApiError);
}
else
{
System.out.println("Search successful");
System.out.println("The number of users = "+usersList.size());
//lName = attribs.toString("LastName");
//System.out.println(lName);
}

}
catch (Throwable e)
{
System.err.println(e.getMessage() );
e.printStackTrace (System.err);
}
}

}
 
You did have most of the prototype right.Here's your revised code.What I did was to allocate your output value user list to a recarray(setTable) and then correct the type on your search params.There is only once string type in the call.I tested the group 'Default Group' because that is available in all livelink installs.
Code:
import com.opentext.api.*;
import java.io.*;
import java.util.*;

public class GetUserInfo
{
    //private static String Server = "kpvf058.mis.amat.com";
    private static String Server = "localhost";
    private static int Port = 2099;
    private static String DFT = "";
    private static String User = "Admin";
    private static String Pass = "cafadmin";

    public static void main (String [] args)
    {
        try
        {
            //variables
            LLSession session;
            LAPI_USERS        user;
            LLValue attribs = new LLValue();
            LLValue searchParams = (new LLValue()).setAssoc();
            //LLValue usersList = new LLValue();
/*K N Nair this is strictly not needed but by debugging thru builder i saw that
the prototype expects a recarray*/
            LLValue usersList = (new LLValue().setTable());
            String name, lName;
            session = new LLSession (Server, Port, DFT, User, Pass);
            user = new LAPI_USERS (session);
           /*K N Nair Be careful with this assoc there is only one String the rest are
           Integers */
            searchParams.add("TargetType",LAPI_USERS.SYSTEM);
            searchParams.add("SearchType",LAPI_USERS.ANY);
            searchParams.add("SearchValue","Default");
            searchParams.add("Action",LAPI_USERS.NEXT);
            searchParams.add("SearchColumn",LAPI_USERS.NAME);
            searchParams.add("SearchOpr",LAPI_USERS.SOUNDSLIKE);
            /*More opts if you need*/
           // searchParams.add("SearchOpr",LAPI_USERS.CONTAINS);


           /* public    int   ListUserGroup (
                    int           rowsRequest,
                    int           startID,
                    String        startValue,
                    int           groupID,
		            LLValue       searchParams,
                    LLValue       users );

                    Name Type Description
					TargetType integer the type of group in which to search; specify SYSTEM to search all groups or GROUP to search only the group specified by the groupID parameter
					SearchType integer  the type of values to return; specify USER to return users only, GROUP to return groups only, or ANY to return both users and groups
					SearchValue string the value against which the SearchColumn will be compared; for example, the "Bob" in NAME = "Bob"
					Action integer the direction in which to search; specify NEXT or PREVIOUS
					SearchColumn  integer the column to which the comparison will be made; for groups, specify NAME; for users, specify MAILADDRESS, LASTNAME, or FIRSTNAME
					SearchOpr integer the operator defining the type of comparison to be made; specify STARTSWITH, CONTAINS, ENDSWITH, or SOUNDSLIKE

                    */



           if (user.ListUserGroup( 0, 0,"",0,searchParams, usersList) != 0)
            {
                System.out.println("Failed to get User Info");
                    int        ErrorNo         =     session.getStatus();
                    String    StatusMessage     =     session.getStatusMessage();
                    String    ErrMsg             =     session.getErrMsg();
                    String    ApiError         =     session.getApiError();
                    System.out.println( "\n Output userInfo -2 -- ErrorNo:" + ErrorNo);
                    System.out.println( "\n Output userInfo -2 -- StatusMessage:" + StatusMessage);
                    System.out.println( "\n Output userInfo -2 -- ErrMsg:" + ErrMsg);
                    System.out.println( "\n Output userInfo -2 -- ApiError:" + ApiError);
            }
            else
            {
                System.out.println("Search successful");
                System.out.println("The number of users = "+usersList.size());
                //lName = attribs.toString("LastName");
                //System.out.println(lName);
            }

        }
        catch (Throwable e)
        {
            System.err.println(e.getMessage() );
             e.printStackTrace (System.err);
        }
    }

}

Freedom is not worth having if it does not include the freedom to make mistakes.
Mahatma Gandhi

appnair

 
Hi appnair,

Thank you for your time. That fixed the problem. I think main issue is passing the right parameters to the searchParams Assoc.

I have not set any specific type to the return parameter (usersList) as I expect the return method should set the type automatically. Please correct me if my assumption is wrong with LAPI.

You have mentioned in the comments that you have debugged the code thru LAPI. Can you brief me little bit on that? Does livelink builder supports this functionality?

Thanks again for all your help.

Thanks,
Satish
 
Builder is the only way you can test LAPI other than traces you put as output.Since LAPI is not specific to Java or any other language for that matter when I get into a difficult situation I use builder.Read the LAPI documentation even though it is not pretty to use as a blackbox approach.My experience is you can get away with providing customers a whole lot more than the GUI livelink offers but Oscript(builder) is much more efficient in its handling if you needed something more than what livelink offers.Having said this I re-iterate my earlier statement that Oscript is not difficult to understand,a little patience and a dev server on your side ,you will be amazed to see how beautifully,efficiently the livelink server core code is written on and hats off to the livelink programming team.Each of the LAPI calls are in a Ospace object in builder and the prototype is defined there that is why I said that it expected a recarray and I am no prog expert to really say whether LAPi is stronly typed or not.Subscribe to the LAPI forum in opentext.This site has some LAPI stuff that I put together as well as a lot of good livelink stuff.Greg is the guru.

Freedom is not worth having if it does not include the freedom to make mistakes.
Mahatma Gandhi

appnair
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top