public class ExportRecordsOptions extends Options
The 'skip*' options are specific to P4Java only; they are not Perforce command options. These options are for field handling rules in the lower layers of P4Java. The field rules are for identifying the fields that should skip charset translation of their values; leaving their values as bytes instead of converting them to strings.
These 'skip*' options (if any) are placed into the command 'input map' and carried downstream to the lower layer of P4Java for field rule processing.
If you choose to use the IOptionsServer.execStreamingMapCommand method, you would place those 'skip*' options manually into an 'input map' and pass the map to the execStreamingMapCommand method. Use 'startField' and 'stopField' as map keys for the 'field range' rule; and use 'fieldPattern' as map key for the 'field pattern' rule. See examples (code snippets) below.
HashMap<String, Object> inMap = new HashMap<String, Object>();
Map<String, Object> skipParams = new HashMap<String, Object>();
skipParams.put("startField", "op");
skipParams.put("stopField", "func");
inMap.put(CmdSpec.EXPORT.toString(), skipParams);
server.execStreamingMapCommand("export", new String[] { "-l100000",
"-j155", "-Ftable=db.traits" }, inMap, handler, key);
HashMap<String, Object> inMap = new HashMap<String, Object>();
Map<String, Object> skipParams = new HashMap<String, Object>();
skipParams.put("fieldPattern", "^[A-Z]{2}\\w+");
inMap.put(CmdSpec.EXPORT.toString(), skipParams);
server.execStreamingMapCommand("export", new String[] { "-l100000",
"-j155", "-Ftable=db.traits" }, inMap, handler, key);
Currently, there are two implemented field rules for skipping charset translations. Only one rule can be activated at once. To turn on the rules you would set the 'skipDataConversion' option to true. Note that the rule creation will be processed in the order listed below.
The 'field pattern' rule defines a regex pattern matching the fields to be skipped. To use this rule you would need to set the 'skipFieldPattern' option.
The 'field range' rule defines a range of fields to be skipped, with a start field (inclusive) and a stop field (non-inclusive). To use this rule you would set the 'skipStartField' and 'skipStopField' options.
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
filter
If non-null, limits output to records that match the filter pattern.
|
protected boolean |
format
If true, formats non-textual datatypes appropriately.
|
protected java.lang.String |
journalPrefix
If non-null, specifies a file name prefix to match the one used with 'p4d
-jc prefix'.
|
protected long |
maxRecs
If greater than zero, limits the number of lines (records) exported.
|
protected long |
offset
If positive, specifies a journal or checkpoint optional offset position
(journal number/offset or checkpoint number#offset) from which to start
exporting.
|
static java.lang.String |
OPTIONS_SPECS
Options:
|
protected boolean |
skipDataConversion
This is not a Perforce command option.
|
protected java.lang.String |
skipFieldPattern
The regex pattern for matching fields which the field values (bytes) will
not be converted to strings.
|
protected java.lang.String |
skipStartField
This is not a Perforce command option.
|
protected java.lang.String |
skipStopField
This is not a Perforce command option.
|
protected int |
sourceNum
If positive, specifies a journal or checkpoint number.
|
protected boolean |
useJournal
If true, specifies a journal number and optional offset position (journal
number/offset) from which to start exporting.
|
immutable, optionList
Constructor and Description |
---|
ExportRecordsOptions()
Default constructor.
|
ExportRecordsOptions(boolean useJournal,
long maxRecs,
int sourceNum,
long offset,
boolean format,
java.lang.String journalPrefix,
java.lang.String filter)
Explicit-value constructor.
|
ExportRecordsOptions(java.lang.String... options)
Strings-based constructor; see 'p4 help [command]' for possible options.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getFilter()
Gets the filter.
|
java.lang.String |
getJournalPrefix()
Gets the journal prefix.
|
long |
getMaxRecs()
Gets the maximum lines to be exported.
|
long |
getOffset()
Gets the journal or checkpoint offset.
|
java.lang.String |
getSkipFieldPattern()
Gets the skip field pattern.
|
java.lang.String |
getSkipStartField()
Gets the skip start field.
|
java.lang.String |
getSkipStopField()
Gets the skip stop field.
|
int |
getSourceNum()
Gets the journal or checkpoint number.
|
boolean |
isFormat()
Checks if is format.
|
boolean |
isSkipDataConversion()
Checks if is skip data conversion.
|
boolean |
isUseJournal()
Checks if is use journal.
|
java.util.Map<java.lang.String,java.lang.Object> |
processFieldRules()
Process the field rules and return an input map for field handling rules
in the deeper layers of P4Java.
|
java.util.List<java.lang.String> |
processOptions(IServer server)
Process options.
|
ExportRecordsOptions |
setFilter(java.lang.String filter)
Sets the filter.
|
ExportRecordsOptions |
setFormat(boolean format)
Sets the format (true/false).
|
ExportRecordsOptions |
setJournalPrefix(java.lang.String journalPrefix)
Sets the journal prefix.
|
ExportRecordsOptions |
setMaxRecs(long maxRecs)
Sets the maximum lines to be exported.
|
ExportRecordsOptions |
setOffset(long offset)
Sets the journal or checkpoint offset.
|
ExportRecordsOptions |
setSkipDataConversion(boolean skipDataConversion)
Sets the skip data conversion.
|
ExportRecordsOptions |
setSkipFieldPattern(java.lang.String skipFieldPattern)
Sets the skip field pattern.
|
ExportRecordsOptions |
setSkipStartField(java.lang.String skipStartField)
Sets the skip start field.
|
ExportRecordsOptions |
setSkipStopField(java.lang.String skipStopField)
Sets the skip stop field.
|
ExportRecordsOptions |
setSourceNum(int sourceNum)
Sets the journal or checkpoint number.
|
ExportRecordsOptions |
setUseJournal(boolean useJournal)
Sets the use journal (true/false).
|
getOptions, isImmutable, processFields, setImmutable, setOptions
public static final java.lang.String OPTIONS_SPECS
protected boolean useJournal
If false, specifies a checkpoint number and optional offset position (checkpoint number#offset) from which to start exporting. Corresponds to the '-c token' flag.
protected long maxRecs
protected int sourceNum
The '-j token' flag specifies a journal number and optional position (in the form: journal number/offset) from which to start exporting. The -c token flag specifies a checkpoint number and optional position (in the form: checkpoint number#offset) from which to start exporting.
protected long offset
protected boolean format
protected java.lang.String journalPrefix
protected java.lang.String filter
protected boolean skipDataConversion
Note: by default the field values affected will be between the start field "op" (non inclusive) and the end field "func" (non inclusive).
protected java.lang.String skipStartField
Note: don't change this unless you know what you're doing.
protected java.lang.String skipStopField
Note: don't change this unless you know what you're doing.
protected java.lang.String skipFieldPattern
Note: don't set this value unless you know what you're doing.
public ExportRecordsOptions()
public ExportRecordsOptions(java.lang.String... options)
WARNING: you should not pass more than one option or argument in each string parameter. Each option or argument should be passed-in as its own separate string parameter, without any spaces between the option and the option value (if any).
NOTE: setting options this way always bypasses the internal options values, and getter methods against the individual values corresponding to the strings passed in to this constructor will not normally reflect the string's setting. Do not use this constructor unless you know what you're doing and / or you do not also use the field getters and setters.
options
- optionsOptions(java.lang.String...)
public ExportRecordsOptions(boolean useJournal, long maxRecs, int sourceNum, long offset, boolean format, java.lang.String journalPrefix, java.lang.String filter)
useJournal
- the use journalmaxRecs
- the max recssourceNum
- the source numoffset
- the offsetformat
- the formatjournalPrefix
- the journal prefixfilter
- the filterpublic java.util.List<java.lang.String> processOptions(IServer server) throws OptionsException
processOptions
in class Options
server
- the serverOptionsException
- the options exceptionOptions.processOptions(com.perforce.p4java.server.IServer)
public java.util.Map<java.lang.String,java.lang.Object> processFieldRules()
public boolean isUseJournal()
public ExportRecordsOptions setUseJournal(boolean useJournal)
useJournal
- the use journal (true/false)public long getMaxRecs()
public ExportRecordsOptions setMaxRecs(long maxRecs)
maxRecs
- the maximum linespublic int getSourceNum()
public ExportRecordsOptions setSourceNum(int sourceNum)
sourceNum
- the journal or checkpoint numberpublic long getOffset()
public ExportRecordsOptions setOffset(long offset)
offset
- the journal or checkpoint offsetpublic boolean isFormat()
public ExportRecordsOptions setFormat(boolean format)
format
- the format (true/false)public java.lang.String getJournalPrefix()
public ExportRecordsOptions setJournalPrefix(java.lang.String journalPrefix)
journalPrefix
- the journal prefixpublic java.lang.String getFilter()
public ExportRecordsOptions setFilter(java.lang.String filter)
filter
- the filterpublic boolean isSkipDataConversion()
public ExportRecordsOptions setSkipDataConversion(boolean skipDataConversion)
skipDataConversion
- the skip data conversion (true/false)public java.lang.String getSkipStartField()
public ExportRecordsOptions setSkipStartField(java.lang.String skipStartField)
skipStartField
- the skip start fieldpublic java.lang.String getSkipStopField()
public ExportRecordsOptions setSkipStopField(java.lang.String skipStopField)
skipStopField
- the skip stop fieldpublic java.lang.String getSkipFieldPattern()
public ExportRecordsOptions setSkipFieldPattern(java.lang.String skipFieldPattern)
skipFieldPattern
- the skip field pattern