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 EsStatusPostcard extends LaTypicalPostcard {
27
28 // ===================================================================================
29 // Definition
30 // ==========
31 public static final String PATH = "es_status.dfmail";
32
33 // ===================================================================================
34 // Entry Point
35 // ===========
36 public static EsStatusPostcard droppedInto(Postbox postbox, MPCall<EsStatusPostcard> postcardLambda) {
37 EsStatusPostcard postcard = new EsStatusPostcard();
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[] { "hostname", "clustername", "clusterstatus" };
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 hostname, used in parameter comment. <br>
103 * Even if empty string, treated as empty plainly. So "IF pmb != null" is false if empty.
104 * @param hostname The parameter value of hostname. (NotNull)
105 */
106 public void setHostname(String hostname) {
107 registerVariable("hostname", hostname);
108 }
109
110 /**
111 * Set the value of clustername, used in parameter comment. <br>
112 * Even if empty string, treated as empty plainly. So "IF pmb != null" is false if empty.
113 * @param clustername The parameter value of clustername. (NotNull)
114 */
115 public void setClustername(String clustername) {
116 registerVariable("clustername", clustername);
117 }
118
119 /**
120 * Set the value of clusterstatus, used in parameter comment. <br>
121 * Even if empty string, treated as empty plainly. So "IF pmb != null" is false if empty.
122 * @param clusterstatus The parameter value of clusterstatus. (NotNull)
123 */
124 public void setClusterstatus(String clusterstatus) {
125 registerVariable("clusterstatus", clusterstatus);
126 }
127 }