implements ApiOperation
Generic object for a single document in a repository.
This is a type of ApiOperation
that performs an indexItem(Item, RequestMode)
request. This single request can actually contain multiple requests if the data
repository is hierarchical.
Sample usage:
Item item = ... // create an Item object
ByteArrayContent content = ... // create item content, using HTML content for this example
String contentHash = ... // optional content hash value
RepositoryDoc.Builder builder = new RepositoryDoc.Builder()
.setItem(item)
.setContent(content, contentHash, ContentFormat.HTML)
.setRequestMode(RequestMode.SYNCHRONOUS);
// if hierarchical, add children of this document
List<String> childIds = ... // retrieve all child IDs
for (childId : childIds) {
PushItem pushItem = ... // populate a push item for this ID
builder.addChildId(childId, pushItem);
}
RepositoryDoc document = builder.build();
// now the document is ready for use, typically as a return value from a Repository method
Nested Class Summary
class | RepositoryDoc.Builder |
Public Method Summary
boolean |
equals(Object other)
|
List<GenericJson> | |
Map<String, PushItem> |
getChildIds()
Gets child items to be pushed.
|
AbstractInputStreamContent |
getContent()
Gets the content of this repository document.
|
IndexingService.ContentFormat |
getContentFormat()
Gets
IndexingService.ContentFormat for indexable content. |
String |
getContentHash()
Gets the hash value of this repository document's content.
|
Map<String, Acl> |
getFragments()
Gets additional
Acl fragments to be created. |
Item | |
IndexingService.RequestMode |
getRequestMode()
Gets
IndexingService.RequestMode to be used for executing indexing requests. |
int |
hashCode()
|
String |
toString()
|
Inherited Method Summary
Public Methods
public boolean equals (Object other)
Parameters
other |
---|
public List<GenericJson> execute (IndexingService service)
Performs the indexing service request to index the document.
In addition to updating the Item
, the children (if any) are pushed and ACL fragments
(possibly representing a directory in a hierarchical data repository) are created and updated.
Parameters
service | the indexing service used to execute requests |
---|
Returns
- results of the requests
Throws
IOException | on SDK upload errors |
---|---|
InterruptedException | on program interruption |
public Map<String, PushItem> getChildIds ()
Gets child items to be pushed.
Returns
- child items to be pushed.
public AbstractInputStreamContent getContent ()
Gets the content of this repository document.
Returns
- document content
public IndexingService.ContentFormat getContentFormat ()
Gets IndexingService.ContentFormat
for indexable content.
Returns
IndexingService.ContentFormat
for indexable content.
public String getContentHash ()
Gets the hash value of this repository document's content.
Returns
- document's content hash value
public Map<String, Acl> getFragments ()
public Item getItem ()
Gets the repository document converted into an Item
.
Returns
- a unique document ID
public IndexingService.RequestMode getRequestMode ()
Gets IndexingService.RequestMode
to be used for executing indexing requests.
Returns
IndexingService.RequestMode
to be used for executing indexing requests.