CampaignJsonLoader

public class CampaignJsonLoader

This class is responsible for loading the message campaigns from resource files.

Constructors

CampaignJsonLoader

public CampaignJsonLoader()

CampaignJsonLoader

public CampaignJsonLoader(MotechJsonReader motechJsonReader)

Methods

getMessageCampaignsJsonFile

public String getMessageCampaignsJsonFile()

loadAfterInit

public void loadAfterInit()

Loads and saves the message campaigns from the default location, provided the campaign if the given name does not exist yet.

loadCampaigns

public List<CampaignRecord> loadCampaigns(String filename)

Loads message campaigns from the file of the given name.

Parameters:
  • filename – the name of the file to load the campaigns from
Returns:

a list of loaded campaigns

loadCampaigns

public List<CampaignRecord> loadCampaigns(InputStream in)

Loads message campaigns from the given input stream.

Parameters:
  • in – the input stream to load the campaigns from
Returns:

a list of loaded campaigns

loadSingleCampaign

public CampaignRecord loadSingleCampaign(InputStream in)

Loads single message campaign definition from the given input stream.

Parameters:
  • in – the input stream to load the campaign from
Returns:

a loaded campaign

loadSingleCampaign

public CampaignRecord loadSingleCampaign(String filename)

Loads single message campaign definition from the file of the given name.

Parameters:
  • filename – the name of the file to load the campaigns from
Returns:

a loaded campaign

setAllMessageCampaigns

public void setAllMessageCampaigns(CampaignRecordService campaignRecordService)

setMessageCampaignsJsonFile

public void setMessageCampaignsJsonFile(String messageCampaignsJsonFile)

setSettings

public void setSettings(SettingsFacade settings)