Package com.endeca.BulkLoad.Msg

This defines the Data.Record class used by the Endeca BulkLoad API.

See:
          Description

Interface Summary
Data.AssignmentOrBuilder  
Data.RecordOrBuilder  
 

Class Summary
Data  
Data.Assignment  
Data.Assignment.Builder  
Data.Record  
Data.Record.Builder  
 

Enum Summary
Data.Assignment.DataType  
 

Package com.endeca.BulkLoad.Msg Description

This defines the Data.Record class used by the Endeca BulkLoad API. This class is generated via the Google Protocol Buffer API, which sadly does not have a facility for adding Javadoc comments to its generated Java code, which is why the Javadoc for these classes is not very informative. For more complete details on how protobuf-generated Java classes work, go here.

Records and Assignments

The fundamental data type for loading data into an Endeca data store is a Data.Record. Client code using the Bulk Load API to load data into an Endeca data store must convert the data records from their native format into a Record. Conceptually, a Record is a named set of key/value pairs. A key/value pair is a Data.Assignment. The key is a String and the value can be any of several supported data types. The name of the Record is also an Assignment, and can therefore also be any of these types; for this reason it is known as the Spec. The Spec serves as the primary key of the data record; a Record is not valid without one.

Builders

Data and Record objects are immutable; like Java Strings, they cannot be modified once created. Both are created via an associated Builder type. The Data.Record.Builder has set() and clear() methods for the spec and for the Assignments; Data.Assignment.Builder has the same for its key and all of the supported data types. All of the setter functions in the Builder classes return the object they were invoked on ("return this"), so they can be strung together. This makes it possible, if desired, to build the entire thing on one line:
Data.Assignment.newBuilder().setName("SKU").setString("ABC1234").setDataType(Data.Assignment.DataType.STRING).build();

Data Types

The Data.Assignment.DataType enum contains entries for each of the data types supported by the Endeca data store. These correspond to the Assignment class's setter methods as follows:

BOOLEANsetBoolValue()
DOUBLEsetDoubleValue()
DURATIONsetStringValue()
DATETIMEsetStringValue()
GEOCODEsetStringValue()
INTsetInt32Value()
INT64setInt64Value()
STRINGsetStringValue()
TIMEsetStringValue()

The encoding of GEOCODE, DURATION, DATETIME and TIME into Strings is outside the scope of this document.

The setDataType() method tells the Endeca server what the Assignment's data type is. If you call setStringValue("foo") and setDataType(Data.Assignment.DataType.DOUBLE) and include the resulting Assignment in a Record that you send to the server, the server will attempt to extract the DOUBLE value and get back nothing. If you do not specify a data type, the Assignment is invalid.

Data.Record.Builder.addAssignments(Data.Assignment), despite its name, adds but one Assignment.

For an example of these classes in action, see the BulkLoad documentation

.