Added output of appId to the flow list command. Fixed defect in CoreManager - we forgot to put registered ids in our map.
diff --git a/cli/src/main/java/org/onlab/onos/cli/net/FlowsListCommand.java b/cli/src/main/java/org/onlab/onos/cli/net/FlowsListCommand.java
index 902b27b..28309c5 100644
--- a/cli/src/main/java/org/onlab/onos/cli/net/FlowsListCommand.java
+++ b/cli/src/main/java/org/onlab/onos/cli/net/FlowsListCommand.java
@@ -1,14 +1,9 @@
 package org.onlab.onos.cli.net;
 
-import static com.google.common.collect.Lists.newArrayList;
-import static org.onlab.onos.cli.net.DevicesListCommand.getSortedDevices;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
+import com.google.common.collect.Maps;
 import org.apache.karaf.shell.commands.Argument;
 import org.apache.karaf.shell.commands.Command;
+import org.onlab.onos.CoreService;
 import org.onlab.onos.cli.AbstractShellCommand;
 import org.onlab.onos.cli.Comparators;
 import org.onlab.onos.net.Device;
@@ -18,37 +13,43 @@
 import org.onlab.onos.net.flow.FlowEntry.FlowEntryState;
 import org.onlab.onos.net.flow.FlowRuleService;
 
-import com.google.common.collect.Maps;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+import static com.google.common.collect.Lists.newArrayList;
+import static org.onlab.onos.cli.net.DevicesListCommand.getSortedDevices;
 
 /**
  * Lists all currently-known hosts.
  */
 @Command(scope = "onos", name = "flows",
-description = "Lists all currently-known flows.")
+         description = "Lists all currently-known flows.")
 public class FlowsListCommand extends AbstractShellCommand {
 
     public static final String ANY = "any";
 
     private static final String FMT =
-            "   id=%s, state=%s, bytes=%s, packets=%s, duration=%s, priority=%s";
+            "   id=%s, state=%s, bytes=%s, packets=%s, duration=%s, priority=%s, appId=%s";
     private static final String TFMT = "      treatment=%s";
     private static final String SFMT = "      selector=%s";
 
     @Argument(index = 1, name = "uri", description = "Device ID",
-            required = false, multiValued = false)
+              required = false, multiValued = false)
     String uri = null;
 
     @Argument(index = 0, name = "state", description = "Flow Rule state",
-            required = false, multiValued = false)
+              required = false, multiValued = false)
     String state = null;
 
     @Override
     protected void execute() {
+        CoreService coreService = get(CoreService.class);
         DeviceService deviceService = get(DeviceService.class);
         FlowRuleService service = get(FlowRuleService.class);
         Map<Device, List<FlowEntry>> flows = getSortedFlows(deviceService, service);
         for (Device d : getSortedDevices(deviceService)) {
-            printFlows(d, flows.get(d));
+            printFlows(d, flows.get(d), coreService);
         }
     }
 
@@ -67,7 +68,7 @@
             s = FlowEntryState.valueOf(state.toUpperCase());
         }
         Iterable<Device> devices = uri == null ? deviceService.getDevices() :
-            Collections.singletonList(deviceService.getDevice(DeviceId.deviceId(uri)));
+                Collections.singletonList(deviceService.getDevice(DeviceId.deviceId(uri)));
         for (Device d : devices) {
             if (s == null) {
                 rules = newArrayList(service.getFlowEntries(d.id()));
@@ -87,16 +88,19 @@
 
     /**
      * Prints flows.
-     * @param d the device
+     *
+     * @param d     the device
      * @param flows the set of flows for that device.
      */
-    protected void printFlows(Device d, List<FlowEntry> flows) {
+    protected void printFlows(Device d, List<FlowEntry> flows,
+                              CoreService coreService) {
         boolean empty = flows == null || flows.isEmpty();
         print("deviceId=%s, flowRuleCount=%d", d.id(), empty ? 0 : flows.size());
         if (!empty) {
             for (FlowEntry f : flows) {
-                print(FMT, Long.toHexString(f.id().value()), f.state(), f.bytes(),
-                      f.packets(), f.life(), f.priority());
+                print(FMT, Long.toHexString(f.id().value()), f.state(),
+                      f.bytes(), f.packets(), f.life(), f.priority(),
+                      coreService.getAppId(f.appId()).name());
                 print(SFMT, f.selector().criteria());
                 print(TFMT, f.treatment().instructions());
             }