smallredville
Programmer
Hello...=)
After successful testing with the createObjectEx() and createVersion(), I tried to move one step ahead.
What I tried to do is to add a document to a specific folder; for e.g. Inside a root folder with (ID 2000 and volume ID -2000) has a folder with ID 684333.
I tried to add a document to that particular folder (ID = 684333), but I got an error message as follows:
Exception in thread "main" com.opentext.api.LLIllegalOperationException: get(name) not implemented for this datatype
at com.opentext.api.LLInstance.get(Unknown Source)
at com.opentext.api.LLValue.toValue(Unknown Source)
at com.opentext.api.LLConnect.unMarshall(Unknown Source)
at com.opentext.api.LAPI_DOCUMENTS.CreateObjectEx(Unknown Source)
at fetchVersionClass.main(fetchVersionClass.java:57)
-----------------------------------------------------------
The following is my JAVA code:
import java.util.*;//for our date manip
import java.io.*;
import com.opentext.api.*; //import LAPI objects
public class addDocument {
private static String Server = "localhost"; //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[]) {
LLSession session;
LAPI_DOCUMENTS doc;
session = new LLSession(Server, Port, DFT, User, Pass);
doc = new LAPI_DOCUMENTS(session);
LAPI_ATTRIBUTES attr = new LAPI_ATTRIBUTES(session);
//Grab some value objects
LLValue entInfo = (new LLValue()).setAssocNotSet();
LLValue createInfo = (new LLValue()).setAssocNotSet();
LLValue objectInfo = (new LLValue()).setAssocNotSet();
LLValue versionInfo = (new LLValue()).setAssocNotSet();
int volumeID;
int objectID;
String fileType = "test_pdf_doc.pdf";
if (doc.AccessEnterpriseWS(entInfo) != 0) {
System.out.println("AccessEnterpriseWS Failed.");
return;
}
//Show that we got the volumeID and objectID for the EnterpriseWS
volumeID = entInfo.toInteger("VolumeID");
objectID = entInfo.toInteger("ID");
System.out.println("Volume" + volumeID + "ObjID" + objectID);
//hard-code the objectID as below 684436
objectID = 684436;
//Create document in enterpriseWS
//684436 is the node ID for folder named "Yo Yo" whihc is inside the node ID 2000
if (doc.CreateObjectEx(volumeID, objectID, doc.OBJECTTYPE,doc.DOCUMENTSUBTYPE, fileType, createInfo, objectInfo) != 0) {
System.out.println("CreateObjectEx Failed.");
return;
} else {
System.out.println("Document created successfully");
//Set objectID to objectID of the new document
}
// objectID = objectInfo.toInteger("ID");
//hard-code the objectID as below 684436
objectID = 684436;
//Now upload version to complete document creation
//if this file is not there io errors will happen
if (doc.CreateVersion(volumeID, objectID, "c:\\yoyo\\test_pdf_doc.pdf", versionInfo) != 0) {
System.out.println("CreateVersion Failed.");
return;
} else {
System.out.println("Version created successfully");
}
}
}
I deeply appreciate any helps/comments =)
many Thanks in advance,
After successful testing with the createObjectEx() and createVersion(), I tried to move one step ahead.
What I tried to do is to add a document to a specific folder; for e.g. Inside a root folder with (ID 2000 and volume ID -2000) has a folder with ID 684333.
I tried to add a document to that particular folder (ID = 684333), but I got an error message as follows:
Exception in thread "main" com.opentext.api.LLIllegalOperationException: get(name) not implemented for this datatype
at com.opentext.api.LLInstance.get(Unknown Source)
at com.opentext.api.LLValue.toValue(Unknown Source)
at com.opentext.api.LLConnect.unMarshall(Unknown Source)
at com.opentext.api.LAPI_DOCUMENTS.CreateObjectEx(Unknown Source)
at fetchVersionClass.main(fetchVersionClass.java:57)
-----------------------------------------------------------
The following is my JAVA code:
import java.util.*;//for our date manip
import java.io.*;
import com.opentext.api.*; //import LAPI objects
public class addDocument {
private static String Server = "localhost"; //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[]) {
LLSession session;
LAPI_DOCUMENTS doc;
session = new LLSession(Server, Port, DFT, User, Pass);
doc = new LAPI_DOCUMENTS(session);
LAPI_ATTRIBUTES attr = new LAPI_ATTRIBUTES(session);
//Grab some value objects
LLValue entInfo = (new LLValue()).setAssocNotSet();
LLValue createInfo = (new LLValue()).setAssocNotSet();
LLValue objectInfo = (new LLValue()).setAssocNotSet();
LLValue versionInfo = (new LLValue()).setAssocNotSet();
int volumeID;
int objectID;
String fileType = "test_pdf_doc.pdf";
if (doc.AccessEnterpriseWS(entInfo) != 0) {
System.out.println("AccessEnterpriseWS Failed.");
return;
}
//Show that we got the volumeID and objectID for the EnterpriseWS
volumeID = entInfo.toInteger("VolumeID");
objectID = entInfo.toInteger("ID");
System.out.println("Volume" + volumeID + "ObjID" + objectID);
//hard-code the objectID as below 684436
objectID = 684436;
//Create document in enterpriseWS
//684436 is the node ID for folder named "Yo Yo" whihc is inside the node ID 2000
if (doc.CreateObjectEx(volumeID, objectID, doc.OBJECTTYPE,doc.DOCUMENTSUBTYPE, fileType, createInfo, objectInfo) != 0) {
System.out.println("CreateObjectEx Failed.");
return;
} else {
System.out.println("Document created successfully");
//Set objectID to objectID of the new document
}
// objectID = objectInfo.toInteger("ID");
//hard-code the objectID as below 684436
objectID = 684436;
//Now upload version to complete document creation
//if this file is not there io errors will happen
if (doc.CreateVersion(volumeID, objectID, "c:\\yoyo\\test_pdf_doc.pdf", versionInfo) != 0) {
System.out.println("CreateVersion Failed.");
return;
} else {
System.out.println("Version created successfully");
}
}
}
I deeply appreciate any helps/comments =)
many Thanks in advance,