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!

Change Owned By - The java code can run successfully - but no effect 1

Status
Not open for further replies.

smallredville

Programmer
Aug 18, 2008
115
SG
Hi All,

Through this post, I would like to ask anyone who encountered this before :

I can execute the following code successfully but the owned by of the document does not change at all. Only the Created By of the document which changed.

Note : I used UserID and UpdateObjectInfo()

//to get Object related items
import java.util.*;//for our date manip
import com.opentext.api.*;//this needs to be in your classpath
public class Main
{
private static String Server = "127.0.0.1"; //livelink host
private static int Port = 2099; //livelink server port see opentext.ini
private static String DFT = ""; //default database file or schema
private static String User = "Admin"; //username
private static String Pass = "password"; //passwd

public static void main (String [] args)
{
try
{
//LAPI variables
LLSession session;
LAPI_DOCUMENTS doc;
session = new LLSession (Server, Port, DFT, User, Pass);
doc = new LAPI_DOCUMENTS (session);
LLValue LLvalueABS=new LLValue().setAssocNotSet();//will contain the return values
int volID, objID,versionID;
volID = -2000;//Parent VolumeID usually enterprise workspace
//use accessenterprise call if you do not like hardcoding
objID = 819361;//unique number of our object
//Query the task or for that matter anything
if (doc.GetObjectInfo(-2000,objID,LLvalueABS) == 0)
{
System.out.println("Object located Successfully");
int CreatedBy = - LLvalueABS.toInteger("CreatedBy");
int ownedby = LLvalueABS.toInteger("UserID");
System.out.println("this was created by"+CreatedBy);
System.out.println("this was owned by " + ownedby);

int newid = 821780;
LLvalueABS.add("UserID",newid);
doc.UpdateObjectInfo( volID, objID, LLvalueABS ) ;

int ownedby2 = LLvalueABS.toInteger("UserID");
System.out.println("this was owned 2 by " + ownedby2);

}
else
{
System.out.println("Failed to fetch Document");

//Error Checking
System.out.println("Status Code: " + session.getStatus());
System.out.println("Api Error: " + session.getApiError());
System.out.println("Error Message: " + session.getErrMsg());
System.out.println("Status Message: " + session.getStatusMessage());
}


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

}


Lastly, I would like to say many thanks in advance.

Regards,
smallredville

 
This code works without a hitch in my system I changed ownership a couple of times and it worked without a problem.
It is s amll ll install with a lot of modules including records management.I connect as the user 'Admin and that user has everything under the sun.

Well, if I called the wrong number, why did you answer the phone?
James Thurber, New Yorker cartoon caption, June 5, 1937
Certified OT Developer and probably certfiable,Livelink ECM Champion 2008

 
Hi Appnair,

Not sure why it does not take effect on my image. =)

Upon executing the code successfully, I right click the document in livelink and saw the general. However, I can't see the "Owned By" changed to the new user ID.

Anyway, thanks for your reply Appnair.

Regards,
smallredville
 
That is rather perplexing.See this link on the before and after on my instance

in your code I see this int newid = 821780;
that is a valid userlogon in your system correct.Lapi does not validate whether it is actually a valid userid so I actually put a dtreedataid there and it took it.But then both the permissions GUI and the object properties GUI complained.
I am doing this on a LES971 instance

Well, if I called the wrong number, why did you answer the phone?
James Thurber, New Yorker cartoon caption, June 5, 1937
Certified OT Developer and probably certfiable,Livelink ECM Champion 2008

 
Hi AppNair,

I would like to thank you for your efforts to try the scenario and reply to me in such a detail.

I appreciate it very much.

One thing I found out finally is that : what you said is right. All this while, the problem lies with my image.

Out of curiosity, I tested the same code above with my colleague's image and it worked fine (as said by you).

I am sorry for causing all the troubles (^0^;)

Once again, thanks Appnair for your efforts to reply and test. =)

Regards,
smallredville
 
in this case if your livelink behaves differently there ought to be a reason.I am taking a stab in the dark here.The Records Management module has huge says on how permissions are administered could that be a factor here ?

Well, if I called the wrong number, why did you answer the phone?
James Thurber, New Yorker cartoon caption, June 5, 1937
Certified OT Developer and probably certfiable,Livelink ECM Champion 2008

 
Hi Appnair,

What u said is right. The image which I used was given by one of my colleagues who already did some changing to the permissions without my knowledge.

I am sorry for any inconvenience caused =)

Thanks&Regards,
smallredville
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top