cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Is it possible to retrieve Classification nodes with hierarchy and attributes in an report through an API like info*engine?

aklingvall
1-Visitor

Is it possible to retrieve Classification nodes with hierarchy and attributes in an report through an API like info*engine?

Is it possible to retrieve Classification nodes/tree with hierarchy and attributes in an report through an API like info*engine?

1 REPLY 1

1. You can fetch all the classification nodes in QueryBuilder using table LWCStructEnumAtttemplate

2. The Node Hierarchy can be retrieved using below code snippet:

buf = getNodeHierarchy(<Internal name of node>,

     CsmConstants.NAMESPACE, new Locale("en"));

public static StringBuffer getNodeHierarchy(String paramString1, String paramString2, Locale paramLocale)

  throws WTException

 

StringBuffer buf = new StringBuffer();

String delimiter = "/";

 

TypeDefinitionReadView localTypeDefinitionReadView1 = TypeDefinitionServiceHelper.service.getTypeDefView(AttributeTemplateFlavor.LWCSTRUCT, paramString2, paramString1);

 

  buf.append(paramString1);

  buf.append(delimiter);

 

  if (localTypeDefinitionReadView1 != null)

 

  ObjectIdentifier localObjectIdentifier = localTypeDefinitionReadView1.getParentId();

  while (localObjectIdentifier != null) {

TypeDefinitionReadView localTypeDefinitionReadView2 = TypeDefinitionServiceHelper.service.getTypeDefView(AttributeTemplateFlavor.LWCSTRUCT, Long.valueOf(localObjectIdentifier.getId()));

  buf.append(localTypeDefinitionReadView2.getName());

  buf.append(delimiter);

 

  localObjectIdentifier = localTypeDefinitionReadView2.getParentId();

 

  // return localStringBuilder.toString();

  buf = removeSlash(buf);

return buf;

}

 

public static StringBuffer removeSlash(StringBuffer buf) {

String str = buf.toString();

if (str != null && str.length() > 0

&& str.charAt(str.length() - 1) == '/') {

str = str.substring(0, str.length() - 1);

 

final StringBuffer bufrt = new StringBuffer();

return bufrt.append(str);

}

3. Classification attributes for a node can be fetched through :

public static List<String> getPartsLinkIBA(String node)

throws WTException {

 

List<String> l1 = new ArrayList<String>();

final TypeDefinitionReadView localTypeDefinitionReadView = TypeDefinitionServiceHelper.service

.getTypeDefView(AttributeTemplateFlavor.LWCSTRUCT,

CsmConstants.NAMESPACE, node);

 

if (localTypeDefinitionReadView != null) {

final Collection<AttributeDefinitionReadView> x = localTypeDefinitionReadView

final Iterator<AttributeDefinitionReadView> it = x.iterator();

// getting all the attributes internal name

while (it.hasNext()) {

 

final Object object = (Object) it.next();

final AttributeDefinitionReadView adrv = (AttributeDefinitionReadView) object;

l1.add(adrv.getName());

 

   /*

 

return l1;

}

Announcements


Top Tags