@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)
MailTemplatesServiceuploadEmailTemplates in interface MailTemplatesServicepublic ServiceOutcome<Void> applyEmailTemplates()
MailTemplatesServiceapplyEmailTemplates in interface MailTemplatesServicepublic ServiceOutcome<File> getEmailTemplatesZip()
MailTemplatesServicegetEmailTemplatesZip in interface MailTemplatesServicepublic ServiceOutcome<Void> revertEmailTemplatesToDefault()
MailTemplatesServicerevertEmailTemplatesToDefault in interface MailTemplatesServiceprotected String getLocalizedErrorForUpload()
protected String getLocalizedErrorForLockRefused()
protected void deleteIfExists(@NotNull
@NotNull Path path)
throws IOException
IOExceptionprotected void zipFolder(File sourceFolder, File destination) throws IOException
IOExceptionprotected void quietlyDeleteIfExists(@NotNull
@NotNull Path path)
protected void copyInputStreamToFile(@NotNull
@NotNull InputStream inputStream,
@NotNull
@NotNull File file)
throws IOException
IOExceptionprotected void unzip(File file, File outputDir) throws IOException
IOExceptionprotected void deleteDirectory(@NotNull
@NotNull File directory)
throws IOException
IOExceptionprotected void quietlyDeleteDirectory(@NotNull
@NotNull File directory)
protected void moveDirectory(@NotNull
@NotNull File srcDir,
@NotNull
@NotNull File destDir)
throws IOException
IOExceptionCopyright © 2002-2024 Atlassian. All Rights Reserved.