View Javadoc
1   /*
2    * Copyright 2012-2025 CodeLibs Project and the Others.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13   * either express or implied. See the License for the specific language
14   * governing permissions and limitations under the License.
15   */
16  package org.codelibs.fess.mylasta.mail;
17  
18  import org.lastaflute.core.mail.LaTypicalPostcard;
19  import org.lastaflute.core.mail.MPCall;
20  import org.lastaflute.core.mail.Postbox;
21  
22  /**
23   * The postcard for MailFlute on LastaFlute.
24   * @author FreeGen
25   */
26  public class LogNotificationPostcard extends LaTypicalPostcard {
27  
28      // ===================================================================================
29      //                                                                          Definition
30      //                                                                          ==========
31      public static final String PATH = "log_notification.dfmail";
32  
33      // ===================================================================================
34      //                                                                         Entry Point
35      //                                                                         ===========
36      public static LogNotificationPostcard droppedInto(Postbox postbox, MPCall<LogNotificationPostcard> postcardLambda) {
37          LogNotificationPostcard postcard = new LogNotificationPostcard();
38          postcardLambda.write(postcard);
39          postbox.post(postcard);
40          return postcard;
41      }
42  
43      // ===================================================================================
44      //                                                                           Meta Data
45      //                                                                           =========
46      @Override
47      protected String getBodyFile() {
48          return PATH;
49      }
50  
51      @Override
52      protected String[] getPropertyNames() {
53          return new String[] { "level", "hostname", "count", "interval", "details" };
54      }
55  
56      // ===================================================================================
57      //                                                                    Postcard Request
58      //                                                                    ================
59      // -----------------------------------------------------
60      //                                          Mail Address
61      //                                          ------------
62      public void setFrom(String from, String personal) {
63          doSetFrom(from, personal);
64      }
65  
66      public void addTo(String to) {
67          doAddTo(to);
68      }
69  
70      public void addTo(String to, String personal) {
71          doAddTo(to, personal);
72      }
73  
74      public void addCc(String cc) {
75          doAddCc(cc);
76      }
77  
78      public void addCc(String cc, String personal) {
79          doAddCc(cc, personal);
80      }
81  
82      public void addBcc(String bcc) {
83          doAddBcc(bcc);
84      }
85  
86      public void addBcc(String bcc, String personal) {
87          doAddBcc(bcc, personal);
88      }
89  
90      public void addReplyTo(String replyTo) {
91          doAddReplyTo(replyTo);
92      }
93  
94      public void addReplyTo(String replyTo, String personal) {
95          doAddReplyTo(replyTo, personal);
96      }
97  
98      // -----------------------------------------------------
99      //                                  Application Variable
100     //                                  --------------------
101     /**
102      * Set the value of level, used in parameter comment. <br>
103      * Even if empty string, treated as empty plainly. So "IF pmb != null" is false if empty.
104      * @param level The parameter value of level. (NotNull)
105      */
106     public void setLevel(String level) {
107         registerVariable("level", level);
108     }
109 
110     /**
111      * Set the value of hostname, used in parameter comment. <br>
112      * Even if empty string, treated as empty plainly. So "IF pmb != null" is false if empty.
113      * @param hostname The parameter value of hostname. (NotNull)
114      */
115     public void setHostname(String hostname) {
116         registerVariable("hostname", hostname);
117     }
118 
119     /**
120      * Set the value of count, used in parameter comment. <br>
121      * Even if empty string, treated as empty plainly. So "IF pmb != null" is false if empty.
122      * @param count The parameter value of count. (NotNull)
123      */
124     public void setCount(String count) {
125         registerVariable("count", count);
126     }
127 
128     /**
129      * Set the value of interval, used in parameter comment. <br>
130      * Even if empty string, treated as empty plainly. So "IF pmb != null" is false if empty.
131      * @param interval The parameter value of interval. (NotNull)
132      */
133     public void setInterval(String interval) {
134         registerVariable("interval", interval);
135     }
136 
137     /**
138      * Set the value of details, used in parameter comment. <br>
139      * Even if empty string, treated as empty plainly. So "IF pmb != null" is false if empty.
140      * @param details The parameter value of details. (NotNull)
141      */
142     public void setDetails(String details) {
143         registerVariable("details", details);
144     }
145 }