james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From btell...@apache.org
Subject [1/2] james-mime4j git commit: MIME4J-272 Implicit DOM builder calls
Date Tue, 17 Apr 2018 03:27:59 GMT
Repository: james-mime4j
Updated Branches:
  refs/heads/master 06852dd8b -> d924dcb51


MIME4J-272 Implicit DOM builder calls


Project: http://git-wip-us.apache.org/repos/asf/james-mime4j/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-mime4j/commit/d924dcb5
Tree: http://git-wip-us.apache.org/repos/asf/james-mime4j/tree/d924dcb5
Diff: http://git-wip-us.apache.org/repos/asf/james-mime4j/diff/d924dcb5

Branch: refs/heads/master
Commit: d924dcb518f4aa85a7e7ff21920a472251345c0d
Parents: abd229b
Author: benwa <btellier@linagora.com>
Authored: Mon Apr 9 10:06:56 2018 +0700
Committer: benwa <btellier@linagora.com>
Committed: Tue Apr 17 10:26:53 2018 +0700

----------------------------------------------------------------------
 .../org/apache/james/mime4j/dom/MessageBuilder.java |  5 +++++
 .../mime4j/internal/AbstractEntityBuilder.java      | 16 ++++++++++++++++
 .../james/mime4j/message/DefaultMessageBuilder.java |  7 +++++++
 .../james/mime4j/message/MultipartBuilder.java      |  4 ++++
 4 files changed, 32 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-mime4j/blob/d924dcb5/dom/src/main/java/org/apache/james/mime4j/dom/MessageBuilder.java
----------------------------------------------------------------------
diff --git a/dom/src/main/java/org/apache/james/mime4j/dom/MessageBuilder.java b/dom/src/main/java/org/apache/james/mime4j/dom/MessageBuilder.java
index 72abff8..3e58c26 100644
--- a/dom/src/main/java/org/apache/james/mime4j/dom/MessageBuilder.java
+++ b/dom/src/main/java/org/apache/james/mime4j/dom/MessageBuilder.java
@@ -23,6 +23,7 @@ import java.io.IOException;
 import java.io.InputStream;
 
 import org.apache.james.mime4j.MimeException;
+import org.apache.james.mime4j.message.MultipartBuilder;
 
 /**
  * An interface to build instances of {@link Message} and other DOM elements either without
@@ -39,10 +40,14 @@ public interface MessageBuilder {
 
     Multipart newMultipart(Multipart source);
 
+    Multipart newMultipart(MultipartBuilder source);
+
     Message newMessage();
 
     Message newMessage(Message source);
 
+    Message newMessage(Message.Builder source);
+
     Header parseHeader(InputStream source) throws MimeException, IOException;
 
     Message parseMessage(InputStream source) throws MimeException, IOException;

http://git-wip-us.apache.org/repos/asf/james-mime4j/blob/d924dcb5/dom/src/main/java/org/apache/james/mime4j/internal/AbstractEntityBuilder.java
----------------------------------------------------------------------
diff --git a/dom/src/main/java/org/apache/james/mime4j/internal/AbstractEntityBuilder.java
b/dom/src/main/java/org/apache/james/mime4j/internal/AbstractEntityBuilder.java
index 19ea879..0ab3765 100644
--- a/dom/src/main/java/org/apache/james/mime4j/internal/AbstractEntityBuilder.java
+++ b/dom/src/main/java/org/apache/james/mime4j/internal/AbstractEntityBuilder.java
@@ -19,6 +19,7 @@
 
 package org.apache.james.mime4j.internal;
 
+import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Date;
@@ -40,6 +41,9 @@ import org.apache.james.mime4j.dom.field.ContentTypeField;
 import org.apache.james.mime4j.dom.field.FieldName;
 import org.apache.james.mime4j.dom.field.ParsedField;
 import org.apache.james.mime4j.field.Fields;
+import org.apache.james.mime4j.message.BodyPartBuilder;
+import org.apache.james.mime4j.message.MultipartBuilder;
+import org.apache.james.mime4j.message.SingleBodyBuilder;
 import org.apache.james.mime4j.stream.Field;
 import org.apache.james.mime4j.stream.NameValuePair;
 import org.apache.james.mime4j.util.MimeUtil;
@@ -487,6 +491,10 @@ public abstract class AbstractEntityBuilder {
         return this;
     }
 
+    public AbstractEntityBuilder setBody(SingleBodyBuilder body) throws IOException {
+        return this.setBody(body.build());
+    }
+
     /**
      * Sets body of this message.  Also sets the content type based on properties of
      * the given {@link org.apache.james.mime4j.dom.Body}.
@@ -546,6 +554,10 @@ public abstract class AbstractEntityBuilder {
         return this;
     }
 
+    public AbstractEntityBuilder setBody(Message.Builder message) {
+        return this.setBody(message.build());
+    }
+
     /**
      * Sets body of this message.  Also sets the content type based on properties of
      * the given {@link org.apache.james.mime4j.dom.Body}.
@@ -567,6 +579,10 @@ public abstract class AbstractEntityBuilder {
         return this;
     }
 
+    public AbstractEntityBuilder setBody(MultipartBuilder multipart) {
+        return this.setBody(multipart.build());
+    }
+
     /**
      * Returns message body.
      *

http://git-wip-us.apache.org/repos/asf/james-mime4j/blob/d924dcb5/dom/src/main/java/org/apache/james/mime4j/message/DefaultMessageBuilder.java
----------------------------------------------------------------------
diff --git a/dom/src/main/java/org/apache/james/mime4j/message/DefaultMessageBuilder.java
b/dom/src/main/java/org/apache/james/mime4j/message/DefaultMessageBuilder.java
index 9405bfd..db6cff8 100644
--- a/dom/src/main/java/org/apache/james/mime4j/message/DefaultMessageBuilder.java
+++ b/dom/src/main/java/org/apache/james/mime4j/message/DefaultMessageBuilder.java
@@ -330,4 +330,11 @@ public class DefaultMessageBuilder implements MessageBuilder {
         return mif.messageImpl();
     }
 
+    public Multipart newMultipart(MultipartBuilder source) {
+        return newMultipart(source.build());
+    }
+
+    public Message newMessage(Message.Builder source) {
+        return newMessage(source.build());
+    }
 }

http://git-wip-us.apache.org/repos/asf/james-mime4j/blob/d924dcb5/dom/src/main/java/org/apache/james/mime4j/message/MultipartBuilder.java
----------------------------------------------------------------------
diff --git a/dom/src/main/java/org/apache/james/mime4j/message/MultipartBuilder.java b/dom/src/main/java/org/apache/james/mime4j/message/MultipartBuilder.java
index baeeaf4..e33f979 100644
--- a/dom/src/main/java/org/apache/james/mime4j/message/MultipartBuilder.java
+++ b/dom/src/main/java/org/apache/james/mime4j/message/MultipartBuilder.java
@@ -129,6 +129,10 @@ public class MultipartBuilder {
         return this;
     }
 
+    public MultipartBuilder addBodyPart(BodyPartBuilder bodyPart) {
+        return this.addBodyPart(bodyPart.build());
+    }
+
     /**
      * Inserts a body part at the specified position in the list of body parts.
      *


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message