Class HomepageLinkedDataGeneratorImpl
java.lang.Object
org.broadleafcommerce.core.web.linkeddata.generator.AbstractLinkedDataGenerator
org.broadleafcommerce.core.web.linkeddata.generator.HomepageLinkedDataGeneratorImpl
- All Implemented Interfaces:
LinkedDataGenerator
@Service("blHomepageLinkedDataGenerator")
public class HomepageLinkedDataGeneratorImpl
extends AbstractLinkedDataGenerator
This generator generates structured data specific for a homepage, namely the search action. The search action allows
search engines to recognize the site has a search feature and allows users to search the site directly from the
search engine.
See http://schema.org/Organization, http://schema.org/ContactPoint, http://schema.org/WebSite, and http://schema.org/SearchAction
- Author:
- Jacob Mitash, Nathan Moore (nathanmoore).
-
Field Summary
Fields 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 org.codehaus.jettison.json.JSONArrayaddContactData(jakarta.servlet.http.HttpServletRequest request) protected org.codehaus.jettison.json.JSONObjectaddOrganizationData(jakarta.servlet.http.HttpServletRequest request) Generates an object representing the Schema.org organizationprotected org.codehaus.jettison.json.JSONObjectaddPotentialActions(jakarta.servlet.http.HttpServletRequest request) protected org.codehaus.jettison.json.JSONArrayaddSocialMediaData(jakarta.servlet.http.HttpServletRequest request) Generates a JSON array of the organization's social media sitesprotected org.codehaus.jettison.json.JSONObjectaddWebSiteData(jakarta.servlet.http.HttpServletRequest request) Generates an object representing the Schema.org WebSitebooleancanHandle(jakarta.servlet.http.HttpServletRequest request) Determines whether or not this LinkedDataGenerator can handle the incoming request.protected org.codehaus.jettison.json.JSONArraygetLinkedDataJsonInternal(String url, jakarta.servlet.http.HttpServletRequest request, org.codehaus.jettison.json.JSONArray schemaObjects) protected StringGenerates an object representing the Schema.org image for the site logoprotected Stringprotected Stringprotected Stringprotected Stringprotected Stringprotected booleanprotected booleanMethods inherited from class org.broadleafcommerce.core.web.linkeddata.generator.AbstractLinkedDataGenerator
getLinkedDataJSON, getRequestParams, getRequestUri, getSiteBaseUrl, getStructuredDataContext
-
Constructor Details
-
HomepageLinkedDataGeneratorImpl
public HomepageLinkedDataGeneratorImpl()
-
-
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
-
addOrganizationData
protected org.codehaus.jettison.json.JSONObject addOrganizationData(jakarta.servlet.http.HttpServletRequest request) throws org.codehaus.jettison.json.JSONException Generates an object representing the Schema.org organization- Returns:
- JSON representation of Organization from Schema.org
- Throws:
org.codehaus.jettison.json.JSONException
-
addContactData
protected org.codehaus.jettison.json.JSONArray addContactData(jakarta.servlet.http.HttpServletRequest request) throws org.codehaus.jettison.json.JSONException - Throws:
org.codehaus.jettison.json.JSONException
-
addWebSiteData
protected org.codehaus.jettison.json.JSONObject addWebSiteData(jakarta.servlet.http.HttpServletRequest request) throws org.codehaus.jettison.json.JSONException Generates an object representing the Schema.org WebSite- Returns:
- JSON representation of WebSite from Schema.org
- Throws:
org.codehaus.jettison.json.JSONException
-
getLogoUrl
Generates an object representing the Schema.org image for the site logo- Returns:
- JSON representation of Schema.org image for site logo
- Throws:
org.codehaus.jettison.json.JSONException
-
addSocialMediaData
protected org.codehaus.jettison.json.JSONArray addSocialMediaData(jakarta.servlet.http.HttpServletRequest request) throws org.codehaus.jettison.json.JSONException Generates a JSON array of the organization's social media sites- Throws:
org.codehaus.jettison.json.JSONException
-
addPotentialActions
protected org.codehaus.jettison.json.JSONObject addPotentialActions(jakarta.servlet.http.HttpServletRequest request) throws org.codehaus.jettison.json.JSONException - Throws:
org.codehaus.jettison.json.JSONException
-
siteHasCustomerServiceNumber
protected boolean siteHasCustomerServiceNumber() -
siteHasSocialLinks
protected boolean siteHasSocialLinks() -
getSiteLogo
-
getSiteCustomerServiceNumber
-
getSiteSocialAccounts
-
getSiteSearchUri
-
getSiteName
-