summaryrefslogtreecommitdiffstats
path: root/pki/base/common/src/com/netscape/cmscore/notification/EmailTemplate.java
diff options
context:
space:
mode:
authorAde Lee <alee@redhat.com>2011-12-08 21:15:59 -0500
committerAde Lee <alee@redhat.com>2011-12-08 21:15:59 -0500
commit171aaece4f23709d33d180cf36eb3af5e454b0c9 (patch)
tree1485f9f0a7bd10de4ff25030db575dbb8dafae74 /pki/base/common/src/com/netscape/cmscore/notification/EmailTemplate.java
parentadad2fcee8a29fdb82376fbce07dedb11fccc182 (diff)
downloadpki-171aaece4f23709d33d180cf36eb3af5e454b0c9.tar.gz
pki-171aaece4f23709d33d180cf36eb3af5e454b0c9.tar.xz
pki-171aaece4f23709d33d180cf36eb3af5e454b0c9.zip
Revert "Formatting"
This reverts commit 32150d3ee32f8ac27118af7c792794b538c78a2f.
Diffstat (limited to 'pki/base/common/src/com/netscape/cmscore/notification/EmailTemplate.java')
-rw-r--r--pki/base/common/src/com/netscape/cmscore/notification/EmailTemplate.java74
1 files changed, 34 insertions, 40 deletions
diff --git a/pki/base/common/src/com/netscape/cmscore/notification/EmailTemplate.java b/pki/base/common/src/com/netscape/cmscore/notification/EmailTemplate.java
index 4680940d..5c9e9ae0 100644
--- a/pki/base/common/src/com/netscape/cmscore/notification/EmailTemplate.java
+++ b/pki/base/common/src/com/netscape/cmscore/notification/EmailTemplate.java
@@ -17,6 +17,7 @@
// --- END COPYRIGHT BLOCK ---
package com.netscape.cmscore.notification;
+
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
@@ -27,21 +28,21 @@ import com.netscape.certsrv.apps.CMS;
import com.netscape.certsrv.logging.ILogger;
import com.netscape.certsrv.notification.IEmailTemplate;
+
/**
- * Files to be processed and returned to the requested parties. It is a template
- * with $tokens to be used by the form/template processor.
- *
- *
+ * Files to be processed and returned to the requested parties. It
+ * is a template with $tokens to be used by the form/template processor.
+ *
+ *
* @author cfu
* @version $Revision$, $Date$
*/
public class EmailTemplate implements IEmailTemplate {
- /*
- * ========================================================== variables
- * ==========================================================
- */
+ /*==========================================================
+ * variables
+ *==========================================================*/
/* private variables */
private String mTemplateFile = new String();
@@ -50,29 +51,27 @@ public class EmailTemplate implements IEmailTemplate {
/* public vaiables */
public String mFileContents;
- /*
- * ========================================================== constructors
- * ==========================================================
- */
+ /*==========================================================
+ * constructors
+ *==========================================================*/
/**
* Default Constructor
- *
+ *
* @param templateFile File name of the template including the full path and
- * file extension
+ * file extension
*/
public EmailTemplate(String templatePath) {
mTemplateFile = templatePath;
}
- /*
- * ========================================================== public methods
- * ==========================================================
- */
+ /*==========================================================
+ * public methods
+ *==========================================================*/
/*
* Load the template from the file
- *
+ *
* @return true if successful
*/
public boolean init() {
@@ -80,13 +79,10 @@ public class EmailTemplate implements IEmailTemplate {
File template = new File(mTemplateFile);
/* check if file exists and is accessible */
- if ((!template.exists()) || (!template.canRead())
- || (template.isDirectory())) {
- String error = "Template: " + mTemplateFile
- + " does not exist or invalid";
+ if ((!template.exists()) || (!template.canRead()) || (template.isDirectory())) {
+ String error = "Template: " + mTemplateFile + " does not exist or invalid";
- log(ILogger.LL_FAILURE,
- CMS.getLogMessage("CMSCORE_NOTIFY_TEMPLATE_NOT_EXIST"));
+ log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_NOTIFY_TEMPLATE_NOT_EXIST"));
return false;
}
@@ -98,8 +94,7 @@ public class EmailTemplate implements IEmailTemplate {
} catch (FileNotFoundException e) {
String error = "Template: " + mTemplateFile + " not found";
- log(ILogger.LL_FAILURE,
- CMS.getLogMessage("CMSCORE_NOTIFY_TEMPLATE_NOT_FOUND"));
+ log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_NOTIFY_TEMPLATE_NOT_FOUND"));
return false;
}
@@ -109,8 +104,7 @@ public class EmailTemplate implements IEmailTemplate {
if (mFileContents == null) {
String error = "Template: Error loading file into string";
- log(ILogger.LL_FAILURE,
- CMS.getLogMessage("CMSCORE_NOTIFY_TEMPLATE_LOAD_ERROR"));
+ log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_NOTIFY_TEMPLATE_LOAD_ERROR"));
return false;
}
@@ -130,13 +124,14 @@ public class EmailTemplate implements IEmailTemplate {
return mTemplateFile;
}
- /**
+ /**
* @return true if template is an html file, false otherwise
*/
public boolean isHTML() {
- if (mTemplateFile.endsWith(".html") || mTemplateFile.endsWith(".HTML")
- || mTemplateFile.endsWith(".htm")
- || mTemplateFile.endsWith(".HTM"))
+ if (mTemplateFile.endsWith(".html") ||
+ mTemplateFile.endsWith(".HTML") ||
+ mTemplateFile.endsWith(".htm") ||
+ mTemplateFile.endsWith(".HTM"))
return true;
else
return false;
@@ -149,10 +144,9 @@ public class EmailTemplate implements IEmailTemplate {
return mFileContents;
}
- /*
- * ========================================================== private
- * methods==========================================================
- */
+ /*==========================================================
+ * private methods
+ *==========================================================*/
/* load file into string */
private String loadFile(FileReader input) {
@@ -169,8 +163,7 @@ public class EmailTemplate implements IEmailTemplate {
} catch (IOException e) {
String error = "Template: Error loading file";
- log(ILogger.LL_FAILURE,
- CMS.getLogMessage("CMSCORE_NOTIFY_TEMPLATE_LOADING"));
+ log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_NOTIFY_TEMPLATE_LOADING"));
return null;
}
@@ -184,7 +177,8 @@ public class EmailTemplate implements IEmailTemplate {
private void log(int level, String msg) {
if (mLogger == null)
return;
- mLogger.log(ILogger.EV_SYSTEM, null, ILogger.S_OTHER, level, msg);
+ mLogger.log(ILogger.EV_SYSTEM, null, ILogger.S_OTHER,
+ level, msg);
}
}