@ParametersAreNonnullByDefault public class DefaultMailTemplatesService extends Object implements MailTemplatesService
Modifier and Type | Field and Description |
---|---|
protected static String |
EMAIL_BATCH_DIR |
protected static String |
EMAIL_DIR |
protected static String |
TEMP_SUFFIX |
protected static String |
TEMPLATES |
Constructor and Description |
---|
DefaultMailTemplatesService(FileStores fileStores,
GlobalPermissionManager permissionManager,
JiraAuthenticationContext authenticationContext,
I18nHelper.BeanFactory i18nFactory,
CachingJiraHomeTemplateContentLoader cachingTemplateLoader,
EmailVelocityTemplatingEngine templatingEngine,
com.atlassian.beehive.ClusterLockService clusterLockService,
TemplateValidatorService templateValidatorService,
JiraHomeTemplatesRevertService jiraHomeTemplatesRevertService,
com.atlassian.event.api.EventPublisher eventPublisher) |
Modifier and Type | Method and Description |
---|---|
ServiceOutcome<Void> |
applyEmailTemplates()
If the temporary folder with email templates is present, it will replace the production templates with temporary
ones
|
protected void |
copyInputStreamToFile(@NotNull InputStream inputStream,
@NotNull File file) |
protected void |
deleteDirectory(@NotNull File directory) |
protected void |
deleteIfExists(@NotNull Path path)
Protected methods created to isolate the static functions calls
Helps with testing
|
ServiceOutcome<File> |
getEmailTemplatesZip()
Returns a zip file of the templates folder used for single notifications email.
|
protected String |
getLocalizedErrorForLockRefused() |
protected String |
getLocalizedErrorForUpload() |
protected void |
moveDirectory(@NotNull File srcDir,
@NotNull File destDir) |
protected File |
newFile(@NotNull String pathname) |
protected File |
newJiraFile(String templatesFileName) |
protected void |
quietlyDeleteDirectory(@NotNull File directory) |
protected void |
quietlyDeleteIfExists(@NotNull Path path) |
ServiceOutcome<Void> |
revertEmailTemplatesToDefault()
Replaces all currently used templates (stored in Shared Jira Home) with default templates.
|
protected void |
unzip(File file,
File outputDir) |
ServiceOutcome<Void> |
uploadEmailTemplates(InputStream templatesStream)
Saves a stream to disk and unzips it's content to the temporary templates folder.
|
protected void |
zipFolder(File sourceFolder,
File destination) |
protected static final String TEMPLATES
protected static final String EMAIL_DIR
protected static final String EMAIL_BATCH_DIR
protected static final String TEMP_SUFFIX
public DefaultMailTemplatesService(FileStores fileStores, GlobalPermissionManager permissionManager, JiraAuthenticationContext authenticationContext, I18nHelper.BeanFactory i18nFactory, CachingJiraHomeTemplateContentLoader cachingTemplateLoader, EmailVelocityTemplatingEngine templatingEngine, com.atlassian.beehive.ClusterLockService clusterLockService, TemplateValidatorService templateValidatorService, JiraHomeTemplatesRevertService jiraHomeTemplatesRevertService, com.atlassian.event.api.EventPublisher eventPublisher)
public ServiceOutcome<Void> uploadEmailTemplates(InputStream templatesStream)
MailTemplatesService
uploadEmailTemplates
in interface MailTemplatesService
public ServiceOutcome<Void> applyEmailTemplates()
MailTemplatesService
applyEmailTemplates
in interface MailTemplatesService
public ServiceOutcome<File> getEmailTemplatesZip()
MailTemplatesService
getEmailTemplatesZip
in interface MailTemplatesService
public ServiceOutcome<Void> revertEmailTemplatesToDefault()
MailTemplatesService
revertEmailTemplatesToDefault
in interface MailTemplatesService
protected String getLocalizedErrorForUpload()
protected String getLocalizedErrorForLockRefused()
protected void deleteIfExists(@NotNull @NotNull Path path) throws IOException
IOException
protected void zipFolder(File sourceFolder, File destination) throws IOException
IOException
protected void quietlyDeleteIfExists(@NotNull @NotNull Path path)
protected void copyInputStreamToFile(@NotNull @NotNull InputStream inputStream, @NotNull @NotNull File file) throws IOException
IOException
protected void unzip(File file, File outputDir) throws IOException
IOException
protected void deleteDirectory(@NotNull @NotNull File directory) throws IOException
IOException
protected void quietlyDeleteDirectory(@NotNull @NotNull File directory)
protected void moveDirectory(@NotNull @NotNull File srcDir, @NotNull @NotNull File destDir) throws IOException
IOException
Copyright © 2002-2022 Atlassian. All Rights Reserved.