I have map with key as string and value as list. and would like to present this in my admin page in broadleaf.
protected Map<String, List<SkuStoneDetails>> skuStoneDetails = new HashMap<String, List<SkuStoneDetails>>();
Previously i had map with key as string and value as object like below.
protected Map<String, SkuStoneDetails> skuStoneDetails = new HashMap<String,<SkuStoneDetails>();
For that i have given admin presentation like below.
@AdminPresentationMap(friendlyName = "Sku StoneDetails",
tab = ProductImpl.Presentation.Tab.Name.Stone_Details, tabOrder = ProductImpl.Presentation.Tab.Order.SkuStoneDetails,
//tab = Presentation.Tab.Name.Advanced, tabOrder = Presentation.Tab.Order.Advanced,
//group = ProductImpl.Presentation.Group.Name.RPPrice, groupOrder = ProductImpl.Presentation.Group.Order.RPPrice,
keyPropertyFriendlyName = "Sku StoneDetails Key",
deleteEntityUponRemove = true,
mediaField = "stoneType",
forceFreeFormKeys = true
)
I have no idea of how to do this with values as list in a map.Kindly help me out.
Having a Map with a List for the values is not something that we currently support in Broadleaf via @AdminPresentationMap. Feel free to open a new feature request at https://github.com/BroadleafCommerce/BroadleafCommerce/issues.
I think your best bet is to do it as you had it previously. Or, you could do something like this:
public class SkuStone {
@Column(name = "KEY")
@AdminPresentation(friendlyNmae = "Sku StoneDetails Key")
protected String key
@OneToMany
@AdminPresentationCollection(friendlyName = "Sku Stone Details")
protected List<SkuStoneDetails> details = new ArrayList<SkuStoneDetails>();
}
And then in place of protected Map<String, List<SkuStoneDetails>> skuStoneDetails = new HashMap<String, List<SkuStoneDetails>>();
@AdminPresentationCollection()
protected List<SkuStone> stones = new ArrayList<SkuStone>();