@Override public Promise<CommandImpl> createCommand( String goalId, String typeId, @Nullable String name, @Nullable String commandLine, Map<String, String> attributes, ApplicableContext context) { final Map<String, String> attr = new HashMap<>(attributes); attr.put(COMMAND_GOAL_ATTRIBUTE_NAME, goalId); final Optional<CommandType> commandType = commandTypeRegistry.getCommandTypeById(typeId); commandType.ifPresent( type -> attr.put( COMMAND_PREVIEW_URL_ATTRIBUTE_NAME, commandType.get().getPreviewUrlTemplate())); final String commandLineTemplate = commandType.map(CommandType::getCommandLineTemplate).orElse(""); return createCommand( new CommandImpl( commandNameGenerator.generate(typeId, name), commandLine != null ? commandLine : commandLineTemplate, typeId, attr, context)); }