Class SendGAEventsEngine
- java.lang.Object
-
- org.ametys.plugins.newsletter.workflow.SendGAEventsEngine
-
- All Implemented Interfaces:
Runnable
public class SendGAEventsEngine extends Object implements Runnable
Send a google analytics event for every newsletter e-mail sent.
-
-
Field Summary
Fields Modifier and Type Field Description private Category_categoryprotected CategoryProviderExtensionPoint_categoryProviderEPThe category provider extension point.protected Context_contextThe avalon context.protected Context_environmentContextThe cocoon environment context.private int_eventCountprotected GAUriBuilder_gaUriBuilderThe google analytics URI builder.protected I18nUtils_i18nUtilsThe i18n utils component.protected boolean_initializedIs the engine initialized ?private static org.slf4j.Logger_LOGGERprotected ServiceManager_managerThe service manager.private LocalDate_newsletterDateprivate long_newsletterNumberprivate String_newsletterTitleprivate boolean_parametrizedprivate Site_siteprotected SiteManager_siteManagerThe site Manager.
-
Constructor Summary
Constructors Constructor Description SendGAEventsEngine()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void_checkInitialization()protected StringcomputeEventIdentifier()Compute the event identifier for the newsletter sending.protected voidconsumeQuietly(InputStream input)Consume a stream, reading all its data and ignoring errors.voidinitialize(ServiceManager manager, Context context)Initialize the engine.voidparametrize(String siteName, WebContent newsletterContent, Category category, int eventCount)Parameterize enginevoidrun()protected voidsendEvent(String eventUrl)Send the event request, given the full GIF URL.protected voidsendEvents(String gaWebId)Send GA events for a given GA user account.
-
-
-
Field Detail
-
_LOGGER
private static final org.slf4j.Logger _LOGGER
-
_environmentContext
protected Context _environmentContext
The cocoon environment context.
-
_manager
protected ServiceManager _manager
The service manager.
-
_initialized
protected boolean _initialized
Is the engine initialized ?
-
_gaUriBuilder
protected GAUriBuilder _gaUriBuilder
The google analytics URI builder.
-
_categoryProviderEP
protected CategoryProviderExtensionPoint _categoryProviderEP
The category provider extension point.
-
_siteManager
protected SiteManager _siteManager
The site Manager.
-
_i18nUtils
protected I18nUtils _i18nUtils
The i18n utils component.
-
_parametrized
private boolean _parametrized
-
_newsletterDate
private LocalDate _newsletterDate
-
_newsletterNumber
private long _newsletterNumber
-
_newsletterTitle
private String _newsletterTitle
-
_eventCount
private int _eventCount
-
-
Constructor Detail
-
SendGAEventsEngine
public SendGAEventsEngine()
-
-
Method Detail
-
initialize
public void initialize(ServiceManager manager, Context context) throws ContextException, ServiceException
Initialize the engine.- Parameters:
manager- the avalon service manager.context- the avalon context.- Throws:
ContextException- if an error occurred during initializationServiceException- if an error occurred during initialization
-
parametrize
public void parametrize(String siteName, WebContent newsletterContent, Category category, int eventCount)
Parameterize engine- Parameters:
siteName- The site namenewsletterContent- the newsletter contentcategory- the newsletter categoryeventCount- the number of events
-
_checkInitialization
private void _checkInitialization()
-
sendEvents
protected void sendEvents(String gaWebId)
Send GA events for a given GA user account.- Parameters:
gaWebId- the google web ID.
-
sendEvent
protected void sendEvent(String eventUrl) throws IOException
Send the event request, given the full GIF URL.- Parameters:
eventUrl- the full event GIF URL (with parameters).- Throws:
IOException- if an error occurs sending the GIF HTTP request.
-
computeEventIdentifier
protected String computeEventIdentifier()
Compute the event identifier for the newsletter sending.- Returns:
- the event identifier.
-
consumeQuietly
protected void consumeQuietly(InputStream input)
Consume a stream, reading all its data and ignoring errors.- Parameters:
input- the input stream to consume.
-
-