Search in sources :

Example 1 with AdminGroupPresentation

use of org.broadleafcommerce.common.presentation.AdminGroupPresentation in project BroadleafCommerce by BroadleafCommerce.

the class BasicEntityMetadataProvider method buildTabMetadata.

protected TabMetadata buildTabMetadata(AdminTabPresentation tabPresentation, Class<?> owningClass, Map<String, TabMetadata> metadata) {
    TabMetadata constructedTab = getTabFromMetadata(tabPresentation.name(), metadata);
    TabMetadata tab;
    Map<String, GroupMetadata> groupMetadataMap;
    if (constructedTab != null) {
        tab = constructedTab;
        groupMetadataMap = tab.getGroupMetadata();
    } else {
        tab = new TabMetadata();
        groupMetadataMap = new HashMap<>();
        tab.setTabName(tabPresentation.name());
        tab.setTabOrder(tabPresentation.order());
        tab.setOwningClass(owningClass.getCanonicalName());
    }
    for (AdminGroupPresentation groupPresentation : tabPresentation.groups()) {
        if (getGroupFromMetadata(groupPresentation.name(), metadata) == null) {
            groupMetadataMap.put(groupPresentation.name(), buildGroupMetadata(groupPresentation, owningClass, metadata));
        }
    }
    tab.setGroupMetadata(groupMetadataMap);
    return tab;
}
Also used : AdminGroupPresentation(org.broadleafcommerce.common.presentation.AdminGroupPresentation) GroupMetadata(org.broadleafcommerce.openadmin.dto.GroupMetadata) TabMetadata(org.broadleafcommerce.openadmin.dto.TabMetadata)

Aggregations

AdminGroupPresentation (org.broadleafcommerce.common.presentation.AdminGroupPresentation)1 GroupMetadata (org.broadleafcommerce.openadmin.dto.GroupMetadata)1 TabMetadata (org.broadleafcommerce.openadmin.dto.TabMetadata)1