How to set Object Property Policy ?
Object Property policy indicates the list of attributes to be loaded when object is fetched from Teamcenter
private static void setObjectPropertyPolicy()
{
List<String> lAttributes = new ArrayList<String>();
//lAttributes.add( "object_name" );
lAttributes.add( "object_string" );// it will load only this attribute so it saves time and memory
//Eg: if we try to get object_name it will return error
// bcz way set object_string in setObjectPropertyPolicy to load
String strTcSource = "RevisionRule";
try
{
String[] attributeArray = lAttributes.toArray();
ObjectPropertyPolicy objectPropertyPolicy = new ObjectPropertyPolicy();
PolicyType policyType =
new PolicyType( strTcSource, attributeArray); //strTcSource-> Business object name //attributeArray->Array of attributes to be loaded to save time
objectPropertyPolicy.addType( policyType );
SessionService sessionService = SessionService.getService( connection );
sessionService.setObjectPropertyPolicy( objectPropertyPolicy );
}
catch (Exception e)
{
e.printStackTrace();
}
}
Explanation : Important API
ObjectPropertyPolicy objectPropertyPolicy = new ObjectPropertyPolicy();
PolicyType policyType = new PolicyType( strTcSource, attributeArray); objectPropertyPolicy.addType( policyType );
sessionService.setObjectPropertyPolicy( objectPropertyPolicy );
本文详细介绍了如何在Teamcenter中设置对象属性策略,通过指定加载的属性列表,可以有效节省时间和内存资源。文章提供了具体的Java代码示例,展示了如何创建和应用ObjectPropertyPolicy。
435

被折叠的 条评论
为什么被折叠?



