/** * @param line message to add * @return this InfoResultData */ public InfoResultData addLine(String line) { try { contentObject.accumulate(RESULT_CONTENT_MESSAGE, line); } catch (GfJsonException e) { throw new ResultDataException(e.getMessage()); } return this; }
/** * * @throws ResultDataException If the value is non-finite number or if the key is null. */ public AbstractResultData setFooter(String footerText) { try { gfJsonObject.put(RESULT_FOOTER, footerText); } catch (GfJsonException e) { throw new ResultDataException(e.getMessage()); } return this; }
/** * * @return this ErrorResultData * @throws ResultDataException If the errorCode value is a non-finite number or invalid. */ public ErrorResultData setErrorCode(int errorCode) { try { contentObject.putOpt(ERROR_CODE, errorCode); } catch (GfJsonException e) { throw new ResultDataException(e.getMessage()); } return this; }
public SectionResultData setHeader(String headerText) { try { sectionGfJsonObject.put(RESULT_HEADER, headerText); } catch (GfJsonException e) { throw new ResultDataException(e.getMessage()); } return this; }
public SectionResultData setFooter(String footerText) { try { sectionGfJsonObject.put(RESULT_FOOTER, footerText); } catch (GfJsonException e) { throw new ResultDataException(e.getMessage()); } return this; }
public SectionResultData addData(String name, Object value) { try { sectionGfJsonObject.put(name, value); } catch (GfJsonException e) { throw new ResultDataException(e.getMessage()); } return this; }
public TabularResultData accumulate(String accumulateFor, Object value) { try { contentObject.accumulate(accumulateFor, value); } catch (GfJsonException e) { throw new ResultDataException(e.getMessage()); } return this; }
public SectionResultData addSeparator(char buildSeparatorFrom) { try { sectionGfJsonObject.put(SEPARATOR, buildSeparatorFrom); } catch (GfJsonException e) { throw new ResultDataException(e.getMessage()); } return this; }
/** * * @return this ResultData * @throws ResultDataException If the value is non-finite number or if the key is null. */ public AbstractResultData setHeader(String headerText) { try { gfJsonObject.put(RESULT_HEADER, headerText); } catch (GfJsonException e) { throw new ResultDataException(e.getMessage()); } return this; }
public List<String> retrieveAllValues(String columnName) { List<String> values = new ArrayList<>(); try { GfJsonArray jsonArray = contentObject.getJSONArray(columnName); int size = jsonArray.size(); for (int i = 0; i < size; i++) { values.add(String.valueOf(jsonArray.get(i))); } } catch (GfJsonException e) { throw new ResultDataException(e.getMessage()); } return values; } }
public static String[] getStringArray(GfJsonObject jsonObject, String byName) { String[] stringArray = null; try { GfJsonArray jsonArray = jsonObject.getJSONArray(byName); stringArray = GfJsonArray.toStringArray(jsonArray); } catch (GfJsonException e) { throw new ResultDataException(e.getMessage()); } return stringArray; }
public static byte[] getByteArray(GfJsonObject jsonObject, String byName) { byte[] byteArray = null; try { GfJsonArray jsonArray = jsonObject.getJSONArray(byName); byteArray = GfJsonArray.toByteArray(jsonArray); } catch (GfJsonException e) { throw new ResultDataException(e.getMessage()); } return byteArray; }
public SectionResultData addSection(SectionResultData otherSection) { String keyToAccess = String.valueOf(subsectionCount); GfJsonObject sectionData = otherSection.getSectionGfJsonObject(); try { contentObject.putAsJSONObject(SectionResultData.generateSectionKey(keyToAccess), sectionData); } catch (GfJsonException e) { throw new ResultDataException(e.getMessage()); } subsectionCount++; return new SectionResultData(sectionData); }
public TabularResultData addTable(String keyToAccess) { TabularResultData tabularResultData = ResultBuilder.createTabularResultData(); GfJsonObject tableData = tabularResultData.getGfJsonObject(); try { sectionGfJsonObject.putAsJSONObject(generateTableKey(keyToAccess), tableData); } catch (GfJsonException e) { throw new ResultDataException(e.getMessage()); } tablesCount++; return tabularResultData; }
public SectionResultData addSection(String keyToAccess) { GfJsonObject sectionData = new GfJsonObject(); try { contentObject.putAsJSONObject(SectionResultData.generateSectionKey(keyToAccess), sectionData); } catch (GfJsonException e) { throw new ResultDataException(e.getMessage()); } subsectionCount++; return new SectionResultData(sectionData); }
private ResultData addAsFile(String fileName, byte[] data, int fileType, String message) { if (fileType != FILE_TYPE_BINARY && fileType != FILE_TYPE_TEXT) { throw new IllegalArgumentException("Unsupported file type is specified."); } GfJsonObject sectionData = new GfJsonObject(); try { GfJsonArray fileDataArray = contentObject.getJSONArray(BYTE_DATA_ACCESSOR); if (fileDataArray == null) { fileDataArray = new GfJsonArray(); contentObject.put(BYTE_DATA_ACCESSOR, fileDataArray); } fileDataArray.put(sectionData); sectionData.put(FILE_NAME_FIELD, fileName); sectionData.put(FILE_TYPE_FIELD, fileType); sectionData.put(FILE_MESSAGE, message); DeflaterInflaterData deflaterInflaterData = CliUtil.compressBytes(data); sectionData.put(FILE_DATA_FIELD, Base64.getEncoder().encodeToString(deflaterInflaterData.getData())); sectionData.put(DATA_LENGTH_FIELD, deflaterInflaterData.getDataLength()); } catch (GfJsonException e) { throw new ResultDataException(e.getMessage()); } return this; }
missingColocatedRegions.add((ColocatedRegionDetails) detail); } else { throw new ResultDataException("Unknown type of PersistentRecoveryFailures result");