IndexingItemBuilder

public class IndexingItemBuilder extends Object

Helper object to build an Item.

Use the setters to provide all desired attributes of an Item including the name, ACL, metadata fields, queue, version, and so on. To set the attribute’s value explicitly at build time (value) or derive it from the repository’s map of key/values (field), define the metadata fields as IndexingItemBuilder.FieldOrValue objects.

Sample usage:

// within Repository method fetching a document
   Multimap<String, Object> multiMapValues = ... // populate the map with repository data
   String documentName = ... // create the specific document name (unique id)
   String documentTitle = ... // set title to a "field" in multiMapValues
   ...
   IndexingItemBuilder indexingItemBuilder =
       IndexingItemBuilder.fromConfiguration(documentName).setValues(multiMapValues);
   ...
   // the title is now set to the value of the title field during the build()
   indexingItemBuilder.setTitle(FieldOrValue.withField(documentTitle));
   ...
   // the URL is now set to the hard-coded URL string
   indexingItemBuilder.setSourceRepositoryUrl(FieldOrValue.withValue("https://www.mycompany.com");
   ...
   // generate the fully built document
   Item documentItem = indexingItemBuilder.build();
   ...
   
 

Nested Class Summary

class IndexingItemBuilder.FieldOrValue<T> Construct to specify an actual field value or pointer to a key within the key/values map. 
enum IndexingItemBuilder.ItemType  

Constant Summary

String CONTENT_LANGUAGE_FIELD
String CONTENT_LANGUAGE_VALUE
String CREATE_TIME_FIELD
String CREATE_TIME_VALUE
String OBJECT_TYPE
String SOURCE_REPOSITORY_URL_FIELD
String SOURCE_REPOSITORY_URL_VALUE
String TITLE_FIELD
String TITLE_VALUE
String UPDATE_TIME_FIELD
String UPDATE_TIME_VALUE

Public Constructor Summary

IndexingItemBuilder(String name)
Constructs an empty IndexingItemBuilder.

Public Method Summary

Item
build()
Builds the Item using all of the previously set attributes.
static IndexingItemBuilder
fromConfiguration(String name)
Constructs an IndexingItemBuilder from the Configuration.
IndexingItemBuilder
setAcl(Acl acl)
Sets the Acl instance, which is used to construct the ItemAcl.
IndexingItemBuilder
setContainerName(String container)
Sets the containerName field value for the ItemMetadata.
IndexingItemBuilder
setContentLanguage(FieldOrValue<String> language)
Sets the contentLanguage field value for the ItemMetadata, either from the given field (or key) in the values multimap, or a literal value.
IndexingItemBuilder
setCreateTime(FieldOrValue<DateTime> createTime)
Sets the createTime field value for the ItemMetadata, either from the given field (or key) in the values multimap, or a literal value.
IndexingItemBuilder
setHash(String hash)
Sets the hash field value for the ItemMetadata.
IndexingItemBuilder
setItemType(IndexingItemBuilder.ItemType itemType)
Sets the itemType field value for the Item.
IndexingItemBuilder
setMimeType(String mimeType)
Sets the mimeType field value for the ItemMetadata.
IndexingItemBuilder
setObjectType(String objectType)
Sets the name of the object definition from the schema to use when constructing the ItemStructuredData.
IndexingItemBuilder
setPayload(byte[] payload)
Sets the payload field value for the Item.
IndexingItemBuilder
setQueue(String queue)
Sets the queue field value for the Item.
IndexingItemBuilder
setSearchQualityMetadata(SearchQualityMetadata searchQuality)
Sets the searchQualityMetadata field value for the ItemMetadata.
IndexingItemBuilder
setSourceRepositoryUrl(FieldOrValue<String> url)
Sets the sourceRepositoryUrl field value for the ItemMetadata, either from the given field (or key) in the values multimap, or a literal value.
IndexingItemBuilder
setTitle(FieldOrValue<String> title)
Sets the title field value for the ItemMetadata, either from the given field (or key) in the values multimap, or a literal value.
IndexingItemBuilder
setUpdateTime(FieldOrValue<DateTime> updateTime)
Sets the updateTime field value for the ItemMetadata, either from the given field (or key) in the values multimap, or a literal value.
IndexingItemBuilder
setValues(Multimap<String, Object> values)
Sets the repository attributes that may be used for the ItemMetadata or StructuredDataObject fields, depending on the FieldOrValue setters called by the connector as well as the configuration.
IndexingItemBuilder
setVersion(byte[] version)
Sets the version field value for the Item.

Inherited Method Summary

Constants

public static final String CONTENT_LANGUAGE_FIELD

Constant Value: "itemMetadata.contentLanguage.field"

public static final String CONTENT_LANGUAGE_VALUE

Constant Value: "itemMetadata.contentLanguage.defaultValue"

public static final String CREATE_TIME_FIELD

Constant Value: "itemMetadata.createTime.field"

public static final String CREATE_TIME_VALUE

Constant Value: "itemMetadata.createTime.defaultValue"

public static final String OBJECT_TYPE

Constant Value: "itemMetadata.objectType"

public static final String SOURCE_REPOSITORY_URL_FIELD

Constant Value: "itemMetadata.sourceRepositoryUrl.field"

public static final String SOURCE_REPOSITORY_URL_VALUE

Constant Value: "itemMetadata.sourceRepositoryUrl.defaultValue"

public static final String TITLE_FIELD

Constant Value: "itemMetadata.title.field"

public static final String TITLE_VALUE

Constant Value: "itemMetadata.title.defaultValue"

public static final String UPDATE_TIME_FIELD

Constant Value: "itemMetadata.updateTime.field"

public static final String UPDATE_TIME_VALUE

Constant Value: "itemMetadata.updateTime.defaultValue"

Public Constructors

public IndexingItemBuilder (String name)

Constructs an empty IndexingItemBuilder.

Parameters
name

Public Methods

public Item build ()

Builds the Item using all of the previously set attributes.

Aside from the name and values map, all of the attributes are optional. The metadata attributes (title, sourceRepositoryUrl, updateTime, createTime, contentLanguage) can be set explicitly in the setter, from the values map, or using the configuration properties.

Returns
  • fully built Item object

public static IndexingItemBuilder fromConfiguration (String name)

Constructs an IndexingItemBuilder from the Configuration.

Optional configuration parameters for ItemMetadata:

  • itemMetadata.title.field - The key for the title field in the values map.
  • itemMetadata.sourceRepositoryUrl.field - The key for the URL field in the values map.
  • itemMetadata.updateTime.field - The key for the update time field in the values map.
  • itemMetadata.createTime.field - The key for the create time field in the values map.
  • itemMetadata.contentLanguage.field - The key for the content language field in the values map.
  • itemMetadata.title.defaultValue - The value for the title.
  • itemMetadata.sourceRepositoryUrl.defaultValue - The value for the URL.
  • itemMetadata.updateTime.defaultValue - The value for the update time in RFC 3339 format.
  • itemMetadata.createTime.defaultValue - The value for the create time in RFC 3339 format.
  • itemMetadata.contentLanguage.defaultValue - The value for the content language. Note: For each ItemMetadata field, check the following in order for a non-empty value:
    1. A call to the correponding setter method on the returned instance of IndexingItemBuilder.
    2. A config property with a suffix of .field, used as a key into the the values map.
    3. A config property with a suffix of .defaultValue.

    Optional configuration parameters for StructuredData:

    • itemMetadata.objectType - Specifies the object type from the schema to use for structured data.

Parameters
name

public IndexingItemBuilder setAcl (Acl acl)

Sets the Acl instance, which is used to construct the ItemAcl.

Parameters
acl the Acl instance
Returns
  • this instance

public IndexingItemBuilder setContainerName (String container)

Sets the containerName field value for the ItemMetadata.

Parameters
container the containerName field value
Returns
  • this instance

public IndexingItemBuilder setContentLanguage (FieldOrValue<String> language)

Sets the contentLanguage field value for the ItemMetadata, either from the given field (or key) in the values multimap, or a literal value.

Parameters
language the source of the contentLanguage field value
Returns
  • this instance

public IndexingItemBuilder setCreateTime (FieldOrValue<DateTime> createTime)

Sets the createTime field value for the ItemMetadata, either from the given field (or key) in the values multimap, or a literal value.

Parameters
createTime the source of the createTime field value
Returns
  • this instance

public IndexingItemBuilder setHash (String hash)

Sets the hash field value for the ItemMetadata.

Parameters
hash the hash field value
Returns
  • this instance

public IndexingItemBuilder setItemType (IndexingItemBuilder.ItemType itemType)

Sets the itemType field value for the Item.

Parameters
itemType the itemType field value
Returns
  • this instance

public IndexingItemBuilder setMimeType (String mimeType)

Sets the mimeType field value for the ItemMetadata.

Parameters
mimeType a media type, such as "application/pdf"
Returns
  • this instance

public IndexingItemBuilder setObjectType (String objectType)

Sets the name of the object definition from the schema to use when constructing the ItemStructuredData.

Parameters
objectType the object definition name
Returns
  • this instance

public IndexingItemBuilder setPayload (byte[] payload)

Sets the payload field value for the Item.

Parameters
payload the payload field value
Returns
  • this instance

public IndexingItemBuilder setQueue (String queue)

Sets the queue field value for the Item.

Parameters
queue the queue field value
Returns
  • this instance

public IndexingItemBuilder setSearchQualityMetadata (SearchQualityMetadata searchQuality)

Sets the searchQualityMetadata field value for the ItemMetadata.

Parameters
searchQuality the SearchQualityMetadata instance
Returns
  • this instance

public IndexingItemBuilder setSourceRepositoryUrl (FieldOrValue<String> url)

Sets the sourceRepositoryUrl field value for the ItemMetadata, either from the given field (or key) in the values multimap, or a literal value.

Parameters
url the source of the url field value
Returns
  • this instance

public IndexingItemBuilder setTitle (FieldOrValue<String> title)

Sets the title field value for the ItemMetadata, either from the given field (or key) in the values multimap, or a literal value.

Parameters
title the source of the title field value
Returns
  • this instance

public IndexingItemBuilder setUpdateTime (FieldOrValue<DateTime> updateTime)

Sets the updateTime field value for the ItemMetadata, either from the given field (or key) in the values multimap, or a literal value.

Parameters
updateTime the source of the updateTime field value
Returns
  • this instance

public IndexingItemBuilder setValues (Multimap<String, Object> values)

Sets the repository attributes that may be used for the ItemMetadata or StructuredDataObject fields, depending on the FieldOrValue setters called by the connector as well as the configuration. The map may have repeated values for a key.

Parameters
values the repository attribute values
Returns
  • this instance

public IndexingItemBuilder setVersion (byte[] version)

Sets the version field value for the Item.

Parameters
version the version field value
Returns
  • this instance

Send feedback about...

Cloud Search
Cloud Search