Class ProductLinkedDataGeneratorImpl
java.lang.Object
org.broadleafcommerce.core.web.linkeddata.generator.AbstractLinkedDataGenerator
org.broadleafcommerce.core.web.linkeddata.generator.ProductLinkedDataGeneratorImpl
- All Implemented Interfaces:
LinkedDataGenerator
@Service("blProductLinkedDataGenerator")
public class ProductLinkedDataGeneratorImpl
extends AbstractLinkedDataGenerator
This generator generates structured data specific to product pages.
See http://schema.org/Product, http://schema.org/Offer, and http://schema.org/AggregateOffer
- Author:
- Jacob Mitash, Nathan Moore (nathanmoore).
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected CatalogServiceprotected static final Stringprotected static final DateFormatprotected static final Stringprotected RatingServiceFields inherited from class org.broadleafcommerce.core.web.linkeddata.generator.AbstractLinkedDataGenerator
baseUrlResolver, breadcrumbService, DEFAULT_STRUCTURED_CONTENT_CONTEXT, environment, extensionManager -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddImageUrl(Product product, org.codehaus.jettison.json.JSONObject productData) protected org.codehaus.jettison.json.JSONObjectaddProductData(jakarta.servlet.http.HttpServletRequest request, Product product, String url) protected voidaddReviewData(jakarta.servlet.http.HttpServletRequest request, Product product, org.codehaus.jettison.json.JSONObject productData) protected voidaddSkus(jakarta.servlet.http.HttpServletRequest request, Product product, org.codehaus.jettison.json.JSONObject productData, String url) booleancanHandle(jakarta.servlet.http.HttpServletRequest request) Determines whether or not this LinkedDataGenerator can handle the incoming request.protected StringdetermineAvailability(Sku sku) protected Stringprotected Stringprotected org.codehaus.jettison.json.JSONArraygetLinkedDataJsonInternal(String url, jakarta.servlet.http.HttpServletRequest request, org.codehaus.jettison.json.JSONArray schemaObjects) protected ProductgetProduct(jakarta.servlet.http.HttpServletRequest request) Methods inherited from class org.broadleafcommerce.core.web.linkeddata.generator.AbstractLinkedDataGenerator
getLinkedDataJSON, getRequestParams, getRequestUri, getSiteBaseUrl, getStructuredDataContext
-
Field Details
-
IN_STOCK
- See Also:
-
OUT_OF_STOCK
- See Also:
-
ISO_8601_FORMAT
-
ratingService
-
catalogService
-
-
Constructor Details
-
ProductLinkedDataGeneratorImpl
public ProductLinkedDataGeneratorImpl()
-
-
Method Details
-
canHandle
public boolean canHandle(jakarta.servlet.http.HttpServletRequest request) Description copied from interface:LinkedDataGeneratorDetermines whether or not this LinkedDataGenerator can handle the incoming request.- Specified by:
canHandlein interfaceLinkedDataGenerator- Specified by:
canHandlein classAbstractLinkedDataGenerator- Returns:
- whether to handle the destination type
-
getLinkedDataJsonInternal
protected org.codehaus.jettison.json.JSONArray getLinkedDataJsonInternal(String url, jakarta.servlet.http.HttpServletRequest request, org.codehaus.jettison.json.JSONArray schemaObjects) throws org.codehaus.jettison.json.JSONException - Specified by:
getLinkedDataJsonInternalin classAbstractLinkedDataGenerator- Throws:
org.codehaus.jettison.json.JSONException
-
getProduct
-
addProductData
protected org.codehaus.jettison.json.JSONObject addProductData(jakarta.servlet.http.HttpServletRequest request, Product product, String url) throws org.codehaus.jettison.json.JSONException - Throws:
org.codehaus.jettison.json.JSONException
-
addImageUrl
protected void addImageUrl(Product product, org.codehaus.jettison.json.JSONObject productData) throws org.codehaus.jettison.json.JSONException - Throws:
org.codehaus.jettison.json.JSONException
-
getImageUrlPrefix
-
getAssetServerUrlPrefix
-
addSkus
protected void addSkus(jakarta.servlet.http.HttpServletRequest request, Product product, org.codehaus.jettison.json.JSONObject productData, String url) throws org.codehaus.jettison.json.JSONException - Throws:
org.codehaus.jettison.json.JSONException
-
determineAvailability
-
addReviewData
protected void addReviewData(jakarta.servlet.http.HttpServletRequest request, Product product, org.codehaus.jettison.json.JSONObject productData) throws org.codehaus.jettison.json.JSONException - Throws:
org.codehaus.jettison.json.JSONException
-