I have a transaction placeorder which takes list of supplier as input and creates an order.
transaction PlaceOrder
{
o String orderId
--> Consumer consumer
o OrderDetails orderDetails
--> Supplier[] supplier
--> Commodity commodity
}
The order is an asset having list of suppliers
asset Order identified by orderId {
o String orderId
o String orderName optional
o OrderState state
o OrderDetails orderDetails
--> SupplyOrder[] supplyOrder
--> Trader owner
--> Commodity commodity
--> Consumer consumer
--> Supplier[] supplier
o Rating rating optional
}
This order is created when placeOrder transaction is called and that should create relationship between the list of suppliers.
For a single supplier I was using
order.supplier = factory.newRelationship(namespace, 'Supplier', placedOrder.supplier.getIdentifier());
but the above code is failing for list of suppliers.