public class HarCustomFields
extends java.lang.Object
HarLog hl = new HarLog(config) ;
//Add or set :
hl.getCustomFields().addCustomField("name", "value");
//Get :
String value = hl.getCustomFields().getCustomFieldValue("name");
Modifier and Type | Class and Description |
---|---|
static class |
HarCustomFields.Type
Defines constants for HarCustomFields database entry
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
TABLE_NAME
Database table name used to store custom fields
|
Constructor and Description |
---|
HarCustomFields()
Creates a new
HarCustomFields object |
Modifier and Type | Method and Description |
---|---|
void |
addCustomField(java.lang.String name,
java.lang.String value)
Adds a custom field to HarCustomFields object
|
void |
addHarCustomFields(java.lang.String name,
org.codehaus.jackson.JsonParser jp)
Adds a new customField to this object
|
void |
deleteFromJDBC(HarDatabaseConfig config,
long dbLogId)
Delete all custom fields objects in the database referencing the specified
logId.
|
protected java.util.Map<java.lang.String,java.lang.String> |
getCustomFields()
Returns the customFields map.
|
java.lang.String |
getCustomFieldValue(java.lang.String name)
Gets custom field value by name
|
void |
readCustomFieldsJDBC(HarDatabaseConfig config,
HarCustomFields.Type harTypeFrom,
long harIdFrom)
Reads the customFields from database
|
protected void |
setCustomFields(java.util.Map<java.lang.String,java.lang.String> customFields)
Sets the customFields value.
|
java.lang.String |
toString() |
long |
writeCustomFieldsJDBC(HarDatabaseConfig config,
HarCustomFields.Type HarTypeFrom,
long HarIdFrom,
long HarLogId)
Writes this object in the given database referencing the specified logId.
|
void |
writeHar(org.codehaus.jackson.JsonGenerator g)
Writes this object on a JsonGenerator stream
|
public static java.lang.String TABLE_NAME
protected java.util.Map<java.lang.String,java.lang.String> getCustomFields()
protected void setCustomFields(java.util.Map<java.lang.String,java.lang.String> customFields)
customFields
- The customFields to set.public void addHarCustomFields(java.lang.String name, org.codehaus.jackson.JsonParser jp) throws java.io.IOException
name
- the name of the custom field. It must start with an underscorejp
- a JsonParser already positioned at the beginning of the element
contentjava.io.IOException
public void writeHar(org.codehaus.jackson.JsonGenerator g) throws java.io.IOException
g
- a JsonGeneratorjava.io.IOException
public long writeCustomFieldsJDBC(HarDatabaseConfig config, HarCustomFields.Type HarTypeFrom, long HarIdFrom, long HarLogId) throws java.sql.SQLException
config
- the database configurationHarTypeFrom
- The type of HAR objectHarIdFrom
- The id of the HAR object associated to the customFieldsHarLogId
- The Id of the parent logjava.sql.SQLException
- if a database access error occurspublic void readCustomFieldsJDBC(HarDatabaseConfig config, HarCustomFields.Type harTypeFrom, long harIdFrom) throws java.sql.SQLException
config
- the database configurationharTypeFrom
- The type of the HAR object associated to the
customFieldsharIdFrom
- The id of the HAR object associated to the customFieldsjava.sql.SQLException
public void deleteFromJDBC(HarDatabaseConfig config, long dbLogId) throws java.sql.SQLException
config
- the database configurationdbLogId
- the Id of the parent logjava.sql.SQLException
public void addCustomField(java.lang.String name, java.lang.String value)
name
- Name for custom fieldvalue
- value to set for the custom fieldpublic java.lang.String getCustomFieldValue(java.lang.String name)
name
- Name of custom field to getpublic java.lang.String toString()
toString
in class java.lang.Object
Object.toString()
Copyright © 2011 Emmanuel Cecchet - University of Massachusetts - All Rights Reserved.