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 CONTAINER_NAME_FIELD
String CONTAINER_NAME_VALUE
String CONTENT_LANGUAGE_FIELD
String CONTENT_LANGUAGE_VALUE
String CREATE_TIME_FIELD
String CREATE_TIME_VALUE
String HASH_FIELD
String HASH_VALUE
String MIME_TYPE_FIELD
String MIME_TYPE_VALUE
String OBJECT_TYPE
String OBJECT_TYPE_FIELD
String OBJECT_TYPE_VALUE
String SEARCH_QUALITY_METADATA_QUALITY_FIELD
String SEARCH_QUALITY_METADATA_QUALITY_VALUE
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 containerName)
This method is deprecated. Use setContainerName(FieldOrValue) with withValue(T)
IndexingItemBuilder
setContainerName(FieldOrValue<String> containerName)
Sets the containerName field value for the ItemMetadata, either from the given field (or key) in the values multimap, or a literal value.
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(FieldOrValue<String> hash)
Sets the hash field value for the ItemMetadata, either from the given field (or key) in the values multimap, or a literal value.
IndexingItemBuilder
setHash(String hash)
This method is deprecated. Use setHash(FieldOrValue) with withValue(T)
IndexingItemBuilder
setItemType(IndexingItemBuilder.ItemType itemType)
Sets the itemType field value for the Item.
IndexingItemBuilder
setMimeType(String mimeType)
This method is deprecated. Use setMimeType(FieldOrValue) with withValue(T)
IndexingItemBuilder
setMimeType(FieldOrValue<String> mimeType)
Sets the mimeType field value for the ItemMetadata, either from the given field (or key) in the values multimap, or a literal value.
IndexingItemBuilder
setObjectType(String objectType)
This method is deprecated. Use setObjectType(FieldOrValue) with withValue(T)
IndexingItemBuilder
setObjectType(FieldOrValue<String> objectType)
Sets the name of the object definition from the schema to use when constructing the ItemStructuredData, either from the given field (or key) in the values multimap, or a literal value.
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
setSearchQualityMetadataQuality(FieldOrValue<Double> quality)
Sets the searchQualityMetadata.quality 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 CONTAINER_NAME_FIELD

Constant Value: "itemMetadata.containerName.field"

public static final String CONTAINER_NAME_VALUE

Constant Value: "itemMetadata.containerName.defaultValue"

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 HASH_FIELD

Constant Value: "itemMetadata.hash.field"

public static final String HASH_VALUE

Constant Value: "itemMetadata.hash.defaultValue"

public static final String MIME_TYPE_FIELD

Constant Value: "itemMetadata.mimeType.field"

public static final String MIME_TYPE_VALUE

Constant Value: "itemMetadata.mimeType.defaultValue"

public static final String OBJECT_TYPE

Constant Value: "itemMetadata.objectType"

public static final String OBJECT_TYPE_FIELD

Constant Value: "itemMetadata.objectType.field"

public static final String OBJECT_TYPE_VALUE

Constant Value: "itemMetadata.objectType.defaultValue"

public static final String SEARCH_QUALITY_METADATA_QUALITY_FIELD

Constant Value: "itemMetadata.searchQualityMetadata.quality.field"

public static final String SEARCH_QUALITY_METADATA_QUALITY_VALUE

Constant Value: "itemMetadata.searchQualityMetadata.quality.defaultValue"

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 (mimeType, title, sourceRepositoryUrl, updateTime, createTime, contentLanguage, hash, containerName) 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.mimeType.field - The key for the mimeType field in the values map.
  • 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.hash.field - The key for the hash field in the values map.
  • itemMetadata.containerName.field - The key for the container name field in the values map.
  • itemMetadata.searchQualityMetadata.quality.field - The key for the SearchQualityMetadata quality field in the values map.
  • itemMetadata.mimeType.defaultValue - The value for the media type.
  • 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.
  • itemMetadata.hash.defaultValue - The value for the hash.
  • itemMetadata.containerName.defaultValue - The value for the container name.
  • itemMetadata.searchQualityMetadata.quality.defaultValue - The value for the SearchQualityMetadata quality.

Optional configuration parameters for ItemMetadata and StructuredData:

  • itemMetadata.objectType.field - The key for the object type field in the values map.
  • itemMetadata.objectType.defaultValue - The value for the object type.
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.

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 containerName)

This method is deprecated.
Use setContainerName(FieldOrValue) with withValue(T)

Sets the containerName field value for the ItemMetadata.

Parameters
containerName the containerName field value
Returns
  • this instance

public IndexingItemBuilder setContainerName (FieldOrValue<String> containerName)

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

Parameters
containerName the source of 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 (FieldOrValue<String> hash)

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

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

public IndexingItemBuilder setHash (String hash)

This method is deprecated.
Use setHash(FieldOrValue) with withValue(T)

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)

This method is deprecated.
Use setMimeType(FieldOrValue) with withValue(T)

Sets the mimeType field value for the ItemMetadata.

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

public IndexingItemBuilder setMimeType (FieldOrValue<String> mimeType)

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

Parameters
mimeType the source of the media type
Returns
  • this instance

public IndexingItemBuilder setObjectType (String objectType)

This method is deprecated.
Use setObjectType(FieldOrValue) with withValue(T)

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 setObjectType (FieldOrValue<String> objectType)

Sets the name of the object definition from the schema to use when constructing the ItemStructuredData, either from the given field (or key) in the values multimap, or a literal value.

Parameters
objectType the source of 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.

Using this setter will override any value previously set using setSearchQualityMetadataQuality(FieldOrValue).

Parameters
searchQuality the SearchQualityMetadata instance
Returns
  • this instance

public IndexingItemBuilder setSearchQualityMetadataQuality (FieldOrValue<Double> quality)

Sets the searchQualityMetadata.quality field value for the ItemMetadata.

Using this setter will override any value previously set using setSearchQualityMetadata(SearchQualityMetadata).

Parameters
quality the source of the searchQualityMetadata.quality value
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