Package com.digimarc.dms.resolver
Class ResolvedContent
java.lang.Object
com.digimarc.dms.resolver.ResolvedContent
ResolvedContent wraps all data from the Digimarc Resolver and allows access to the fields.
This class handles the majority of data returned by the resolver (both Digimarc Barcode
for Audio, Digimarc Barcode for Print and a majority Digimarc Barcode for Packaging).
-
Constructor Summary
ConstructorsConstructorDescriptionResolvedContent
(Payload payload, String json) Constructor.ResolvedContent
(Payload payload, String title, String subTitle, String thumbnailUrl, String content) Constructor.ResolvedContent
(Payload payload, String title, String subTitle, String thumbnailUrl, String content, String correlationKey, boolean synthesizedContent) Constructor.ResolvedContent
(String json) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionReturns the list ofContentItem
objects contained within the resolve data.Returns a list of all theContentItem
items in the current object that match the specified category.Get the content data's correlation key.boolean
Checks whether this resolve data contains product details.Gets the Payload associated with this resolver content.Gets product details if they are available.Gets the JSON text from the Digimarc Resolver that produced this object.
-
Constructor Details
-
ResolvedContent
public ResolvedContent(@NonNull Payload payload, @Nullable String json) throws ResolvedContentException Constructor. In this version the Payload member within the ResolvedContent will be filled using the payload parameter.- Parameters:
payload
- Payload used for this resolve.json
- String containing the resolver data JSON text.- Throws:
ResolvedContentException
- Exception thrown if the JSON is malformed.
-
ResolvedContent
Constructor. In this version the Payload member within the ResolvedContent will be from the PayloadPath entry in the JSON text. Note that the payload string is transformed during the resolve process and the payload string contained in the JSON text may not match what was originally sent to the resolver. In most cases we do not recommend using this method.- Parameters:
json
- String containing the resolver data JSON text.- Throws:
ResolvedContentException
- Exception thrown if the JSON is malformed.
-
ResolvedContent
public ResolvedContent(@NonNull Payload payload, @Nullable String title, @Nullable String subTitle, @Nullable String thumbnailUrl, @Nullable String content) Constructor.- Parameters:
payload
- The payload that this data represents.title
- Title of the content data.subTitle
- Subtitle of the content data.thumbnailUrl
- URL to an image thumbnail that is associated with this content. This value may be empty.content
- The content itself. This is generally an URL.
-
ResolvedContent
public ResolvedContent(@NonNull Payload payload, @Nullable String title, @Nullable String subTitle, @Nullable String thumbnailUrl, @Nullable String content, @Nullable String correlationKey, boolean synthesizedContent) Constructor.- Parameters:
payload
- The payload that this data represents.title
- Title of the content data.subTitle
- Subtitle of the content data.thumbnailUrl
- URL to an image thumbnail that is associated with this content. This value may be empty.content
- The content itself. This is generally an URL.correlationKey
- The correlation key associated with this object.synthesizedContent
- Specifies whether this result was generated locally.
-
-
Method Details
-
getPayload
Gets the Payload associated with this resolver content.- Returns:
- Payload object.
-
getCorrelationKey
Get the content data's correlation key. This is a value that can be used to determine whether two sets of resolve data correspond to the same object. For instance, on product packaging with a Digimarc Barcode the Digimarc Barcode on the package and the product's 1D barcode will resolve to separate sets of content data. These two entries, however, will have the same correlation key value.- Returns:
- The correlation key value.
-
getRawJson
Gets the JSON text from the Digimarc Resolver that produced this object. Most applications will not need to use this method.- Returns:
- The raw JSON text received from the Digimarc Resolver.
-
getContentItems
Returns the list ofContentItem
objects contained within the resolve data. This list is guaranteed to contain at least one element, and the list is sorted such that the most relevant item will be first. In most cases it is sufficient to use the first element for all actions.- Returns:
- A list of
ContentItem
objects. The list will always contain at least one object.
-
getContentItemsForCategory
@Nullable public List<ContentItem> getContentItemsForCategory(@NonNull ContentItem.Category category) Returns a list of all theContentItem
items in the current object that match the specified category.- Parameters:
category
- What category of ContentItems should be retrieved.- Returns:
- Null if no items match the category, otherwise a list containing one or more items.
-
getIsProductDetailAvailable
public boolean getIsProductDetailAvailable()Checks whether this resolve data contains product details.- Returns:
- True if
ProductDetail
is available.
-
getProductDetail
Gets product details if they are available.- Returns:
- Product detail object if it is available, null otherwise.
-