use of com.orientechnologies.orient.core.serialization.serializer.record.string.ORecordSerializerStringAbstract in project orientdb by orientechnologies.
the class OConsoleDatabaseApp method exportRecord.
@ConsoleCommand(description = "Export the current record in the requested format", onlineHelp = "Console-Command-Export-Record")
public void exportRecord(@ConsoleParameter(name = "format", description = "Format, such as 'json'") final String iFormat, @ConsoleParameter(name = "options", description = "Options", optional = true) String iOptions) throws IOException {
checkForDatabase();
checkCurrentObject();
final ORecordSerializer serializer = ORecordSerializerFactory.instance().getFormat(iFormat.toLowerCase(Locale.ENGLISH));
if (serializer == null) {
message("\nERROR: Format '" + iFormat + "' was not found.");
printSupportedSerializerFormat();
return;
} else if (!(serializer instanceof ORecordSerializerStringAbstract)) {
message("\nERROR: Format '" + iFormat + "' does not export as text.");
printSupportedSerializerFormat();
return;
}
if (iOptions == null || iOptions.length() <= 0) {
iOptions = "rid,version,class,type,keepTypes,alwaysFetchEmbedded,fetchPlan:*:0,prettyPrint";
}
try {
out.println(currentRecord.toJSON(iOptions));
} catch (ODatabaseExportException e) {
printError(e);
}
}
Aggregations