|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.perforce.p4java.option.Options
com.perforce.p4java.option.server.ExportRecordsOptions
public class ExportRecordsOptions
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.
HashMapinMap = new HashMap (); Map skipParams = new HashMap (); 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); HashMapCurrently, 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.inMap = new HashMap (); Map skipParams = new HashMap (); 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); 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 protected 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 String
journalPrefix
If non-null, specifies a file name prefix to match the one used with 'p4d -jc'. 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 String
OPTIONS_SPECS
Options:protected boolean
skipDataConversion
This is not a Perforce command option.protected String
skipFieldPattern
The regex pattern for matching fields which the field values (bytes) will not be converted to strings.protected String
skipStartField
This is not a Perforce command option.protected 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, OPTPFX
Constructor Summary ExportRecordsOptions()
Default 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 String
getFilter()
Gets the filter.String
getJournalPrefix()
Gets the journal prefix.long
getMaxRecs()
Gets the maximum lines to be exported.long
getOffset()
Gets the journal or checkpoint offset.String
getSkipFieldPattern()
Gets the skip field pattern.String
getSkipStartField()
Gets the skip start field.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.Map<String,Object>
processFieldRules()
Process the field rules and return an input map for field handling rules in the deeper layers of P4Java.List<String>
processOptions(IServer server)
Process options.ExportRecordsOptions
setFilter(String filter)
Sets the filter.ExportRecordsOptions
setFormat(boolean format)
Sets the format (true/false).ExportRecordsOptions
setJournalPrefix(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(String skipFieldPattern)
Sets the skip field pattern.ExportRecordsOptions
setSkipStartField(String skipStartField)
Sets the skip start field.ExportRecordsOptions
setSkipStopField(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 applyRule, applyRule, applyRule, applyRule, getOptions, isImmutable, processFields, setImmutable, setOptions
Methods inherited from class java.lang.Object clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Field Detail OPTIONS_SPECS
public static final 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 String journalPrefix
- If non-null, specifies a file name prefix to match the one used with 'p4d -jc
'. Corresponds to the '-J' flag.
filter
protected 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 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 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 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(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.
- See Also:
Options.Options(java.lang.String...)
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 Detail processOptions
public List<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 Map<String,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 String getJournalPrefix()
- Gets the journal prefix.
- Returns:
- the journal prefix
setJournalPrefix
public ExportRecordsOptions setJournalPrefix(String journalPrefix)
- Sets the journal prefix.
- Parameters:
journalPrefix
- the journal prefix- Returns:
- the export records options
getFilter
public String getFilter()
- Gets the filter.
- Returns:
- the filter
setFilter
public ExportRecordsOptions setFilter(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 String getSkipStartField()
- Gets the skip start field.
- Returns:
- the skip start field
setSkipStartField
public ExportRecordsOptions setSkipStartField(String skipStartField)
- Sets the skip start field.
- Parameters:
skipStartField
- the skip start field- Returns:
- the export records options
getSkipStopField
public String getSkipStopField()
- Gets the skip stop field.
- Returns:
- the skip stop field
setSkipStopField
public ExportRecordsOptions setSkipStopField(String skipStopField)
- Sets the skip stop field.
- Parameters:
skipStopField
- the skip stop field- Returns:
- the export records options
getSkipFieldPattern
public String getSkipFieldPattern()
- Gets the skip field pattern.
- Returns:
- the skip field pattern
setSkipFieldPattern
public ExportRecordsOptions setSkipFieldPattern(String skipFieldPattern)
- Sets the skip field pattern.
- Parameters:
skipFieldPattern
- the skip field pattern- Returns:
- the export records options
Overview Package Class Use Tree Deprecated Index Help PREV CLASS NEXT CLASS FRAMES NO FRAMES SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD
Copyright © 2015 Perforce Software. All Rights Reserved.