Tuesday, April 5, 2011

Caching Data in the Livelink Database


You can create a database cache when you want to store data in the Livelink database temporarily. For example, if a Livelink user specifies values that you want to reuse, you can create a cache in which to hold them. The cache that you create is a persistent cache, meaning that it can store data between Livelink sessions. However, caches normally have specify a time-out interval, after which Livelink clears the cache values and frees the space.
You can cache a value only if the value can be converted to a String type and back using the Str.ValueToString() and Str.StringToValue() built-in methods. For example, you cannot cache a RecArray because it cannot be converted to a String type.

You use the $$LLIAPI:LLIApi Root:CacheUtil  object's methods to handle cache. There are four basic methods to handle the cache:


  • New()
  • load()
  • update()
  • delete()


To create New Cache: you can use the following syntax:
$LLIAPI.CacheUtil.New(  prgCtx, CacheAssoc, time )



prgCtx:  User Program context  ( required )
CacheAssoc: Value you want to store into cache ( required, but value can be blank or Undefined )
time: time-out interval, after which Livelink clears the cache values and frees the space. ( optional, default it takes from openText.ini  > [general] section > CacheKeepMinutes = time- interval.  )

It will return an assoc, containing ok=true ( if sucess ) and cacheID, which you can use for future references to the same cache.

To load cache Value: To load the cache you can use following syntax:
$LLIApi.CacheUtil.Load( prgCtx, CacheID ) 

To update Cache Value:  To update the cache value, you can use following syntax:
$LLIAPI.CacheUtil.Update( prgCtx, CacheID, cacheAssoc )

To delete cache: Using following syntax, you can delete cache and free the resources:
$LLIAPI.CacheUtil.Delete( prgCtx, CacheID   )



Monday, April 4, 2011

How to add new feature at run time

Use following code to add feature at run time.

   if !OS.IsFeature( this, 'fdata' )     //to check if feature is already there
         OS.AddFeature( this, 'fdata' )   //to add feature at run time
   end

This will not add the feature for permanently, it will add just for this instance.

Import / Export Livelink Objext in XML format


Use the following url to export objects from Livelink:

<Livelink CGI URL>?func=ll&objId=<objectid>&objAction=XMLExport&scope=sub&attributeinfo&nodeinfo&versioninfo=all&content=base64

To import 
it use the following url:

<Livelink CGI URL>?func=admin.xmlImport&filename=<path of the file>&objid=<parent container objid>