// Get innovator ref
Innovator inn = this.getInnovator();
// retrieve the Poly-itemtype
Item polyItemType = inn.getItemById("ItemType", this.getProperty("source_id"));
// retrieve the added property name
String newPropertyName = this.getProperty("name");
// test if the itemtype is a polyitemtype
if (polyItemType.getProperty("implementation_type") == "polymorphic"){
// get polysources
polyItemType.fetchRelationships("Morphae");
Item Morphaes = polyItemType.getRelationships("Morphae");
// for each source - check if the property exists
for (int i = 0; i < Morphaes.getItemCount(); i++)
{
// get the morphae
Item Morphae = Morphaes.getItemByIndex(i).getRelatedItem();
Morphae.fetchRelationships("Property");
// test if it has the added property (check just by name)
if (Morphae.getRelationships("Property").getItemsByXPath("//Item[name='"+newPropertyName+"']").getItemCount() < 1){
// Clone the property
Item distributedProperty = this.clone(false);
// Add the Property
distributedProperty.setProperty("source_id",Morphae.getID());
// Perform the query.
Item results = distributedProperty.apply();
}
}
}
return this;
Copyright © 2025 Aras. All rights reserved.