Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Content Management (Extended ECM)
API, SDK, REST and Web Services
Updating a documents Mime Type
Geoff_Price_(JTASCAdmin_(Delete)_1422989)
Has anyone used LAPI to update a documents Mime Type? I am using JAVA and LAPI to write a custom interface into Livelink. I allow users with correct permissions to update some of the metadata (Name, catalog, and comments). Works great! But, I also want to allow them to change the mime type of a document. Using the same kind of routine I'm using for updating Name, catalog and comments doesn't seem to work. Here is my code:
-----------------
// Have to call GetObjectInfo first for properly formatted Assoc for objectInfo
LLValue objectInfo = new LLValue();
doc.GetObjectInfo(volID, objID, objectInfo);
String obj_name = request.getParameter("objName");
String obj_desc = request.getParameter("comment");int catalog = Integer.parseInt(request.getParameter("catalog"));
objectInfo.setString("NAME", obj_name);
objectInfo.setString("Comment", obj_desc);
// Can only update catalog using an SQL query. Ughh!
PreparedStatement pstmt = db.prepareStatement("update dtree set catalog = ? where dataID = ?");
pstmt.setInt(1, catalog);
pstmt.setInt(2, objID);
int do_update = pstmt.executeUpdate();
doc.UpdateObjectInfo(volID, objID, objectInfo);
-----------------
That works great! Now, to update the mime type for a document, one would think you could do this...
// Have to call GetVersionInfo first for properly formatted Assoc for objectInfo
LLValue verInfo = new LLValue();
doc.GetVersiontInfo(volID, objID, 0, verInfo);
int docID = verInfo.toInteger("ID");
String mime_type = request.getParameter("mimetype");
verInfo.setString("MimeType", mime_type);
doc.UpdateVersionInfo(volID, docID, 0, verInfo)
But this just won't work for me for some reason. I get back an error that says "could not get results" when I catch the exception at UpdateVersionInfo. Can anyone provide any insight???
Thanks.
Find more posts tagged with
Comments
eLink User
Message from Nair, Krishnankutty N. via eLinkLooking at the API docs I am not sure what is causing the error but whenever I have to use something and update I have used the LLValue objectin conjunction the Assoc object methods and properties.So I would tryto get the verInfo into an assoc and then manipulate it.The setstring returns LLValue verInfo = new LLValue.setAssoc();
//Your code for gtting mime typeverInfo.add("MimeType", mime_type);//sets the MimeTypedoc.UpdateVersionInfo(volID, docID, 0, verInfo)
Also I would examine the contents of the LLValue objectInfo = new LLValue();
doc.GetObjectInfo(volID, objID, objectInfo);
and see if the MimeType is a key in that assoc.Krishnankutty N NairConocoPhillips-----Original Message-----From: eLink Discussion: LAPI Discussion[mailto:lapi@elinkkc.opentext.com]Sent: Monday, April 26, 2004 1:04 PMTo: eLink RecipientSubject: Updating a documents Mime TypeUpdating a documents Mime TypePosted by Price, Geoff on 04/26/2004 02:00 PMHas anyone used LAPI to update a documents Mime Type? I am using JAVA and LAPI to write a custom interface into Livelink. I allow users with correct permissions to update some of the metadata (Name, catalog, and comments). Works great! But, I also want to allow them to change the mime type of a document. Using the same kind of routine I'm using for updating Name, catalog and comments doesn't seem to work. Here is my code:
-----------------
// Have to call GetObjectInfo first for properly formatted Assoc for objectInfo
LLValue objectInfo = new LLValue();
doc.GetObjectInfo(volID, objID, objectInfo);
String obj_name = request.getParameter("objName");
String obj_desc = request.getParameter("comment");int catalog = Integer.parseInt(request.getParameter("catalog"));
objectInfo.setString("NAME", obj_name);
objectInfo.setString("Comment", obj_desc);
// Can only update catalog using an SQL query. Ughh!
PreparedStatement pstmt = db.prepareStatement("update dtree set catalog = ? where dataID = ?");
pstmt.setInt(1, catalog);
pstmt.setInt(2, objID);
int do_update = pstmt.executeUpdate();
doc.UpdateObjectInfo(volID, objID, objectInfo);
-----------------
That works great! Now, to update the mime type for a document, one would think you could do this...
// Have to call GetVersionInfo first for properly formatted Assoc for objectInfo
LLValue verInfo = new LLValue();
doc.GetVersiontInfo(volID, objID, 0, verInfo);
int docID = verInfo.toInteger("ID");
String mime_type = request.getParameter("mimetype");
verInfo.setString("MimeType", mime_type);
doc.UpdateVersionInfo(volID, docID, 0, verInfo)
But this just won't work for me for some reason. I get back an error that says "could not get results" when I catch the exception at UpdateVersionInfo. Can anyone provide any insight???
Thanks. [To reply to this thread, use your normal E-mail reply function.]============================================================Discussion: LAPI Discussion
https://knowledge.opentext.com/knowledge/livelink.exe?func=ll&objId=765428&objAction=viewLivelink
Server:
https://knowledge.opentext.com/knowledge/livelink.exe