The code below can add the document but im not able to assign the attributes for the document in order to be able to retrieve it in search..
public class TestAddDocument
{
private static String Server = "localhost";
private static int Port = 2099;
private static String DFT = "";
private static String User = "Admin";
private static String Pass = "cafadmin";
public static void main (String [] args)
{
try
{
//variables
LLSession session;
LAPI_DOCUMENTS doc;
LLValue entInfo= new LLValue();
LLValue objInfo = new LLValue();
LLValue verInfo = new LLValue();
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);
}
objID = 41613;
objName = "New Document";
FilePath = "C:\\temp\\AddDocument.java";
if (doc.AddDocument(volumeID, objID, objName, FilePath, objInfo, verInfo) == 0)
{
System.out.println("This version's name is"+verInfo.toString("Name"));
System.out.println("This version's created at "+objInfo.toDate("CreateDate"));
System.out.println("This objects id is"+verInfo.toInteger("NodeID"));
System.out.println("Document Added Successfully");
}
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());
}
}
catch (Throwable e)
{
System.err.println(e.getMessage() );
e.printStackTrace (System.err);
}
} //main ends
} //class ends