Class ExportRecordsOptions
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.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected StringIf non-null, limits output to records that match the filter pattern.protected booleanIf true, formats non-textual datatypes appropriately.protected StringIf non-null, specifies a file name prefix to match the one used with 'p4d -jc prefix'.protected longIf greater than zero, limits the number of lines (records) exported.protected longIf positive, specifies a journal or checkpoint optional offset position (journal number/offset or checkpoint number#offset) from which to start exporting.static final StringOptions:protected booleanThis is not a Perforce command option.protected StringThe regex pattern for matching fields which the field values (bytes) will not be converted to strings.protected StringThis is not a Perforce command option.protected StringThis is not a Perforce command option.protected intIf positive, specifies a journal or checkpoint number.protected booleanIf true, specifies a journal number and optional offset position (journal number/offset) from which to start exporting.Fields inherited from class com.perforce.p4java.option.Options
immutable, optionList -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.ExportRecordsOptions(boolean useJournal, long maxRecs, int sourceNum, long offset, boolean format, String journalPrefix, String filter) Explicit-value constructor.ExportRecordsOptions(String... options) Strings-based constructor; see 'p4 help [command]' for possible options. -
Method Summary
Modifier and TypeMethodDescriptionGets the filter.Gets the journal prefix.longGets the maximum lines to be exported.longGets the journal or checkpoint offset.Gets the skip field pattern.Gets the skip start field.Gets the skip stop field.intGets the journal or checkpoint number.booleanisFormat()Checks if is format.booleanChecks if is skip data conversion.booleanChecks if is use journal.Process the field rules and return an input map for field handling rules in the deeper layers of P4Java.processOptions(IServer server) Process options.Sets the filter.setFormat(boolean format) Sets the format (true/false).setJournalPrefix(String journalPrefix) Sets the journal prefix.setMaxRecs(long maxRecs) Sets the maximum lines to be exported.setOffset(long offset) Sets the journal or checkpoint offset.setSkipDataConversion(boolean skipDataConversion) Sets the skip data conversion.setSkipFieldPattern(String skipFieldPattern) Sets the skip field pattern.setSkipStartField(String skipStartField) Sets the skip start field.setSkipStopField(String skipStopField) Sets the skip stop field.setSourceNum(int sourceNum) Sets the journal or checkpoint number.setUseJournal(boolean useJournal) Sets the use journal (true/false).Methods inherited from class com.perforce.p4java.option.Options
getOptions, isImmutable, processFields, setImmutable, setOptions
-
Field Details
-
OPTIONS_SPECS
Options:- See Also:
-
useJournal
protected boolean useJournalIf true, specifies a journal number and optional offset position (journal number/offset) from which to start exporting. Corresponds to the '-j token' flag.If false, specifies a checkpoint number and optional offset position (checkpoint number#offset) from which to start exporting. Corresponds to the '-c token' flag.
-
maxRecs
protected long maxRecsIf greater than zero, limits the number of lines (records) exported. Corresponds to the '-l lines' flag. -
sourceNum
protected int sourceNumIf positive, specifies a journal or checkpoint number. Corresponds to the 'token' part of the '-j token' and '-c token' flags.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.
-
offset
protected long offsetIf positive, specifies a journal or checkpoint optional offset position (journal number/offset or checkpoint number#offset) from which to start exporting. -
format
protected boolean formatIf true, formats non-textual datatypes appropriately. Corresponds to the '-f' flag. -
journalPrefix
If non-null, specifies a file name prefix to match the one used with 'p4d -jc prefix'. Corresponds to the '-J' flag. -
filter
If non-null, limits output to records that match the filter pattern. Corresponds to the '-F' flag. -
skipDataConversion
protected boolean skipDataConversionThis is not a Perforce command option. If true, it will signal the deeper level logic to skip the charset conversion of data fields; leave the values as bytes.Note: by default the field values affected will be between the start field "op" (non inclusive) and the end field "func" (non inclusive).
-
skipStartField
This is not a Perforce command option. If non-null, it is the start field (inclusive) marking the beginning of a series of fields which the field values (bytes) will not be converted to strings.Note: don't change this unless you know what you're doing.
-
skipStopField
This is not a Perforce command option. If non-null, it is the stop field (non-inclusive) marking the end of a series of fields which the field values (bytes) will not be converted to strings.Note: don't change this unless you know what you're doing.
-
skipFieldPattern
The regex pattern for matching fields which the field values (bytes) will not be converted to strings.Note: don't set this value unless you know what you're doing.
-
-
Constructor Details
-
ExportRecordsOptions
public ExportRecordsOptions()Default constructor. -
ExportRecordsOptions
Strings-based constructor; see 'p4 help [command]' for possible 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.
- Parameters:
options- options- See Also:
-
ExportRecordsOptions
public ExportRecordsOptions(boolean useJournal, long maxRecs, int sourceNum, long offset, boolean format, String journalPrefix, String filter) Explicit-value constructor.- Parameters:
useJournal- the use journalmaxRecs- the max recssourceNum- the source numoffset- the offsetformat- the formatjournalPrefix- the journal prefixfilter- the filter
-
-
Method Details
-
processOptions
Process options.- Specified by:
processOptionsin classOptions- Parameters:
server- the server- Returns:
- the list
- Throws:
OptionsException- the options exception- See Also:
-
processFieldRules
Process the field rules and return an input map for field handling rules in the deeper layers of P4Java.- Returns:
- map of field handling rules
-
isUseJournal
public boolean isUseJournal()Checks if is use journal.- Returns:
- true, if is use journal
-
setUseJournal
Sets the use journal (true/false).- Parameters:
useJournal- the use journal (true/false)- Returns:
- the export records options
-
getMaxRecs
public long getMaxRecs()Gets the maximum lines to be exported.- Returns:
- the maximum lines
-
setMaxRecs
Sets the maximum lines to be exported.- Parameters:
maxRecs- the maximum lines- Returns:
- the export records options
-
getSourceNum
public int getSourceNum()Gets the journal or checkpoint number.- Returns:
- the journal or checkpoint number
-
setSourceNum
Sets the journal or checkpoint number.- Parameters:
sourceNum- the journal or checkpoint number- Returns:
- the export records options
-
getOffset
public long getOffset()Gets the journal or checkpoint offset.- Returns:
- the journal or checkpoint offset
-
setOffset
Sets the journal or checkpoint offset.- Parameters:
offset- the journal or checkpoint offset- Returns:
- the export records options
-
isFormat
public boolean isFormat()Checks if is format.- Returns:
- true, if is format
-
setFormat
Sets the format (true/false).- Parameters:
format- the format (true/false)- Returns:
- the export records options
-
getJournalPrefix
Gets the journal prefix.- Returns:
- the journal prefix
-
setJournalPrefix
Sets the journal prefix.- Parameters:
journalPrefix- the journal prefix- Returns:
- the export records options
-
getFilter
Gets the filter.- Returns:
- the filter
-
setFilter
Sets the filter.- Parameters:
filter- the filter- Returns:
- the export records options
-
isSkipDataConversion
public boolean isSkipDataConversion()Checks if is skip data conversion.- Returns:
- true, if is skip data conversion
-
setSkipDataConversion
Sets the skip data conversion.- Parameters:
skipDataConversion- the skip data conversion (true/false)- Returns:
- the export records options
-
getSkipStartField
Gets the skip start field.- Returns:
- the skip start field
-
setSkipStartField
Sets the skip start field.- Parameters:
skipStartField- the skip start field- Returns:
- the export records options
-
getSkipStopField
Gets the skip stop field.- Returns:
- the skip stop field
-
setSkipStopField
Sets the skip stop field.- Parameters:
skipStopField- the skip stop field- Returns:
- the export records options
-
getSkipFieldPattern
Gets the skip field pattern.- Returns:
- the skip field pattern
-
setSkipFieldPattern
Sets the skip field pattern.- Parameters:
skipFieldPattern- the skip field pattern- Returns:
- the export records options
-