001    /*
002     * Copyright (c) 2009 The openGion Project.
003     *
004     * Licensed under the Apache License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     *     http://www.apache.org/licenses/LICENSE-2.0
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
013     * either express or implied. See the License for the specific language
014     * governing permissions and limitations under the License.
015     */
016    package org.opengion.hayabusa.taglib;
017    
018    import org.opengion.hayabusa.common.HybsSystem;
019    import org.opengion.hayabusa.common.HybsSystemException;
020    import org.opengion.hayabusa.resource.LDAPSearch;
021    import org.opengion.fukurou.mail.MailTX;
022    import org.opengion.fukurou.util.StringUtil;
023    
024    import static org.opengion.fukurou.util.StringUtil.nval ;
025    
026    import java.util.List;
027    import java.io.ObjectOutputStream;
028    import java.io.ObjectInputStream;
029    import java.io.IOException;
030    
031    /**
032     * メールをé?ä¿¡ã™ã‚‹ãŸã‚ã®ç°¡æ˜“ã‚¿ã‚°ã§ã™ã?
033     *
034     * Body 部ã«ã€ãƒ¡ãƒ?‚»ãƒ¼ã‚¸ã‚’記述ã—ã¾ã™ã?
035     *
036     * @og.formSample
037     * â—å½¢å¼ï¼?lt;og:mailSender from="…" to="…" subject="?¥?¥?¥"/>
038     * â—body?šã‚ã‚?EVAL_BODY_BUFFERED:BODYを評価ã—ã?{@XXXX} ã‚’è§£æžã—ã¾ã?
039     *
040     * â—Tag定義??
041     *   <og:mailSender
042     *       subject            ã€TAG】タイトルを指定ã—ã¾ã?
043     *       from               ã€TAG】é?ä¿¡å…??¦?²?¯?­)アドレスを指定ã—ã¾ã?
044     *       to                 ã€TAG】é?ä¿¡å…??´?¯)アドレスをCSVå½¢å¼ã§æŒ?®šã—ã¾ã?
045     *       cc                 ã€TAG】é?ä¿¡å…??£?£)アドレスをCSVå½¢å¼ã§æŒ?®šã—ã¾ã?
046     *       bcc                ã€TAG】é?ä¿¡å…??¢?£?£)アドレスをCSVå½¢å¼ã§æŒ?®šã—ã¾ã?
047     *       replyTo            ã€TAG】返信å…?replyTo)アドレスをCSVå½¢å¼ã§æŒ?®šã—ã¾ã?
048     *       host               ã€TAG】メールサーãƒã?を指定ã—ã¾ã?(åˆæœŸå€¤:COMMON_MAIL_SERVER[=])
049     *       charset            ã€TAG】文字エンコーãƒ?‚£ãƒ³ã‚°ã‚’指定ã—ã¾ã?(åˆæœŸå€¤:MAIL_DEFAULT_CHARSET[=ISO-2022-JP])
050     *       fileURL            ã€TAG】添付ファイルã®ã‚»ãƒ¼ãƒ–ディレクトリを指定ã—ã¾ã?(åˆæœŸå€¤:FILE_URL[=filetemp/])
051     *       filename           ã€TAG】添付ファイルåã‚’CSVå½¢å¼ã§æŒ?®šã—ã¾ã?
052     *       useLDAP            ã€TAG】メールアドレスをLDAPを利用ã—ã¦å–å¾—ã™ã‚‹ã‹ã©ã?‹[true/false]を指定ã—ã¾ã?åˆæœŸå€¤:false)
053     *       ldapKey            ã€TAG】アドレスを検索ã™ã‚‹ã‚­ãƒ¼ã‚’指定ã—ã¾ã?åˆæœŸå€¤:LDAP_MAILSEND_KEY[=uid] C社員番å·)
054     *       ldapVals           ã€TAG】LDAP検索時ã?属æ?åã‚’æŒ?®šã—ã¾ã?åˆæœŸå€¤:LDAP_MAILSEND_VALS[=cn,mail])
055     *       debug              ã€TAG】デãƒãƒƒã‚°æƒ??ã‚’å?力ã™ã‚‹ã‹ã©ã?‹[true/false]を指定ã—ã¾ã?åˆæœŸå€¤:false)
056     *   >   ... Body ...
057     *   </og:mailSender>
058     *
059     * â—使用ä¾?
060     *     <og:mailSender from="C00000" to="C99999" subject="{@SUBJECT}" >
061     *          メールå†?®¹
062     *     </og:mailSender >
063     *
064     *        charset   = キャラクタセãƒ?ƒˆ  (例:Windows-31J , ISO-2022-JP)
065     *        from      = From       é€ä¿¡å…?
066     *        to        = To         é€ä¿¡å…?è¤?•°ç™»éŒ²å¯èƒ½)
067     *        cc        = Cc         é€ä¿¡å…?è¤?•°ç™»éŒ²å¯èƒ½)
068     *        bcc       = Bcc        é€ä¿¡å…?è¤?•°ç™»éŒ²å¯èƒ½)
069     *        replyTo   = ReplyTo    返信先å?(è¤?•°ç™»éŒ²å¯èƒ½)
070     *        useLDAP   = false/true メールアドレスをLDAPを利用ã—ã¦å–å¾—ã™ã‚‹ã‹ã©ã?‹
071     *        ldapKey   = "uid"      アドレスを検索ã™ã‚‹ã‚­ãƒ¼(åˆæœŸå€¤:シスãƒ?ƒ ãƒªã‚½ãƒ¼ã‚¹ C社員番å·)
072     *        ldapVals  = "cn,mail"  LDAP検索時ã?属æ?åã?ã²ã¨ã¤ãªã‚‰ã‚¢ãƒ‰ãƒ¬ã‚¹ã€‚ï¼’ã¤ãªã‚‰åå‰ã¨ã‚¢ãƒ‰ãƒ¬ã‚¹
073     *        host      = ?³?­?´?°ã‚µãƒ¼ãƒã?å?
074     *        subject   = タイトル
075     *        fileURL   = 添付ファイルã®ã‚»ãƒ¼ãƒ–ディレクトリ
076     *        filename  = 添付ファイルå?ローカルã«ã‚»ãƒ¼ãƒ–ã•れãŸãƒ•ァイルå?(è¤?•°ç™»éŒ²å¯èƒ½)
077     *        debug     = true/false;
078     *
079     * è¤?•°ç™»éŒ²å¯èƒ½ãªå€‹æ‰€ã¯ã€ã‚«ãƒ³ãƒžåŒºåˆ?‚Šã§ã€è¤?•°ç™»éŒ²ã§ãã¾ã™ã?
080     * アドレス(from,to,cc,bcc,replyTo)ã¯ã€ã?"åç§°" <メールアドレス>ã€å½¢å¼ãŒ
081     * æŒ?®šã§ãã¾ã™ã?< 㨠> ã§å›²ã¾ã‚ŒãŸç¯?›²ãŒãƒ¡ãƒ¼ãƒ«ã‚¢ãƒ‰ãƒ¬ã‚¹ã«ãªã‚Šã¾ã™ã?
082     * åç§°ã«ã¯ã€æ¼¢å­—ãŒä½¿ç”¨ã§ãã¾ã™ã?
083     *
084     * host ã¯ã€ã‚·ã‚¹ãƒ?ƒ ãƒ‘ラメータ ã® COMMON_MAIL_SERVER 属æ?ãŒå?期å?ã§è¨­å®šã•れã¾ã™ã?
085     * charset ã¯ã€ã‚·ã‚¹ãƒ?ƒ ãƒ‘ラメータ ã® MAIL_DEFAULT_CHARSET 属æ?ãŒå?期å?ã§è¨­å®šã•れã¾ã™ã?
086     *
087     * @og.group ãã?ä»–å?åŠ?
088     *
089     * @version  4.0
090     * @author   Kazuhiko Hasegawa
091     * @since    JDK5.0,
092     */
093    public class MailSenderTag extends CommonTagSupport {
094            //* ã“ã?プログラãƒ??VERSIONæ–?­—å?を設定ã—ã¾ã™ã?       {@value} */
095            private static final String VERSION = "5.6.7.0 (2013/07/27)" ;
096    
097            private static final long serialVersionUID = 567020130727L ;
098    
099            private transient MailTX     mail     = null;
100            private String     host     = HybsSystem.sys( "COMMON_MAIL_SERVER" );
101            private String     charset  = HybsSystem.sys( "MAIL_DEFAULT_CHARSET" ); // 3.5.6.6 (2004/08/23)
102            private String     from     = null;
103            private String[]   to       = null;
104            private String[]   cc       = null;
105            private String[]   bcc      = null;
106            private String[]   replyTo  = null;
107            private String     subject  = null;
108            private String[]   filename = null;
109            private String     fileURL      = HybsSystem.sys( "FILE_URL" );
110    
111            private boolean         useLDAP = false;                                // 3.7.1.0 (2005/04/15)
112            // uid Cç¤¾å“¡ç•ªå· ã€employeeNumber 社員番å·
113    //      private String          ldapKey = "uid";                                // 3.7.1.0 (2005/04/26)
114    //      private String          ldapVals= "cn,mail";                    // 3.7.1.0 (2005/04/15)
115            private String          ldapKey = HybsSystem.sys( "LDAP_MAILSEND_KEY" );                // 5.6.7.0 (2013/07/27)
116            private String          ldapVals= HybsSystem.sys( "LDAP_MAILSEND_VALS" );               // 5.6.7.0 (2013/07/27)
117    
118            /**
119             * Taglibã®é–‹å§‹ã‚¿ã‚°ãŒè¦‹ã¤ã‹ã£ãŸã¨ãã«å‡¦ç?™ã‚?doStartTag() ã‚?オーãƒã?ライドã—ã¾ã™ã?
120             *
121             * @return      後続å?ç??æŒ?¤º( EVAL_BODY_BUFFERED )
122             */
123            @Override
124            public int doStartTag() {
125                    mail = new MailTX( host,charset );
126                    return( EVAL_BODY_BUFFERED );   // Body を評価ã™ã‚‹ã€? extends BodyTagSupport æ™?
127            }
128    
129            /**
130             * Taglibã®ã‚¿ã‚°æœ¬ä½“を処ç?™ã‚?doAfterBody() ã‚?オーãƒã?ライドã—ã¾ã™ã?
131             *
132             * @og.rev 3.1.1.0 (2003/03/28) ボディã®å†?®¹ã‚’å–å¾—ã™ã‚‹å?ç?‚’ã€CommonTagSupport ã§è¡Œã†ã€?
133             *
134             * @return      後続å?ç??æŒ?¤º(SKIP_BODY)
135             */
136            @Override
137            public int doAfterBody() {
138                    String message = getBodyString();
139    
140                    mail.setMessage( message );
141    
142                    return(SKIP_BODY);
143            }
144    
145            /**
146             * Taglibã®çµ‚äº?‚¿ã‚°ãŒè¦‹ã¤ã‹ã£ãŸã¨ãã«å‡¦ç?™ã‚?doEndTag() ã‚?オーãƒã?ライドã—ã¾ã™ã?
147             *
148             * @og.rev 3.1.1.2 (2003/04/04) Tomcat4.1 対応ã?release2() ã‚?doEndTag()ã§å‘¼ã¶ã€?
149             * @og.rev 3.7.1.0 (2005/04/15) LDAP検索 æ–°è¦è¿½åŠ?
150             *
151             * @return      後続å?ç??æŒ?¤º
152             */
153            @Override
154            public int doEndTag() {
155                    debugPrint();           // 4.0.0 (2005/02/28)
156    
157                    // 3.7.1.0 (2005/04/15) LDAP検索 æ–°è¦è¿½åŠ?
158                    if( useLDAP ) {
159                            String[] vals = StringUtil.csv2Array( ldapVals );
160    
161                            LDAPSearch serch = new LDAPSearch();
162                            serch.setAttributes( vals );
163                            serch.init();
164    
165                            from    = setLDAPAddress( serch,from    );
166                            to              = setLDAPAddress( serch,to              );
167                            cc              = setLDAPAddress( serch,cc              );
168                            bcc             = setLDAPAddress( serch,bcc             );
169                            replyTo = setLDAPAddress( serch,replyTo );
170                    }
171    
172    //              mail.setHost( host );
173                    mail.setFrom( from );
174                    mail.setTo( to );
175                    mail.setCc( cc );
176                    mail.setBcc( bcc );
177                    mail.setReplyTo( replyTo );
178                    mail.setSubject( subject );
179    //              mail.setCharset( charset );
180                    mail.setDebug( isDebug() );
181    
182                    if( filename != null && filename.length > 0 ) {
183                            String[] temp = new String[filename.length];
184                            String directory = HybsSystem.url2dir( fileURL );
185                            for( int i=0; i<temp.length; i++ ) {
186                                    temp[i] = StringUtil.urlAppend( directory, filename[i] );
187                            }
188                            mail.setFilename( temp );
189                    }
190    
191                    mail.sendmail() ;
192    
193                    return(EVAL_PAGE);
194            }
195    
196            /**
197             * タグリブオブジェクトをリリースã—ã¾ã™ã?
198             * キャãƒ?‚·ãƒ¥ã•れã¦å†åˆ©ç”¨ã•れるã?ã§ã€ãƒ•ィールドã?åˆæœŸè¨­å®šã‚’行ã„ã¾ã™ã?
199             *
200             * @og.rev 2.0.0.4 (2002/09/27) カスタãƒ?‚¿ã‚°ã® release() メソãƒ?ƒ‰ã‚’ã?追åŠ?
201             * @og.rev 3.1.1.2 (2003/04/04) Tomcat4.1 対応ã?release2() ã‚?doEndTag()ã§å‘¼ã¶ã€?
202             * @og.rev 3.7.1.0 (2005/04/15) LDAP検索 useLDAP,ldapKey,ldapVals 属æ?追åŠ?
203             * @og.rev 5.6.7.0 (2013/07/27) ldapKey,ldapValsã®å–得をリソースã«å¤‰æ›´
204             *
205             */
206            @Override
207            protected void release2() {
208                    super.release2();
209                    mail     = null;
210                    host     = HybsSystem.sys( "COMMON_MAIL_SERVER" );
211                    charset  = HybsSystem.sys( "MAIL_DEFAULT_CHARSET" );    // 3.5.6.6 (2004/08/23)
212                    from     = null;
213                    to       = null;
214                    cc       = null;
215                    bcc      = null;
216                    replyTo  = null;
217                    subject  = null;
218                    fileURL  = HybsSystem.sys( "FILE_URL" );
219                    filename = null;
220                    useLDAP  = false;                               // 3.7.1.0 (2005/04/15)
221    //              ldapKey  = "uid";                               // 3.7.1.0 (2005/04/26)
222    //              ldapVals = "cn,mail";                   // 3.7.1.0 (2005/04/15)
223                    ldapKey = HybsSystem.sys( "LDAP_MAILSEND_KEY" );                // 5.6.7.0 (2013/07/27)
224                    ldapVals= HybsSystem.sys( "LDAP_MAILSEND_VALS" );               // 5.6.7.0 (2013/07/27)
225            }
226    
227            /**
228             * LDAP を利用ã—ãŸãƒ¡ãƒ¼ãƒ«ã‚¢ãƒ‰ãƒ¬ã‚¹ã‚’設定ã—ç›´ã—ã¾ã™ã?
229             *
230             * LDAPよりã€ldapKeyをキーã«ã€ldapVals を設定å?ã¨ã—ã¦ã€èª­ã¿è¾¼ã¿ã¾ã™ã?
231             * åˆæœŸå€¤ã¯ã€ldapKeyã¯ã€uid(ユニã?クID) ldapValsã¯ã€cn,mail(åå‰ã€ãƒ¡ãƒ¼ãƒ«ã‚¢ãƒ‰ãƒ¬ã‚¹)ã¨ãªã£ã¦ã?¾ã™ã?
232             * from,to,cc,bcc,replyTo ã®è¨­å®šå?ã‚’ã?target ã«ã‚»ãƒ?ƒˆã—ã¦ã€æ¤œç´¢ã—ã¾ã™ã?
233             * 通常ã€ã“ã®ãƒ¡ã‚½ãƒ?ƒ‰ã¯ã€useLDAP=true ã®å ´åˆã«å‘¼ã³å‡ºã™ã‚ˆã?«è¨­å®šã—ã¾ã™ã?
234             * target ã?null ã‹ã?ゼロæ–?­—å?ã?メールアドレス(ã“ã“ã§ã¯ã€?#064; æ–?­—ã‚’å«ã‚?‹ã©ã?‹ã§åˆ¤å®?ã®å ´åˆã?
235             * ãã?ã¾ã¾ target ã‚’è¿”ã—ã¾ã™ã?
236             *
237             * @og.rev 3.7.1.0 (2005/04/15) LDAP検索 æ–°è¦è¿½åŠ?
238             *
239             * @param       serch   LDAPSearchオブジェク�
240             * @param       target  ldapKeyキーã«å¯¾ã™ã‚‹è¨­å®šå?
241             *
242             * @return      メールアドレス
243             * @see   #setLDAPAddress( LDAPSearch serch, String[] targets )
244             */
245            private String setLDAPAddress( final LDAPSearch serch, final String target ) {
246                    final String rtnAdrs ;
247    
248    //              if( target == null || target.length() == 0 || target.indexOf("@") > 0 ) { return target; }
249                    if( target != null && target.indexOf( '@' ) < 0 ) {
250                            List<String[]> list = serch.search( ldapKey + "=" + target );
251                            if( list.size() == 1 ) {
252                                    String[] vals = list.get(0);
253                                    if( ldapVals.indexOf(',') < 0 ) {    // 検索値ãŒï¼’ã¤ã®å ´åˆã§ãªã?
254                                            rtnAdrs = vals[0] ;             // メールアドレスã®ã¿
255                                    }
256                                    else {
257                                            rtnAdrs = vals[0] + "<" + vals[1] + ">" ; // "åå‰<aaaa@bbbb>" å½¢å¼?
258                                    }
259                            }
260                            else {
261                                    String errMsg = "LDAP検索ã®çµæžœã€ãƒ¡ãƒ¼ãƒ«ã‚¢ãƒ‰ãƒ¬ã‚¹ãŒè¦‹ã¤ã‹ã‚Šã¾ã›ã‚“ã§ã—ãŸã€?
262                                                            + "設定å?=[" + target + "] , 検索キー=[" + ldapKey + "] , 検索属æ?=["
263                                                            + ldapVals + "]" ;
264                                    throw new HybsSystemException( errMsg );
265                            }
266                    }
267                    else {
268                            rtnAdrs = target;
269                    }
270    
271                    return rtnAdrs ;
272            }
273    
274            /**
275             * LDAP を利用ã—ãŸè¤?•°ã®ãƒ¡ãƒ¼ãƒ«ã‚¢ãƒ‰ãƒ¬ã‚¹ã‚’å–å¾—ã—ã¾ã™ã?
276             *
277             * LDAPよりã€ldapKeyをキーã«ã€ldapVals を設定å?ã¨ã—ã¦ã€èª­ã¿è¾¼ã¿ã¾ã™ã?
278             * åˆæœŸå€¤ã¯ã€ldapKeyã¯ã€uid(ユニã?クID) ldapValsã¯ã€cn,mail(åå‰ã€ãƒ¡ãƒ¼ãƒ«ã‚¢ãƒ‰ãƒ¬ã‚¹)ã¨ãªã£ã¦ã?¾ã™ã?
279             * from,to,cc,bcc,replyTo ã®è¨­å®šå?ã‚’ã?target ã«ã‚»ãƒ?ƒˆã—ã¦ã€æ¤œç´¢ã—ã¾ã™ã?
280             * 通常ã€ã“ã®ãƒ¡ã‚½ãƒ?ƒ‰ã¯ã€useLDAP=true ã®å ´åˆã«å‘¼ã³å‡ºã™ã‚ˆã?«è¨­å®šã—ã¾ã™ã?
281             * target ãŒãƒ¡ãƒ¼ãƒ«ã‚¢ãƒ‰ãƒ¬ã‚¹ã®å ´åˆã?(ã“ã“ã§ã¯ã€?#064; æ–?­—ã‚’å«ã‚?‹ã©ã?‹ã§åˆ¤å®?ãã?ã¾ã¾è¿”ã—ã¾ã™ã?
282             *
283             * @og.rev 3.7.1.0 (2005/04/26) LDAP検索 æ–°è¦è¿½åŠ?
284             *
285             * @param       serch   LDAPSearchオブジェク�
286             * @param       targets ldapKeyキーã«å¯¾ã™ã‚‹è¨­å®šå?ã®é…å?
287             *
288             * @return      è¤?•°ã®ãƒ¡ãƒ¼ãƒ«ã‚¢ãƒ‰ãƒ¬ã‚¹(é…å?)
289             * @see   #setLDAPAddress( LDAPSearch serch, String target )
290             */
291            private String[] setLDAPAddress( final LDAPSearch serch, final String[] targets ) {
292                    if( targets == null || targets.length == 0 ) { return targets; }
293    
294                    String[] rtn = new String[targets.length];
295    
296                    for( int i=0; i<targets.length; i++ ) {
297                            rtn[i] = setLDAPAddress( serch,targets[i] );
298                    }
299                    return rtn ;
300            }
301    
302            /**
303             * ã€TAG】é?ä¿¡å…??¦?²?¯?­)アドレスを指定ã—ã¾ã™ã?
304             *
305             * @og.tag é€ä¿¡å…??¦?²?¯?­)アドレスを指定ã—ã¾ã™ã?
306             *
307             * @param   fromAdrs é€ä¿¡å…??¦?²?¯?­)アドレス
308             */
309            public void setFrom( final String fromAdrs ) {
310                    from = nval( getRequestParameter( fromAdrs ), from );
311            }
312    
313            /**
314             * ã€TAG】é?ä¿¡å…??´?¯)アドレスをCSVå½¢å¼ã§æŒ?®šã—ã¾ã™ã?
315             *
316             * @og.tag
317             * è¤?•°ã‚¢ãƒ‰ãƒ¬ã‚¹ã‚’カンマ区åˆ?‚Šã§ã‚»ãƒ?ƒˆã§ãã¾ã™ã?
318             *
319             * @og.rev 3.5.6.2 (2004/07/05) å…ˆã«é…å?ã«åˆ?§£ã—ã¦ã‹ã‚‰ãƒªã‚¯ã‚¨ã‚¹ãƒˆå¤‰æ•°ã®å€¤ã‚’å–å¾?
320             * @og.rev 3.5.6.4 (2004/07/16) å…ˆã«ãƒªã‚¯ã‚¨ã‚¹ãƒˆå¤‰æ•°ã®å€¤ã‚’å–å¾—ã—ã¦ã‹ã‚‰é…å?ã«åˆ?§£
321             *
322             * @param   toAdrs é€ä¿¡å…??´?¯)アドレス(CSVå½¢å¼?
323             */
324            public void setTo( final String toAdrs ) {
325                    to = StringUtil.csv2ArrayOnly( getRequestParameter( toAdrs ) );
326            }
327    
328            /**
329             * ã€TAG】é?ä¿¡å…??£?£)アドレスをCSVå½¢å¼ã§æŒ?®šã—ã¾ã™ã?
330             *
331             * @og.tag
332             * è¤?•°ã‚¢ãƒ‰ãƒ¬ã‚¹ã‚’カンマ区åˆ?‚Šã§ã‚»ãƒ?ƒˆã§ãã¾ã™ã?
333             *
334             * @og.rev 3.5.6.2 (2004/07/05) å…ˆã«é…å?ã«åˆ?§£ã—ã¦ã‹ã‚‰ãƒªã‚¯ã‚¨ã‚¹ãƒˆå¤‰æ•°ã®å€¤ã‚’å–å¾?
335             * @og.rev 3.5.6.4 (2004/07/16) å…ˆã«ãƒªã‚¯ã‚¨ã‚¹ãƒˆå¤‰æ•°ã®å€¤ã‚’å–å¾—ã—ã¦ã‹ã‚‰é…å?ã«åˆ?§£
336             *
337             * @param   ccAdrs é€ä¿¡å…??£?£)アドレス(CSVå½¢å¼?
338             */
339            public void setCc( final String ccAdrs ) {
340                    cc = StringUtil.csv2ArrayOnly( getRequestParameter( ccAdrs ) );
341            }
342    
343            /**
344             * ã€TAG】é?ä¿¡å…??¢?£?£)アドレスをCSVå½¢å¼ã§æŒ?®šã—ã¾ã™ã?
345             *
346             * @og.tag
347             * è¤?•°ã‚¢ãƒ‰ãƒ¬ã‚¹ã‚’カンマ区åˆ?‚Šã§ã‚»ãƒ?ƒˆã§ãã¾ã™ã?
348             *
349             * @og.rev 3.5.6.2 (2004/07/05) å…ˆã«é…å?ã«åˆ?§£ã—ã¦ã‹ã‚‰ãƒªã‚¯ã‚¨ã‚¹ãƒˆå¤‰æ•°ã®å€¤ã‚’å–å¾?
350             * @og.rev 3.5.6.4 (2004/07/16) å…ˆã«ãƒªã‚¯ã‚¨ã‚¹ãƒˆå¤‰æ•°ã®å€¤ã‚’å–å¾—ã—ã¦ã‹ã‚‰é…å?ã«åˆ?§£
351             *
352             * @param   bccAdrs é€ä¿¡å…??¢?£?£)アドレス(CSVå½¢å¼?
353             */
354            public void setBcc( final String bccAdrs ) {
355                    bcc = StringUtil.csv2ArrayOnly( getRequestParameter( bccAdrs ) );
356            }
357    
358            /**
359             * ã€TAG】返信å…?replyTo)アドレスをCSVå½¢å¼ã§æŒ?®šã—ã¾ã™ã?
360             *
361             * @og.tag
362             * è¤?•°ã‚¢ãƒ‰ãƒ¬ã‚¹ã‚’カンマ区åˆ?‚Šã§ã‚»ãƒ?ƒˆã§ãã¾ã™ã?
363             *
364             * @og.rev 3.5.6.6 (2004/08/23) æ–°è¦è¿½åŠ?
365             *
366             * @param   replyToAdrs 返信�replyTo)アドレス(CSV形�
367             */
368            public void setReplyTo( final String replyToAdrs ) {
369                    replyTo = StringUtil.csv2ArrayOnly( getRequestParameter( replyToAdrs ) );
370            }
371    
372            /**
373             * ã€TAG】メールサーãƒã?を指定ã—ã¾ã?
374             *              (åˆæœŸå€¤:COMMON_MAIL_SERVER[={@og.value org.opengion.hayabusa.common.SystemData#COMMON_MAIL_SERVER}])ã€?
375             *
376             * @og.tag メールサーãƒã?を指定ã—ã¾ã™ã?
377             * (åˆæœŸå€¤:シスãƒ?ƒ å®šæ•°ã®COMMON_MAIL_SERVER[={@og.value org.opengion.hayabusa.common.SystemData#COMMON_MAIL_SERVER}])ã€?
378             *
379             * @og.rev 3.5.6.6 (2004/08/23) åˆæœŸå€¤ã‚’è?æ…®ã™ã‚‹ã‚ˆã†ã«å¤‰æ›´ã€?
380             *
381             * @param   hst メールサーãƒã?
382             * @see         org.opengion.hayabusa.common.SystemData#COMMON_MAIL_SERVER
383             */
384            public void setHost( final String hst ) {
385                    host = nval( getRequestParameter( hst ),host );
386            }
387    
388            /**
389             * ã€TAG】タイトルを指定ã—ã¾ã™ã?
390             *
391             * @og.tag タイトルを指定ã—ã¾ã™ã?
392             *
393             * @param   subjct タイトル
394             */
395            public void setSubject( final String subjct ) {
396                    this.subject = getRequestParameter( subjct );
397            }
398    
399            /**
400             * ã€TAG】添付ファイルåã‚’CSVå½¢å¼ã§æŒ?®šã—ã¾ã™ã?
401             *
402             * @og.tag
403             * è¤?•°ãƒ•ァイルをセãƒ?ƒˆã§ãã¾ã™ã?
404             * 設定方法ã?ã€ã‚«ãƒ³ãƒžã§åŒºåˆ?£ã¦ä¸¦ã¹è¤?•°æŒ?®šã§ãã¾ã™ã?
405             *
406             * @og.rev 3.5.6.6 (2004/08/23) è¤?•°ãƒ•ァイルæŒ?®šæ–¹æ³•ã‚’ã€?‡è¤?ƒªã‚¯ã‚¨ã‚¹ãƒˆã‹ã‚‰ã‚«ãƒ³ãƒžåŒºåˆ?‚Šã«å¤‰æ›´
407             *
408             * @param   fname 添付ファイルå?CSVå½¢å¼?
409             */
410            public void setFilename( final String fname ) {
411                    filename = StringUtil.csv2ArrayOnly( getRequestParameter( fname ) );
412            }
413    
414            /**
415             * ã€TAG】文字エンコーãƒ?‚£ãƒ³ã‚°ã‚’指定ã—ã¾ã?
416             *              (åˆæœŸå€¤:MAIL_DEFAULT_CHARSET[={@og.value org.opengion.hayabusa.common.SystemData#MAIL_DEFAULT_CHARSET}])ã€?
417             *
418             * @og.tag
419             * æ–?­—エンコーãƒ?‚£ãƒ³ã‚°ã¯ã€ãƒ¡ãƒ¼ãƒ«æœ¬æ–?«å¯¾ã™ã‚‹ã‚¨ãƒ³ã‚³ãƒ¼ãƒ?‚£ãƒ³ã‚°æŒ?®šã§ã™ã?
420             * ã“れã¯ã€Windows-31J ã€MS932ã€Shift_JIS ã®ã©ã‚Œã‹ãŒæŒ‡å®šã•れãŸå ´åˆã?
421             * 『指定ã?æ–?­—コーãƒ?+ 8bit é€ä¿¡ã€ã—ã¾ã™ã?
422             * ãれ以外ã?æŒ?®šã?ã€ã?ISO-2022-JP ã«ç‹¬è‡ªå¤‰æ› + 7bit é€ä¿¡ã€ã«ãªã‚Šã¾ã™ã?
423             * (åˆæœŸå€¤:シスãƒ?ƒ å®šæ•°ã®MAIL_DEFAULT_CHARSET[={@og.value org.opengion.hayabusa.common.SystemData#MAIL_DEFAULT_CHARSET}])ã€?
424             *
425             * @param   chset æ–?­—エンコーãƒ?‚£ãƒ³ã‚°
426             * @see         org.opengion.hayabusa.common.SystemData#MAIL_DEFAULT_CHARSET
427             */
428            public void setCharset( final String chset ) {
429                    charset = nval( getRequestParameter( chset ),charset );
430            }
431    
432            /**
433             * ã€TAG】添付ファイルã®ã‚»ãƒ¼ãƒ–ディレクトリを指定ã—ã¾ã?
434             *              (åˆæœŸå€¤:FILE_URL[={@og.value org.opengion.hayabusa.common.SystemData#FILE_URL}])ã€?
435             *
436             * @og.tag
437             * ã“ã?属æ?ã§æŒ?®šã•れるãƒ?‚£ãƒ¬ã‚¯ãƒˆãƒªã«ã€æ·»ä»˜ãƒ•ァイルãŒå­˜åœ¨ã™ã‚‹ã¨ä»®å®šã—ã¾ã™ã?
438             * æŒ?®šæ–¹æ³•ã?ã€??常㮠fileURL 属æ?ã¨åŒæ§˜ã«ã€å?é ­ãŒã?'/' (UNIX) ã¾ãŸã?ã€?¼’文字目ãŒã?
439             * ":" (Windows)ã®å ´åˆã?ã€æŒ‡å®šã?URLãã?ã¾ã¾ã®ãƒ?‚£ãƒ¬ã‚¯ãƒˆãƒªã«ã€ãã?§ãªã??åˆã?ã€?
440             * fileURL = "{&#064;USER.ID}" ã¨æŒ?®šã™ã‚‹ã¨ã€FILE_URL 属æ?ã§æŒ?®šã?フォルãƒ??下ã«ã€?
441             * ã•らã«ã€å„個人ID別ã®ãƒ•ォルãƒ?‚’作æ?ã—ã¦ã€ãã“を使用ã—ã¾ã™ã?
442             * (åˆæœŸå€¤:シスãƒ?ƒ å®šæ•°ã®FILE_URL[={@og.value org.opengion.hayabusa.common.SystemData#FILE_URL}])ã€?
443             *
444             * @og.rev 4.0.0.0 (2005/01/31) StringUtil.urlAppend メソãƒ?ƒ‰ã®åˆ©ç”¨
445             * @og.rev 4.0.0.0 (2007/11/20) æŒ?®šã•れãŸãƒ?‚£ãƒ¬ã‚¯ãƒˆãƒªåã?æœ?¾ŒãŒ"\"or"/"ã§çµ‚ã‚ã£ã¦ã?ªã??åˆã«ã€?/"を付加ã™ã‚‹ã€?
446             *
447             * @param       url 添付ファイルã®ã‚»ãƒ¼ãƒ–ディレクトリ
448             * @see         org.opengion.hayabusa.common.SystemData#FILE_URL
449             */
450            public void setFileURL( final String url ) {
451                    String furl = nval( getRequestParameter( url ),null );
452                    if( furl != null ) {
453                            char ch = furl.charAt( furl.length()-1 );
454                            if( ch != '/' && ch != '\\' ) { furl = furl + "/"; }
455                            fileURL = StringUtil.urlAppend( fileURL,furl );
456                    }
457            }
458    
459            /**
460             * ã€TAG】メールアドレスをLDAPを利用ã—ã¦å–å¾—ã™ã‚‹ã‹ã©ã?‹[true/false]を指定ã—ã¾ã?åˆæœŸå€¤:false)ã€?
461             *
462             * @og.tag
463             * LDAP ã®ãƒ¡ãƒ¼ãƒ«ã‚¢ãƒ‰ãƒ¬ã‚¹ã‚’å–å¾—ã™ã‚‹å?åˆã?ã€true ã‚’ã‚»ãƒ?ƒˆã—ã¾ã™ã?false ã®å ´åˆã?ã€?
464             * from,to,cc,bcc,replyTo ã®è¨­å®šå?ãŒãã®ã¾ã¾ä½¿ç”¨ã•れã¾ã™ã?
465             * 上記アドレスã«ã€?#064; ã‚’å«ã‚??åˆã?ã€LDAP を検索ã›ãšã€ãƒ¡ãƒ¼ãƒ«ã‚¢ãƒ‰ãƒ¬ã‚¹ã¨ã—ã¦
466             * ãã?ã¾ã¾ä½¿ç”¨ã—ã¾ã™ã?LDAP ã®æ¤œç´¢çµæžœãŒå­˜åœ¨ã—ãªã??åˆã?ã€ä¸æ­£ãªã‚¢ãƒ‰ãƒ¬ã‚¹ã¨ã—ã¦ã€?
467             * エラーã¨ã—ã¾ã™ã?
468             * åˆæœŸå€¤ã¯ã€false ã§ã™ã?
469             *
470             * @og.rev 3.7.1.0 (2005/04/15) LDAP検索 æ–°è¦è¿½åŠ?
471             *
472             * @param   useLDAP メールアドレスをLDAPを利用ã—ã¦å–å¾—ã™ã‚‹ã‹ã©ã?‹ [true:å–å¾—ã™ã‚?false:å–å¾—ã—ãªã„]
473             */
474            public void setUseLDAP( final String useLDAP ) {
475                    this.useLDAP = nval( getRequestParameter( useLDAP ),this.useLDAP );
476            }
477    
478            /**
479             * ã€TAG】アドレスを検索ã™ã‚‹ã‚­ãƒ¼ã‚’指定ã—ã¾ã?åˆæœŸå€¤:uid C社員番å·)ã€?
480             *
481             * @og.tag
482             * LDAP ã®ãƒ¡ãƒ¼ãƒ«ã‚¢ãƒ‰ãƒ¬ã‚¹ã‚’å–å¾—ã™ã‚‹å?åˆã?ã€æ¤œç´¢ã™ã‚‹ã‚­ãƒ¼ã‚’指定ã—ã¾ã™ã?
483             * from,to,cc,bcc,replyTo ã®è¨­å®šå?ã‚’ã?ã“ã?キーã«ã‚»ãƒ?ƒˆã—ã¦ã€æ¤œç´¢ã—ã¾ã™ã?
484             * uid Cç¤¾å“¡ç•ªå· ã€employeeNumber ç¤¾å“¡ç•ªå· ãªã©ãŒè?ãˆã‚‰ã‚Œã¾ã™ã?
485             * åˆæœŸå€¤ã¯ã€uid(C社員番å·)ã§ã™ã?
486             * ã“ã?キーã§è¤?•°ã®æ¤œç´¢çµæžœãŒå¾—られãŸå ´åˆã?ã€ã‚¨ãƒ©ãƒ¼ã¨ã—ã¾ã™ã?
487             *
488             * @og.rev 3.7.1.0 (2005/04/15) LDAP検索 æ–°è¦è¿½åŠ?
489             *
490             * @param   ldapKey アドレスを検索ã™ã‚‹ã‚­ãƒ¼
491             */
492            public void setLdapKey( final String ldapKey ) {
493                    this.ldapKey = nval( getRequestParameter( ldapKey ),this.ldapKey );
494            }
495    
496            /**
497             * ã€TAG】LDAP検索時ã?属æ?åã‚’æŒ?®šã—ã¾ã?åˆæœŸå€¤:cn,mail)ã€?
498             *
499             * @og.tag
500             * LDAPを検索ã™ã‚‹å ´åˆã?"æ‹?½“è?å?<メールアドレス>å½¢å¼ã?メールアドレスを作æ?ã™ã‚‹
501             * å ´åˆã?検索ã™ã‚‹å±žæ?値を指定ã—ã¾ã™ã?
502             * ã²ã¨ã¤ãªã‚‰ã‚¢ãƒ‰ãƒ¬ã‚¹ã€‚ï¼’ã¤ãªã‚‰åå‰ã¨ã‚¢ãƒ‰ãƒ¬ã‚¹ã®é ?§æŒ?®šã•れãŸã¨èªè­˜ã—ã¾ã™ã?
503             *
504             * @og.rev 3.7.1.0 (2005/04/15) LDAP検索 æ–°è¦è¿½åŠ?
505             *
506             * @param   ldapVals LDAP検索時ã?属æ?å?
507             */
508            public void setLdapVals( final String ldapVals ) {
509                    this.ldapVals = nval( getRequestParameter( ldapVals ),this.ldapVals );
510            }
511    
512            /**
513             * シリアライズ用ã®ã‚«ã‚¹ã‚¿ãƒ?‚·ãƒªã‚¢ãƒ©ã‚¤ã‚ºæ›¸ãè¾¼ã¿ãƒ¡ã‚½ãƒ?ƒ‰
514             *
515             * @og.rev 4.0.0.0 (2006/09/31) æ–°è¦è¿½åŠ?
516             * @serialData
517             *
518             * @param       strm    ObjectOutputStreamオブジェク�
519             */
520            private void writeObject( final ObjectOutputStream strm ) throws IOException {
521                    strm.defaultWriteObject();
522            }
523    
524            /**
525             * シリアライズ用ã®ã‚«ã‚¹ã‚¿ãƒ?‚·ãƒªã‚¢ãƒ©ã‚¤ã‚ºèª­ã¿è¾¼ã¿ãƒ¡ã‚½ãƒ?ƒ‰
526             *
527             * ã“ã“ã§ã¯ã€transient 宣è¨?•れãŸå†?ƒ¨å¤‰æ•°ã®å†??åˆæœŸåŒ–ãŒå¿?¦ãªãƒ•ィールドã?ã¿è¨­å®šã—ã¾ã™ã?
528             *
529             * @og.rev 4.0.0.0 (2006/09/31) æ–°è¦è¿½åŠ?
530             * @serialData
531             *
532             * @param       strm    ObjectInputStreamオブジェク�
533             * @see #release2()
534             */
535            private void readObject( final ObjectInputStream strm ) throws IOException , ClassNotFoundException {
536                    strm.defaultReadObject();
537            }
538    
539            /**
540             * ã“ã?オブジェクトã?æ–?­—å?表ç¾ã‚’è¿”ã—ã¾ã™ã?
541             * 基本çš?«ãƒ?ƒãƒ?‚°ç›®çš?«ä½¿ç”¨ã—ã¾ã™ã?
542             *
543             * @return ã“ã?ã‚¯ãƒ©ã‚¹ã®æ–?­—å?表ç¾
544             */
545            @Override
546            public String toString() {
547                    return org.opengion.fukurou.util.ToString.title( this.getClass().getName() )
548                                    .println( "VERSION"             ,VERSION        )
549                                    .println( "host"                ,host           )
550                                    .println( "charset"             ,charset        )
551                                    .println( "from"                ,from           )
552                                    .println( "to"                  ,to                     )
553                                    .println( "cc"                  ,cc                     )
554                                    .println( "bcc"                 ,bcc            )
555                                    .println( "replyTo"             ,replyTo        )
556                                    .println( "subject"             ,subject        )
557                                    .println( "filename"    ,filename       )
558                                    .println( "fileURL"     ,fileURL        )
559                                    .println( "useLDAP"             ,useLDAP        )
560                                    .println( "ldapKey"             ,ldapKey        )
561                                    .println( "ldapVals"    ,ldapVals       )
562                                    .println( "Other..."    ,getAttributes().getAttribute() )
563                                    .fixForm().toString() ;
564            }
565    }