Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
import java.util.*;//for our date manip
import java.io.*;
import com.opentext.api.*; //import LAPI objects
public class ADWC
{
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 = "Admin"; //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();
//Category stuff
LLValue catID = (new LLValue()).setAssocNotSet();
LLValue catVersion = new LLValue();
LLValue attrValues = new LLValue().setList();
LLValue attrValPath = new LLValue();
LLValue categories = new LLValue().setList();
LLValue cRequest = new LLValue().setAssoc();
LLValue extData = new LLValue().setAssoc();
int volumeID;
int objectID;
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);
//Setup catID, hardcode the categories objectID
//19280 is the objID of my category called
//test and it is at version 1
//Populate the LLValue Object catID with that
catID.add("ID", 19280);
catID.add("Version", 0);
//Use the catID to fetch the category Version
if (doc.FetchCategoryVersion(catID, catVersion) != 0)
{
System.out.println("None of that category mate");
return;
}
//Add the values to attrValues to be in the attribute
//I have a text attribute called Test that will take
//clear text trash
//I guess if I had a date i would have to set it with a date
//I cannot get both the attributes updated for some reason
Date myDate=new Date();//get system date to update this para
attrValues.add(myDate);
if (attr.AttrSetValues(catVersion, "Test Date", attr.ATTR_DATAVALUES, attrValPath, attrValues) != 0)
{
System.out.println("AttrSetValues Failed.");
return;
}
// attrValues.add("This is a test");
// if (attr.AttrSetValues(catVersion, "Test", attr.ATTR_DATAVALUES, attrValPath, attrValues) != 0)
// {
// System.out.println("AttrSetValues Failed.");
// return;
// }
//Add category Version Assoc to categories List
categories.add( catVersion );
//Fill createInfo to spec (see documentation for the structure)
cRequest.add("Comment", "");
createInfo.add("request", cRequest);
createInfo.add("extendedData", extData);
createInfo.add("Categories", categories);
//Create document in enterpriseWS
if(doc.CreateObjectEx(volumeID, objectID, doc.OBJECTTYPE,
doc.DOCUMENTSUBTYPE, "PSMELLO's Docs", 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");
//Now upload version to complete document creation
//if this file is not there io errors will happen
if(doc.CreateVersion(volumeID, objectID, "c:\\development\\test.txt", versionInfo) != 0)
{
System.out.println("CreateVersion Failed.");
return;
}
else
{
System.out.println("Version created successfully");
}
}
}