smallredville
Programmer
Hello,,,,
I tried to create a shortcut with SHORTCUTTYPE.
But It seems not to work as the code creates a document not a shortcut, do I miss something?
I hope someone can share with me on how to create a shortcut.
Many Thanks in advance....=)
Smallredville
------------------------------------------------------------
code is shown below:
package LAPI;
import com.opentext.api.*;
public class createObjEx {
private static String Server = "localhost";
private static int Port = 2099;
private static String DFT = "";
private static String User = "Admin";
private static String Pass = "password";
public static void main (String [] args)
{
try
{
//variables
LLSession session;
LAPI_DOCUMENTS doc;
LLValue entInfo= new LLValue();
LLValue createInfo = new LLValue().setAssoc();
LLValue objectInfo = new LLValue().setAssoc();
session = new LLSession (Server, Port, DFT, User, Pass);
doc = new LAPI_DOCUMENTS (session);
int volumeID,objectID,objID;
String objName, FilePath;
if(doc.AccessEnterpriseWS(entInfo) != 0)
{
System.out.println("AccessEnterpriseWS Failed.");
return;
}
else
{
volumeID = entInfo.toInteger("VolumeID");
objectID = entInfo.toInteger("ID");
System.out.println("Enterprise Volume"+volumeID+"Enterprise ObjID"+objectID);
}
objName = "Shortcut_HelloWORLD.doc";
FilePath = "C:\\yoyo\\yoyo.txt";
//LAPI_DOCUMENTS.DOCUMENTSUBTYPE = 144 for 'documents'
System.out.println("LAPI_DOCUMENTS.OBJECTTYPE : " + LAPI_DOCUMENTS.SHORTCUTTYPE);
System.out.println("LAPI_DOCUMENTS.OBJECTTYPE : " + LAPI_DOCUMENTS.DOCUMENTSUBTYPE);
putBack(doc, volumeID, objectID, objName, createInfo, objectInfo, FilePath, session);
}
catch (Throwable e)
{
System.err.println(e.getMessage());
e.printStackTrace (System.err);
}
}//main ends
public static void putBack(LAPI_DOCUMENTS doc, int volumeID, int objectID, String objName, LLValue createInfo, LLValue objectInfo, String FilePath, LLSession session) {
if (doc.CreateObjectEx(volumeID, objectID, LAPI_DOCUMENTS.SHORTCUTTYPE, LAPI_DOCUMENTS.DOCUMENTSUBTYPE, objName, createInfo, objectInfo) == 0) {
System.out.println("Document Added Successfully");
LLValue version_info = (new LLValue()).setAssoc();
objectID = objectInfo.toInteger("ID");
//upon successful creation of objects
if (doc.CreateVersion(volumeID, objectID, FilePath, version_info) == 0) {
System.out.println("Version added");
} else {
System.out.println("Version not added");
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());
}
} else {
System.out.println("Failed to Add 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());
}
}//end putBack()
}//class ends
------------------------------------------------------------
I tried to create a shortcut with SHORTCUTTYPE.
But It seems not to work as the code creates a document not a shortcut, do I miss something?
I hope someone can share with me on how to create a shortcut.
Many Thanks in advance....=)
Smallredville
------------------------------------------------------------
code is shown below:
package LAPI;
import com.opentext.api.*;
public class createObjEx {
private static String Server = "localhost";
private static int Port = 2099;
private static String DFT = "";
private static String User = "Admin";
private static String Pass = "password";
public static void main (String [] args)
{
try
{
//variables
LLSession session;
LAPI_DOCUMENTS doc;
LLValue entInfo= new LLValue();
LLValue createInfo = new LLValue().setAssoc();
LLValue objectInfo = new LLValue().setAssoc();
session = new LLSession (Server, Port, DFT, User, Pass);
doc = new LAPI_DOCUMENTS (session);
int volumeID,objectID,objID;
String objName, FilePath;
if(doc.AccessEnterpriseWS(entInfo) != 0)
{
System.out.println("AccessEnterpriseWS Failed.");
return;
}
else
{
volumeID = entInfo.toInteger("VolumeID");
objectID = entInfo.toInteger("ID");
System.out.println("Enterprise Volume"+volumeID+"Enterprise ObjID"+objectID);
}
objName = "Shortcut_HelloWORLD.doc";
FilePath = "C:\\yoyo\\yoyo.txt";
//LAPI_DOCUMENTS.DOCUMENTSUBTYPE = 144 for 'documents'
System.out.println("LAPI_DOCUMENTS.OBJECTTYPE : " + LAPI_DOCUMENTS.SHORTCUTTYPE);
System.out.println("LAPI_DOCUMENTS.OBJECTTYPE : " + LAPI_DOCUMENTS.DOCUMENTSUBTYPE);
putBack(doc, volumeID, objectID, objName, createInfo, objectInfo, FilePath, session);
}
catch (Throwable e)
{
System.err.println(e.getMessage());
e.printStackTrace (System.err);
}
}//main ends
public static void putBack(LAPI_DOCUMENTS doc, int volumeID, int objectID, String objName, LLValue createInfo, LLValue objectInfo, String FilePath, LLSession session) {
if (doc.CreateObjectEx(volumeID, objectID, LAPI_DOCUMENTS.SHORTCUTTYPE, LAPI_DOCUMENTS.DOCUMENTSUBTYPE, objName, createInfo, objectInfo) == 0) {
System.out.println("Document Added Successfully");
LLValue version_info = (new LLValue()).setAssoc();
objectID = objectInfo.toInteger("ID");
//upon successful creation of objects
if (doc.CreateVersion(volumeID, objectID, FilePath, version_info) == 0) {
System.out.println("Version added");
} else {
System.out.println("Version not added");
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());
}
} else {
System.out.println("Failed to Add 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());
}
}//end putBack()
}//class ends
------------------------------------------------------------