Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Content Management (Extended ECM)
API, SDK, REST and Web Services
Categories in Livelink 9
Robert_Aylsworth_(raylswor_(Delete)_2404642)
How I can retrieve the category-object from a document with the API for 9.0.0.1 ?
Find more posts tagged with
Comments
Mark_Wagner_(COSSOF01Admin_(Delete)_2345798)
Hi Robert, here are the calls I use to get and set attributes: LAPI_DOCUMENTS documents = new LAPI_DOCUMENTS( session );LAPI_ATTRIBUTES attributes = new LAPI_ATTRIBUTES( session );LLValue objID = ( new LLValue() ).setAssocNotSet();LLValue cats = new LLValue();objID.add("ID",33333);// list all cats associated with the object 33333:documents.ListObjectCategoryIDs(objID,cats);// get the first one:LLValue catID = cats.toValue(1);String catname = catID.toString("DisplayName");LLValue catVersion = ( new LLValue() ).setAssocNotSet();documents.GetObjectAttributesEx( objID, catID, catVersion );// list attribute names for this category:LLValue attrnames = ( new LLValue() ).setAssocNotSet();attributes.AttrListNames( catVersion, null, attrnames );Hope it helps.Sergey
Debbie_Straub
Hi Sergey,Could you tell me what are the next instructions to get and set attributes. I dont know how to extract the information from "attrnames".ThanksRachel
Mahmoud_Dayeh_(ecead_mad_(Delete)_2045359)
Hi I am using GetObjectAttributesEx( objID, catID, catVersion );for getting the catVersion which is working finewhile i query for catVersion.size() it gives me 3My problem is setting of values to an attributeby using AttrSetValues.I do it in the following way:-LLValue attrValues= new LLValue().setList();//attrValues.setString("700");//here Amount is the attribute nameString amount="Amount";attrValues.add("500");attributes.AttrSetValues( catVersion, amount, LAPI_ATTRIBUTES.ATTR_DATAVALUES,new LLValue(), attrValues);I then use documents.SetObjectAttributesEx(catID, catVersion );when I do this and add the documents the document getsadded but the value for the attribute Amount does not changeand it is the same value as the folder in which i put the documentPlease help me out .Qhat error am I making. This is quite urgent.thanx
x-opconuser3_-_(deleted)
Here is a code fragment of how I get NATIVE JAVA TYPES out of the JAVA LAPI.I have yet to do a set of attributes, but I only imagine it is also as straightforward ;-). public Hashtable getCategories(int volId, int id, int verNum) throws LLException { //our return value Hashtable retVal = new Hashtable(); try { LLValue sourceObjectId = new LLValue().setAssocNotSet(); sourceObjectId.add("ID",id); LLValue categoryIds = new LLValue(); int i = this.getLapiDocuments().ListObjectCategoryIDs(sourceObjectId,categoryIds); if (i != 0) { throw new LLException(i,this.getSession()); } else { Hashtable category = new Hashtable(); LLValueEnumeration categoryEnumeration = categoryIds.enumerateValues(); while (categoryEnumeration.hasMoreElements()) { LLValue categoryId = categoryEnumeration.nextValue(); String categoryName = categoryId.toString("DisplayName");//System.out.println("categoryName="+categoryName); LLValue categoryVersion = new LLValue().setAssocNotSet(); i = this.getLapiDocuments().GetObjectAttributesEx(sourceObjectId,categoryId,categoryVersion); if (i != 0) { throw new LLException(i,this.getSession()); } else { LLValue attributeNames = new LLValue().setAssocNotSet(); LLValue attributeValues = new LLValue().setAssocNotSet(); i = this.getLapiAttributes().AttrListNames(categoryVersion,null,attributeNames); if (i != 0) { throw new LLException(i,this.getSession()); } else { LLValueEnumeration names = attributeNames.enumerateValues(); while (names.hasMoreElements()) { LLValue name = (LLValue)names.nextElement();//System.out.print(name.toString()+"="); i = this.getLapiAttributes().AttrGetValues(categoryVersion,name.toString(),LAPI_ATTRIBUTES.ATTR_DATAVALUES,null,attributeValues); if (i != 0) { throw new LLException(i,this.getSession()); } else { LLValueEnumeration values = attributeValues.enumerateValues(); while (values.hasMoreElements()) { LLValue value = (LLValue)values.nextElement(); String s = ""; //you have to parse here for the LLValue type and convert it to a Java Type if (value.isString()) { s = value.toString(); } else if (value.isDate()) { s = value.toDate().toString(); }//System.out.println(s); category.put(name.toString(),s); } retVal.put(categoryName,category); } } } } } } } catch (Exception e) { e.printStackTrace(); throw new LLException(e.getMessage()); } return retVal; }
x-opconuser3_-_(deleted)
Hoi Sergey,Is it meant to do a cats.toValue(1) for the first LLValue in the LLValue of cats? Does this mean that the folks at Livelink have implemented their LLValue objects with a starting id of 1 (That would make as much sense as the rest of the LAPI)?Look at my later post that uses an LLValueEnumeration to iterate through the Categories rather than using a numerical reference.Ciao,Jon K