package no.kantega.publishing.api.ui;

import java.util.Collections;
import java.util.List;

/**
 *
 */
public class UIContributionAdapter implements UIContribution {

    /**
     * {@inheritDoc}
     */
    public List<MenuItem> getRootMenuItems() {
        return Collections.emptyList();
    }

    /**
     * {@inheritDoc}
     */
    public List<MenuItem> getAdminMenuItems() {
        return Collections.emptyList();
    }
}

@@ -32,16 +32,108 @@
 pi.ui;%0A%0A
+import org.springframework.beans.factory.annotation.Autowired;%0A%0Aimport java.util.ArrayList;%0A
 import j
@@ -154,16 +154,16 @@
 ctions;%0A
-
 import j
@@ -176,16 +176,38 @@
 il.List;
+%0Aimport java.util.Map;
 %0A%0A/**%0A *
@@ -275,16 +275,145 @@
 tion %7B%0A%0A
+    private final List%3CMenuItem%3E adminMenuItems = new ArrayList%3CMenuItem%3E();%0A%0A    @Autowired%0A    private UIServices uiServices;%0A%0A
     /**%0A
@@ -639,32 +639,835 @@
 urn 
-Collections.emptyList();
+adminMenuItems;%0A    %7D%0A%0A    public void setAdminMenuLinkMap(Map%3CString, Object%3E adminMenuLinks) %7B%0A        MenuItem item = uiServices.createMenu();%0A%0A        processMenuItem(item, adminMenuLinks);%0A        adminMenuItems.add(item);%0A    %7D%0A%0A    private void processMenuItem(MenuItem item, Map%3CString, Object%3E map) %7B%0A        for(String key : map.keySet()) %7B%0A            Object dest = map.get(key);%0A            if(dest instanceof String) %7B%0A                item.addLink(key, (String)dest);%0A            %7D else if (dest instanceof Map) %7B%0A                MenuItem subitem = item.addChildMenuItem(key);%0A                processMenuItem(subitem, (Map%3CString, Object%3E) dest);%0A            %7D else %7B%0A                throw new IllegalArgumentException(%22Map key %22 +key +%22 maps to illegal type %22 + dest.getClass().getName());%0A            %7D%0A        %7D
 %0A   

Add support for declaring admin menus directly in spring.xml without creating a class