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

How to get all Attributes of WTObject..?

RS_10128209
6-Contributor

How to get all Attributes of WTObject..?

I want to get all attribute Internal name which are related to WTPart or WTDocument

5 REPLIES 5

Take a look at this article

Marco

Thanks @Marco_Tosin 

Plz help me with any API or programatic solution

 

Hi @RS_10128209 

the API does not exists or I don't know it.

 

You need to write code to find TypeDefinition and then get attribute list.

 

Here is a code for you that can work. Just define soft type internal name and it returns what you need.

For me it works

 

try
{
String typeName = "wt.epm.EPMDocument";
QuerySpec queryspec;
queryspec = new QuerySpec();
int idLWCObject = queryspec.appendClassList(LWCTypeDefinition.class, true);
CompositeWhereExpression andCondition = new CompositeWhereExpression(LogicalOperator.AND);
andCondition.append(new SearchCondition(LWCTypeDefinition.class, LWCTypeDefinition.NAME, SearchCondition.LIKE, typeName), new int[]{idLWCObject});
queryspec.appendWhere(andCondition, new int[]{idLWCObject, idLWCObject});
queryspec.appendOrderBy(new OrderBy(new ClassAttribute(LWCTypeDefinition.class, LWCTypeDefinition.MODIFY_TIMESTAMP), false), new int[]{0});

QueryResult qrTypeDef = PersistenceHelper.manager.find((StatementSpec) queryspec);

if (qrTypeDef.hasMoreElements())
{
while (qrTypeDef.hasMoreElements())
{
Persistable persistables[] = (Persistable[]) qrTypeDef.nextElement();
if (persistables.length > 0)
{
LWCTypeDefinition lwcObj = (LWCTypeDefinition) persistables[0];
ArrayList typeList = LWCCommands.getTypeAttributes("OR:" + lwcObj.toString());
for (Object typeAtribs : typeList)
{
if (typeAtribs instanceof AttributeDefinitionReadView)
{
System.out.println(((AttributeDefinitionReadView)typeAtribs).getName());
}
}
}
}
} else
{
System.out.println("nothing");
}

} catch (Exception e)
{
// TODO: handle exception
e.printStackTrace();
}

 

PetrH

Hello @RS_10128209 

Go to the Type and Attribute Management and check all subtypes what you want.

There you can see all internal names.

HelesicPetr_0-1654688966658.png

 

PetrH

Thanks @HelesicPetr 

but I want solution programatically /using API

Announcements