
com.github.nagyesta.lowkeyvault.template.backup.BackupTemplateProcessor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lowkey-vault-app Show documentation
Show all versions of lowkey-vault-app Show documentation
Assembled application of Lowkey Vault.
package com.github.nagyesta.lowkeyvault.template.backup;
import com.github.jknack.handlebars.Handlebars;
import com.github.jknack.handlebars.Template;
import com.github.nagyesta.lowkeyvault.template.HandlebarsTemplateProcessor;
import lombok.NonNull;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.io.IOException;
@Component
public class BackupTemplateProcessor implements HandlebarsTemplateProcessor {
private final TimeHelperSource timeHelperSource;
@Autowired
public BackupTemplateProcessor(final TimeHelperSource timeHelperSource) {
this.timeHelperSource = timeHelperSource;
}
@Override
public String processTemplate(@NonNull final String templateAsString, @NonNull final BackupContext context) throws IOException {
final Handlebars handlebars = new Handlebars();
handlebars.registerHelpers(timeHelperSource);
final Template template = handlebars.compileInline(templateAsString);
return template.apply(context);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy