[
https://issues.apache.org/jira/browse/CONNECTORS-658?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13592275#comment-13592275
]
David Morana commented on CONNECTORS-658:
-----------------------------------------
Hi Karl,
you just need to add 2 lines of code to the quick and dirty solution I gave you
in connectors-578 for the mime type and file name (they are near the bottom)
(Note well: this has minimal error checking)
here's the whole block of code:
{code:title=GetOTInfo.java}
String encoding = "UTF-8";
String newLine = "\r\n";
String err = "";
int port = 3099;
int status = 0;
int volumeID = 0;
int objectID = 978081; // doc id
LLValue llconfig = ( new LLValue() ).setAssoc();
session = new LLSession(host, port, database,
user, pwd, llconfig);
documents = new LAPI_DOCUMENTS (session);
LLValue elem = new
LLValue().setAssocNotSet();//will contain the return values
documents.GetObjectInfo(volumeID, objectID,
elem);
if (session.getStatus() != 0)
{
// throw an error
err = session.getErrMsg();
err += session.getStatusMessage();
err += session.getApiError();
System.out.print(err);
}
else
{
// get all the general data
// store it in a variable or map ==>
variables for now.
String docname = elem.toString("NAME");
// OpenText document name
String comments =
elem.toString("COMMENT"); // this is called
description in the UI, DCOMMENT in the db and COMMENT here! unbelievable...
int ownerID = elem.toInteger("USERID");
// this actually the owner of the doc.
String createdate =
elem.toDate("CREATEDATE").toString(); // I could have converted to a
date; it's a string for now. I don't really know how to handle dates here. I'll
defer to you on this.
int creator =
elem.toInteger("CREATEDBY"); // userid of the
creator.
//String modified =
elem.toDate("MODIFYDATE").toString(); // string for now. This is
when the Object itself in Livelink was modified. We're NOT going to use this...
//int modifiedby =
elem.toInteger("MODIFIEDBY"); // this is the userid of
the last person to modify the doc. And it's NOT in this collection!!!
//ok I lied you have to do at most 3
calls to GetObjectInfo for the user name.
// this is just a quick and dirty proof
of concept
// we'll have to clean this up, put it
in a loop and check error status after each call at the very least.
LAPI_USERS users = new
LAPI_USERS(session);
LLValue attr = ( new LLValue()
).setAssoc();
users.GetUserByID(ownerID, attr);
String ownername =
attr.toString("NAME"); // owner name
users.GetUserByID(creator, attr);
String creatorname =
attr.toString("NAME"); // creator name
// to get the modifydate and the
modifiedby we have to look at the latest version of the DOCUMENT in Livelink;
NOT the Object representing it.
// modifiedby is actually the version
OWNER; and modifydate is still MODIFYDATE but it's from the latest version of
the document
// we're re-using the LLValue elem
documents.GetVersionInfo(volumeID,
objectID, 0, elem);
int modifiedby =
elem.toInteger("OWNER");
String modified =
elem.toDate("MODIFYDATE").toString(); // here's the
String mimetype =
elem.toString("MIMETYPE").toString(); // the mimetype from get version
info
String filename =
elem.toString("FILENAME").toString(); // might be different from
opentext name above
System.out.println(mimetype);
//again convert the ownerID into a user
name.
users.GetUserByID(modifiedby, attr);
// again Modifiedby is NOT in this collection for some
reason...
String modifiedbyName =
attr.toString("NAME"); // last user to modify the doc.
System.out.println(modifiedbyName);
}
{code}
> Livelink connector: Set either the file name or mime type or both in
> Repository Document
> ----------------------------------------------------------------------------------------
>
> Key: CONNECTORS-658
> URL: https://issues.apache.org/jira/browse/CONNECTORS-658
> Project: ManifoldCF
> Issue Type: Improvement
> Components: LiveLink connector
> Affects Versions: ManifoldCF 1.1.1
> Reporter: Karl Wright
> Assignee: Karl Wright
> Fix For: ManifoldCF 1.2
>
>
> Livelink connector: Set either the file name or mime type or both in
> Repository Document.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira