1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.mail.internal.thread

File PrepareMailQueueItem.java

 

Coverage histogram

../../../../../img/srcFileCovDistChart10.png
0% of files have more coverage

Code metrics

0
6
4
1
81
30
4
0.67
1.5
4
1

Classes

Class Line # Actions
PrepareMailQueueItem 35 6 0% 4 0
1.0100%
 

Contributing tests

This file is covered by 9 tests. .

Source view

1    /*
2    * See the NOTICE file distributed with this work for additional
3    * information regarding copyright ownership.
4    *
5    * This is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU Lesser General Public License as
7    * published by the Free Software Foundation; either version 2.1 of
8    * the License, or (at your option) any later version.
9    *
10    * This software is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    * Lesser General Public License for more details.
14    *
15    * You should have received a copy of the GNU Lesser General Public
16    * License along with this software; if not, write to the Free
17    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19    */
20    package org.xwiki.mail.internal.thread;
21   
22    import javax.mail.Session;
23    import javax.mail.internet.MimeMessage;
24   
25    import org.xwiki.context.ExecutionContext;
26    import org.xwiki.mail.MailListener;
27   
28    /**
29    * Represents one or several Mail messages placed on the queue for preparation. Preparation means that the MimeMessage
30    * objects will be created by the Thread reading from this queue and then placed on the Send Thread queue.
31    *
32    * @version $Id: a2d8b86d278c40cd09a7782bdae522ce026dac2b $
33    * @since 6.4
34    */
 
35    public class PrepareMailQueueItem extends AbstractMailQueueItem
36    {
37    private Iterable<? extends MimeMessage> messages;
38   
39    private ExecutionContext executionContext;
40   
41    /**
42    * @param messages see {@link #getMessages()}
43    * @param session see {@link #getSession()}
44    * @param listener see {@link #getListener()}
45    * @param batchId see {@link #getBatchId()}
46    * @param executionContext see {@link #getContext()}
47    */
 
48  45 toggle public PrepareMailQueueItem(Iterable<? extends MimeMessage> messages, Session session, MailListener listener,
49    String batchId, ExecutionContext executionContext)
50    {
51  45 super(session, listener, batchId);
52  45 this.messages = messages;
53  45 this.executionContext = executionContext;
54    }
55   
56    /**
57    * @return the list of mail messages to be sent
58    */
 
59  44 toggle public Iterable<? extends MimeMessage> getMessages()
60    {
61  44 return this.messages;
62    }
63   
64    /**
65    * @return the execution context that will be used when preparing and sending the Mime Message
66    * @since 7.1M2
67    */
 
68  84 toggle public ExecutionContext getContext()
69    {
70  84 return this.executionContext;
71    }
72   
73    /**
74    * @since 7.1M2
75    */
 
76  1 toggle @Override
77    public String toString()
78    {
79  1 return prepareToString().append("context", this.executionContext.getProperties()).toString();
80    }
81    }