Source:
public void execute(String[] args, Console console) { if (args.length > 0) { final String subCommand = args[0]; switch (subCommand) { case SUBCMD_APPROVE: if (args.length > 1) { boolean fullSetup = false; if (args.length > 2) { fullSetup = Boolean.parseBoolean(args[2]); } if (thingSetupManager != null) { try { ThingUID thingUID = new ThingUID(args[1]); List<DiscoveryResult> results = inbox.get(new InboxFilterCriteria(thingUID, null)); if (results.isEmpty()) { console.println("No matching inbox entry could be found."); return; } DiscoveryResult result = results.get(0); Thing thing = inbox.approve(thingUID, null); if (fullSetup) { thingSetupManager.addItems(null, new ArrayList<String>(), thing, result.getThingTypeUID()); } } catch (Exception e) { console.println(e.getMessage()); } } else { console.println( "Cannot approve thing as managed thing provider or setup manager is missing."); } } else { console.println( "Specify thing id to approve: inbox approve <thingUID> <fullSetup - true|false>"); } break; case SUBCMD_IGNORE: if (args.length > 1) { try { ThingUID thingUID = new ThingUID(args[1]); PersistentInbox persistentInbox = (PersistentInbox) inbox; persistentInbox.setFlag(thingUID, DiscoveryResultFlag.IGNORED); } catch (IllegalArgumentException e) { console.println("'" + args[1] + "' is no valid thing UID."); } } else { console.println("Cannot approve thing as managed thing provider is missing."); } break; case SUBCMD_LIST_IGNORED: printInboxEntries(console, inbox.get(new InboxFilterCriteria(DiscoveryResultFlag.IGNORED))); break; case SUBCMD_CLEAR: clearInboxEntries(console, inbox.get(new InboxFilterCriteria(DiscoveryResultFlag.NEW))); break; default: break; } } else { printInboxEntries(console, inbox.get(new InboxFilterCriteria(DiscoveryResultFlag.NEW))); } }

Target:
public void execute(String[] args, Console console) { if (args.length > 0) { final String subCommand = args[0]; switch (subCommand) { case SUBCMD_APPROVE: if (args.length > 1) { boolean fullSetup = false; if (args.length > 2) { fullSetup = Boolean.parseBoolean(args[2]); } if (thingSetupManager != null) { try { ThingUID thingUID = new ThingUID(args[1]); List<DiscoveryResult> results = inbox.get(new InboxFilterCriteria(thingUID, null)); if (results.isEmpty()) { console.println("No matching inbox entry could be found."); return; } DiscoveryResult result = results.get(0); Thing thing = inbox.approve(thingUID, null); if (fullSetup) { thingSetupManager.createGroupItems(null, new ArrayList<String>(), thing, result.getThingTypeUID()); } } catch (Exception e) { console.println(e.getMessage()); } } else { console.println( "Cannot approve thing as setup manager is missing."); } } else { console.println( "Specify thing id to approve: inbox approve <thingUID> <fullSetup - true|false>"); } break; case SUBCMD_IGNORE: if (args.length > 1) { try { ThingUID thingUID = new ThingUID(args[1]); PersistentInbox persistentInbox = (PersistentInbox) inbox; persistentInbox.setFlag(thingUID, DiscoveryResultFlag.IGNORED); } catch (IllegalArgumentException e) { console.println("'" + args[1] + "' is no valid thing UID."); } } else { console.println("Cannot approve thing as managed thing provider is missing."); } break; case SUBCMD_LIST_IGNORED: printInboxEntries(console, inbox.get(new InboxFilterCriteria(DiscoveryResultFlag.IGNORED))); break; case SUBCMD_CLEAR: clearInboxEntries(console, inbox.get(new InboxFilterCriteria(DiscoveryResultFlag.NEW))); break; default: break; } } else { printInboxEntries(console, inbox.get(new InboxFilterCriteria(DiscoveryResultFlag.NEW))); } }