Class ExportRecordsOptions
- java.lang.Object
-
- com.perforce.p4java.option.Options
-
- com.perforce.p4java.option.server.ExportRecordsOptions
-
public class ExportRecordsOptions extends Options
Options class for IOptionsServer.getExportRecords method. Please see the relevant Perforce admin help for details of the meaning and usage of the options defined here -- this method is not intended for general use. Note also some special-casing in the options processing for this class.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
Fields Modifier and Type Field 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.-
Fields inherited from class com.perforce.p4java.option.Options
immutable, optionList
-
-
Constructor Summary
Constructors Constructor 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.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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).-
Methods inherited from class com.perforce.p4java.option.Options
getOptions, isImmutable, processFields, setImmutable, setOptions
-
-
-
-
Field Detail
-
OPTIONS_SPECS
public static final java.lang.String OPTIONS_SPECS
Options:- See Also:
- Constant Field Values
-
useJournal
protected boolean useJournal
If 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 maxRecs
If greater than zero, limits the number of lines (records) exported. Corresponds to the '-l lines' flag.
-
sourceNum
protected int sourceNum
If 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 offset
If positive, specifies a journal or checkpoint optional offset position (journal number/offset or checkpoint number#offset) from which to start exporting.
-
format
protected boolean format
If true, formats non-textual datatypes appropriately. Corresponds to the '-f' flag.
-
journalPrefix
protected java.lang.String journalPrefix
If non-null, specifies a file name prefix to match the one used with 'p4d -jc prefix'. Corresponds to the '-J' flag.
-
filter
protected java.lang.String filter
If non-null, limits output to records that match the filter pattern. Corresponds to the '-F' flag.
-
skipDataConversion
protected boolean skipDataConversion
This 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
protected java.lang.String 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
protected java.lang.String 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
protected java.lang.String 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 Detail
-
ExportRecordsOptions
public ExportRecordsOptions()
Default constructor.
-
ExportRecordsOptions
public ExportRecordsOptions(java.lang.String... options)
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:
Options(java.lang.String...)
-
ExportRecordsOptions
public ExportRecordsOptions(boolean useJournal, long maxRecs, int sourceNum, long offset, boolean format, java.lang.String journalPrefix, java.lang.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 Detail
-
processOptions
public java.util.List<java.lang.String> processOptions(IServer server) throws OptionsException
Process options.- Specified by:
processOptions
in classOptions
- Parameters:
server
- the server- Returns:
- the list
- Throws:
OptionsException
- the options exception- See Also:
Options.processOptions(com.perforce.p4java.server.IServer)
-
processFieldRules
public 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.- Returns:
- map of field handling rules
-
isUseJournal
public boolean isUseJournal()
Checks if is use journal.- Returns:
- true, if is use journal
-
setUseJournal
public ExportRecordsOptions setUseJournal(boolean useJournal)
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
public ExportRecordsOptions setMaxRecs(long maxRecs)
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
public ExportRecordsOptions setSourceNum(int sourceNum)
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
public ExportRecordsOptions setOffset(long offset)
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
public ExportRecordsOptions setFormat(boolean format)
Sets the format (true/false).- Parameters:
format
- the format (true/false)- Returns:
- the export records options
-
getJournalPrefix
public java.lang.String getJournalPrefix()
Gets the journal prefix.- Returns:
- the journal prefix
-
setJournalPrefix
public ExportRecordsOptions setJournalPrefix(java.lang.String journalPrefix)
Sets the journal prefix.- Parameters:
journalPrefix
- the journal prefix- Returns:
- the export records options
-
getFilter
public java.lang.String getFilter()
Gets the filter.- Returns:
- the filter
-
setFilter
public ExportRecordsOptions setFilter(java.lang.String filter)
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
public ExportRecordsOptions setSkipDataConversion(boolean skipDataConversion)
Sets the skip data conversion.- Parameters:
skipDataConversion
- the skip data conversion (true/false)- Returns:
- the export records options
-
getSkipStartField
public java.lang.String getSkipStartField()
Gets the skip start field.- Returns:
- the skip start field
-
setSkipStartField
public ExportRecordsOptions setSkipStartField(java.lang.String skipStartField)
Sets the skip start field.- Parameters:
skipStartField
- the skip start field- Returns:
- the export records options
-
getSkipStopField
public java.lang.String getSkipStopField()
Gets the skip stop field.- Returns:
- the skip stop field
-
setSkipStopField
public ExportRecordsOptions setSkipStopField(java.lang.String skipStopField)
Sets the skip stop field.- Parameters:
skipStopField
- the skip stop field- Returns:
- the export records options
-
getSkipFieldPattern
public java.lang.String getSkipFieldPattern()
Gets the skip field pattern.- Returns:
- the skip field pattern
-
setSkipFieldPattern
public ExportRecordsOptions setSkipFieldPattern(java.lang.String skipFieldPattern)
Sets the skip field pattern.- Parameters:
skipFieldPattern
- the skip field pattern- Returns:
- the export records options
-
-