@Override public Map<String, List<String>> getMapFromTableContent(String tableId) { TabularResultModel table = result.getTableSection(tableId); if (table == null) { return EMPTY_TABLE_MAP; } return table.getContent(); }
/** * Helper method to create an {@code InfoResultModel} named "info". */ public static ResultModel createInfo(String message) { ResultModel result = new ResultModel(); result.addInfo(INFO_SECTION).addLine(message); result.setStatus(Result.Status.OK); return result; }
@Override public Map<String, String> getMapFromSection(String sectionID) { return result.getDataSection(sectionID).getContent(); }
/** * Helper method to create an {@code TabularResultModel} named "member-status". Typically used * to tabulate the status from calls to a number of members. */ public static ResultModel createMemberStatusResult(List<CliFunctionResult> functionResults, String header, String footer, boolean ignoreIgnorable, boolean ignorePartialFailure) { ResultModel result = new ResultModel(); TabularResultModel tabularResultModel = result.addTableAndSetStatus(MEMBER_STATUS_SECTION, functionResults, ignoreIgnorable, ignorePartialFailure); tabularResultModel.setHeader(header); tabularResultModel.setFooter(footer); return result; }
private void addTableRow(TabularResultModel table, String property, String value) { table.accumulate("Property", property); table.accumulate("Value", value != null ? value : ""); } }
/** * Helper method to create an {@code InfoResultModel} named "info". This method will also set * the status to ERROR. */ public static ResultModel createError(String message) { ResultModel result = createInfo(message); result.setStatus(Result.Status.ERROR); return result; }
@Override public Status getStatus() { return result.getStatus(); }
/** * Overloaded method to create an {@code InfoResultModel} section called "info". */ public InfoResultModel addInfo() { return addInfo(INFO_SECTION); }
public static ResultModel createMemberStatusResult(List<CliFunctionResult> functionResults, boolean ignoreIgnorable, boolean ignorePartialFailure) { return createMemberStatusResult(functionResults, null, null, ignoreIgnorable, ignorePartialFailure); }
@Override public String toString() { return toJson(); }
@Override public ResultModel postExecution(GfshParseResult parseResult, ResultModel commandResult, Path tempFile) throws Exception { commandResult.saveFileTo(saveDirFile); return commandResult; } }
/** * Save the file to the current working directory * * @return the message you would like to return to the user. */ public String saveFile() throws IOException { return saveFile(null); }
@Override public String getFooter() { return result.getFooter(); }
@Override public String getHeader() { return result.getHeader(); }
@Override public List<String> getColumnFromTableContent(String column, String tableId) { TabularResultModel table = result.getTableSection(tableId); if (table == null) { return EMPTY_LIST; } return table.getContent().get(column); }
public void addMemberStatusResultRow(String member, String result, String message) { if (member != null) { accumulate("Member", member); } accumulate("Result", result); accumulate("Message", message); }
public static ResultModel createMemberStatusResult(List<CliFunctionResult> functionResults, boolean ignoreIgnorable) { return createMemberStatusResult(functionResults, null, null, ignoreIgnorable, true); }
@Override public List<String> getTableColumnValues(String sectionId, String columnName) { return result.getTableSection(sectionId).getContent().get(columnName); }
private void writeToBackupDiskStoreTable(TabularResultModel table, String memberId, String UUID, String host, String directory) { table.accumulate(CliStrings.BACKUP_DISK_STORE_MSG_MEMBER, memberId); table.accumulate(CliStrings.BACKUP_DISK_STORE_MSG_UUID, UUID); table.accumulate(CliStrings.BACKUP_DISK_STORE_MSG_DIRECTORY, directory); table.accumulate(CliStrings.BACKUP_DISK_STORE_MSG_HOST, host); } }
private void addTableRow(TabularResultModel table, String property, String value) { table.accumulate("Property", property); table.accumulate("Value", value != null ? value : ""); }