How to set Object Property Policy ?
Object Property policy indicates the list of attributes to be loaded when object is fetched from Teamcenter
ObjectPropertyPolicy objectPropertyPolicy = new ObjectPropertyPolicy();
PolicyType policyType = new PolicyType( strTcSource, attributeArray); objectPropertyPolicy.addType( policyType );
sessionService.setObjectPropertyPolicy( objectPropertyPolicy );
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 );
Thanks for taking time to share this post. It is really useful. Continue sharing more like this.
ReplyDeleteRegards,
Python Training in Chennai
I am happy that its helping you.I will continue sharing more article
ReplyDelete