JAMES-2132 Rely on enumerations for MDN fields

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

Branch: refs/heads/master
Commit: 3d8120e94e98c3e61f2a6af4874d387970547790
Parents: 811b847
Author: benwa <btell...@linagora.com>
Authored: Mon Aug 28 11:05:21 2017 +0700
Committer: benwa <btell...@linagora.com>
Committed: Thu Aug 31 18:00:19 2017 +0700

----------------------------------------------------------------------
 .../java/org/apache/james/mdn/Disposition.java  |  8 +-
 .../mdn/action/mode/ActionModeAutomatic.java    | 42 ----------
 .../james/mdn/action/mode/ActionModeManual.java | 47 -----------
 .../mdn/action/mode/DispositionActionMode.java  | 23 +++++-
 .../james/mdn/modifier/DispositionModifier.java | 27 ++++++-
 .../james/mdn/modifier/ModifierError.java       | 44 -----------
 .../james/mdn/modifier/ModifierExpired.java     | 45 -----------
 .../james/mdn/modifier/ModifierFailed.java      | 45 -----------
 .../mdn/modifier/ModifierMailboxTerminated.java | 45 -----------
 .../james/mdn/modifier/ModifierSuperseded.java  | 45 -----------
 .../james/mdn/modifier/ModifierWarning.java     | 45 -----------
 .../sending/mode/DispositionSendingMode.java    | 23 +++++-
 .../mdn/sending/mode/SendingModeAutomatic.java  | 45 -----------
 .../mdn/sending/mode/SendingModeManual.java     | 45 -----------
 .../apache/james/mdn/type/DispositionType.java  | 27 ++++++-
 .../org/apache/james/mdn/type/TypeDeleted.java  | 45 -----------
 .../org/apache/james/mdn/type/TypeDenied.java   | 44 -----------
 .../apache/james/mdn/type/TypeDispatched.java   | 43 ----------
 .../apache/james/mdn/type/TypeDisplayed.java    | 44 -----------
 .../org/apache/james/mdn/type/TypeFailed.java   | 44 -----------
 .../apache/james/mdn/type/TypeProcessed.java    | 44 -----------
 .../org/apache/james/mdn/MDNFactoryTest.java    | 82 ++++++++------------
 .../transport/mailets/jsieve/RejectAction.java  | 13 ++--
 23 files changed, 135 insertions(+), 780 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/3d8120e9/mdn/src/main/java/org/apache/james/mdn/Disposition.java
----------------------------------------------------------------------
diff --git a/mdn/src/main/java/org/apache/james/mdn/Disposition.java 
b/mdn/src/main/java/org/apache/james/mdn/Disposition.java
index 9fcc8a5..381376f 100644
--- a/mdn/src/main/java/org/apache/james/mdn/Disposition.java
+++ b/mdn/src/main/java/org/apache/james/mdn/Disposition.java
@@ -140,11 +140,11 @@ public class Disposition
     {
         StringBuilder builder = new StringBuilder(64);
         builder.append("Disposition: ");
-        builder.append(getActionMode() == null ? "" : 
getActionMode().toString());
+        builder.append(getActionMode() == null ? "" : 
getActionMode().getValue());
         builder.append('/');
-        builder.append(getSendingMode() == null ? "" : 
getSendingMode().toString());
+        builder.append(getSendingMode() == null ? "" : 
getSendingMode().getValue());
         builder.append(';');
-        builder.append(getDispositionType() == null ? "" : 
getDispositionType().toString());
+        builder.append(getDispositionType() == null ? "" : 
getDispositionType().getValue());
         if (null != getDispositionModifiers()
                 && getDispositionModifiers().length > 0)
         {
@@ -153,7 +153,7 @@ public class Disposition
             {
                 if (i > 0)
                     builder.append(',');
-                builder.append(getDispositionModifiers()[i]);
+                builder.append(getDispositionModifiers()[i].getValue());
             }
         }
         return builder.toString();

http://git-wip-us.apache.org/repos/asf/james-project/blob/3d8120e9/mdn/src/main/java/org/apache/james/mdn/action/mode/ActionModeAutomatic.java
----------------------------------------------------------------------
diff --git 
a/mdn/src/main/java/org/apache/james/mdn/action/mode/ActionModeAutomatic.java 
b/mdn/src/main/java/org/apache/james/mdn/action/mode/ActionModeAutomatic.java
deleted file mode 100644
index d4b4459..0000000
--- 
a/mdn/src/main/java/org/apache/james/mdn/action/mode/ActionModeAutomatic.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one   *
- * or more contributor license agreements.  See the NOTICE file *
- * distributed with this work for additional information        *
- * regarding copyright ownership.  The ASF licenses this file   *
- * to you under the Apache License, Version 2.0 (the            *
- * "License"); you may not use this file except in compliance   *
- * with the License.  You may obtain a copy of the License at   *
- *                                                              *
- *   http://www.apache.org/licenses/LICENSE-2.0                 *
- *                                                              *
- * Unless required by applicable law or agreed to in writing,   *
- * software distributed under the License is distributed on an  *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
- * KIND, either express or implied.  See the License for the    *
- * specific language governing permissions and limitations      *
- * under the License.                                           *
- ****************************************************************/
-
-package org.apache.james.mdn.action.mode;
-
-
-/**
- * Class <code>ActionModeAutomatic</code>
- */
-public class ActionModeAutomatic implements DispositionActionMode {
-
-    /**
-     * Default Constructor
-     */
-    public ActionModeAutomatic() {
-        super();
-    }
-
-    /**
-     * @see java.lang.Object#toString()
-     */
-    public String toString() {
-        return "automatic-action";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/james-project/blob/3d8120e9/mdn/src/main/java/org/apache/james/mdn/action/mode/ActionModeManual.java
----------------------------------------------------------------------
diff --git 
a/mdn/src/main/java/org/apache/james/mdn/action/mode/ActionModeManual.java 
b/mdn/src/main/java/org/apache/james/mdn/action/mode/ActionModeManual.java
deleted file mode 100644
index 1a2a7b7..0000000
--- a/mdn/src/main/java/org/apache/james/mdn/action/mode/ActionModeManual.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one   *
- * or more contributor license agreements.  See the NOTICE file *
- * distributed with this work for additional information        *
- * regarding copyright ownership.  The ASF licenses this file   *
- * to you under the Apache License, Version 2.0 (the            *
- * "License"); you may not use this file except in compliance   *
- * with the License.  You may obtain a copy of the License at   *
- *                                                              *
- *   http://www.apache.org/licenses/LICENSE-2.0                 *
- *                                                              *
- * Unless required by applicable law or agreed to in writing,   *
- * software distributed under the License is distributed on an  *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
- * KIND, either express or implied.  See the License for the    *
- * specific language governing permissions and limitations      *
- * under the License.                                           *
- ****************************************************************/
-
-package org.apache.james.mdn.action.mode;
-
-
-/**
- * Class <code>ActionModeManual</code>
- */
-public class ActionModeManual
-        implements
-            DispositionActionMode
-{
-
-    /**
-     * Default Constructor
-     */
-    public ActionModeManual()
-    {
-        super();
-    }
-    
-    /**
-     * @see java.lang.Object#toString()
-     */
-    public String toString()
-    {
-        return "manual-action";
-    }         
-
-}

http://git-wip-us.apache.org/repos/asf/james-project/blob/3d8120e9/mdn/src/main/java/org/apache/james/mdn/action/mode/DispositionActionMode.java
----------------------------------------------------------------------
diff --git 
a/mdn/src/main/java/org/apache/james/mdn/action/mode/DispositionActionMode.java 
b/mdn/src/main/java/org/apache/james/mdn/action/mode/DispositionActionMode.java
index b855e08..6becee0 100644
--- 
a/mdn/src/main/java/org/apache/james/mdn/action/mode/DispositionActionMode.java
+++ 
b/mdn/src/main/java/org/apache/james/mdn/action/mode/DispositionActionMode.java
@@ -19,11 +19,30 @@
 
 package org.apache.james.mdn.action.mode;
 
+import java.util.Optional;
+import java.util.stream.Stream;
+
 /**
  * Interface <code>DispositionActionMode</code> marks a type encapsulating
  * disposition action mode information as defined by RFC 2298.
  */
-public interface DispositionActionMode
-{
+public enum DispositionActionMode {
+    Manual("manual-action"),
+    Automatic("automatic-action");
+
+    public static Optional<DispositionActionMode> fromString(String value) {
+        return Stream.of(values())
+            .filter(actionMode -> 
actionMode.getValue().equalsIgnoreCase(value))
+            .findFirst();
+    }
+
+    private final String value;
+
+    DispositionActionMode(String value) {
+        this.value = value;
+    }
 
+    public String getValue() {
+        return value;
+    }
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/3d8120e9/mdn/src/main/java/org/apache/james/mdn/modifier/DispositionModifier.java
----------------------------------------------------------------------
diff --git 
a/mdn/src/main/java/org/apache/james/mdn/modifier/DispositionModifier.java 
b/mdn/src/main/java/org/apache/james/mdn/modifier/DispositionModifier.java
index 66ab46a..1efb7d0 100644
--- a/mdn/src/main/java/org/apache/james/mdn/modifier/DispositionModifier.java
+++ b/mdn/src/main/java/org/apache/james/mdn/modifier/DispositionModifier.java
@@ -19,11 +19,34 @@
 
 package org.apache.james.mdn.modifier;
 
+import java.util.Optional;
+import java.util.stream.Stream;
+
 /**
  * Interface <code>DispositionModifier</code> marks a type encapsulating
  * disposition modifier information as defined by RFC 2298.
  */
-public interface DispositionModifier
-{
+public enum DispositionModifier {
+    Error("error"),
+    Expired("expired"),
+    Failed("failed"),
+    MailboxTerminated("mailbox-terminated"),
+    Superseded("superseded"),
+    Warning("warning");
+
+    public static Optional<DispositionModifier> fromString(String value) {
+        return Stream.of(values())
+            .filter(sendingMode -> 
sendingMode.getValue().equalsIgnoreCase(value))
+            .findFirst();
+    }
+
+    private final String value;
+
+    DispositionModifier(String value) {
+        this.value = value;
+    }
 
+    public String getValue() {
+        return value;
+    }
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/3d8120e9/mdn/src/main/java/org/apache/james/mdn/modifier/ModifierError.java
----------------------------------------------------------------------
diff --git a/mdn/src/main/java/org/apache/james/mdn/modifier/ModifierError.java 
b/mdn/src/main/java/org/apache/james/mdn/modifier/ModifierError.java
deleted file mode 100644
index 2a6feed..0000000
--- a/mdn/src/main/java/org/apache/james/mdn/modifier/ModifierError.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one   *
- * or more contributor license agreements.  See the NOTICE file *
- * distributed with this work for additional information        *
- * regarding copyright ownership.  The ASF licenses this file   *
- * to you under the Apache License, Version 2.0 (the            *
- * "License"); you may not use this file except in compliance   *
- * with the License.  You may obtain a copy of the License at   *
- *                                                              *
- *   http://www.apache.org/licenses/LICENSE-2.0                 *
- *                                                              *
- * Unless required by applicable law or agreed to in writing,   *
- * software distributed under the License is distributed on an  *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
- * KIND, either express or implied.  See the License for the    *
- * specific language governing permissions and limitations      *
- * under the License.                                           *
- ****************************************************************/
-
-package org.apache.james.mdn.modifier;
-
-
-/**
- * Class <code>ModifierError</code>
- */
-public class ModifierError implements DispositionModifier
-{
-
-    /**
-     * Default Constructor
-     */
-    public ModifierError()
-    {
-        super();
-    }
-
-    /**
-     * @see java.lang.Object#toString()
-     */
-    public String toString()
-    {
-        return "error";
-    }
-}

http://git-wip-us.apache.org/repos/asf/james-project/blob/3d8120e9/mdn/src/main/java/org/apache/james/mdn/modifier/ModifierExpired.java
----------------------------------------------------------------------
diff --git 
a/mdn/src/main/java/org/apache/james/mdn/modifier/ModifierExpired.java 
b/mdn/src/main/java/org/apache/james/mdn/modifier/ModifierExpired.java
deleted file mode 100644
index 9a73b0e..0000000
--- a/mdn/src/main/java/org/apache/james/mdn/modifier/ModifierExpired.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one   *
- * or more contributor license agreements.  See the NOTICE file *
- * distributed with this work for additional information        *
- * regarding copyright ownership.  The ASF licenses this file   *
- * to you under the Apache License, Version 2.0 (the            *
- * "License"); you may not use this file except in compliance   *
- * with the License.  You may obtain a copy of the License at   *
- *                                                              *
- *   http://www.apache.org/licenses/LICENSE-2.0                 *
- *                                                              *
- * Unless required by applicable law or agreed to in writing,   *
- * software distributed under the License is distributed on an  *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
- * KIND, either express or implied.  See the License for the    *
- * specific language governing permissions and limitations      *
- * under the License.                                           *
- ****************************************************************/
-
-package org.apache.james.mdn.modifier;
-
-
-/**
- * Class <code>ModifierExpired</code>
- */    
-public class ModifierExpired implements DispositionModifier
-{
-
-    /**
-     * Default Constructor
-     */
-    public ModifierExpired()
-    {
-        super();
-    }
-    
-    /**
-     * @see java.lang.Object#toString()
-     */
-    public String toString()
-    {
-        return "expired";
-    }        
-
-}

http://git-wip-us.apache.org/repos/asf/james-project/blob/3d8120e9/mdn/src/main/java/org/apache/james/mdn/modifier/ModifierFailed.java
----------------------------------------------------------------------
diff --git 
a/mdn/src/main/java/org/apache/james/mdn/modifier/ModifierFailed.java 
b/mdn/src/main/java/org/apache/james/mdn/modifier/ModifierFailed.java
deleted file mode 100644
index 53edbe2..0000000
--- a/mdn/src/main/java/org/apache/james/mdn/modifier/ModifierFailed.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one   *
- * or more contributor license agreements.  See the NOTICE file *
- * distributed with this work for additional information        *
- * regarding copyright ownership.  The ASF licenses this file   *
- * to you under the Apache License, Version 2.0 (the            *
- * "License"); you may not use this file except in compliance   *
- * with the License.  You may obtain a copy of the License at   *
- *                                                              *
- *   http://www.apache.org/licenses/LICENSE-2.0                 *
- *                                                              *
- * Unless required by applicable law or agreed to in writing,   *
- * software distributed under the License is distributed on an  *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
- * KIND, either express or implied.  See the License for the    *
- * specific language governing permissions and limitations      *
- * under the License.                                           *
- ****************************************************************/
-
-package org.apache.james.mdn.modifier;
-
-
-/**
- * Class <code>ModifierFailed</code>
- */    
-public class ModifierFailed implements DispositionModifier
-{
-
-    /**
-     * Default Constructor
-     */
-    public ModifierFailed()
-    {
-        super();
-    }
-    
-    /**
-     * @see java.lang.Object#toString()
-     */
-    public String toString()
-    {
-        return "failed";
-    }        
-
-}

http://git-wip-us.apache.org/repos/asf/james-project/blob/3d8120e9/mdn/src/main/java/org/apache/james/mdn/modifier/ModifierMailboxTerminated.java
----------------------------------------------------------------------
diff --git 
a/mdn/src/main/java/org/apache/james/mdn/modifier/ModifierMailboxTerminated.java
 
b/mdn/src/main/java/org/apache/james/mdn/modifier/ModifierMailboxTerminated.java
deleted file mode 100644
index b2c6ade..0000000
--- 
a/mdn/src/main/java/org/apache/james/mdn/modifier/ModifierMailboxTerminated.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one   *
- * or more contributor license agreements.  See the NOTICE file *
- * distributed with this work for additional information        *
- * regarding copyright ownership.  The ASF licenses this file   *
- * to you under the Apache License, Version 2.0 (the            *
- * "License"); you may not use this file except in compliance   *
- * with the License.  You may obtain a copy of the License at   *
- *                                                              *
- *   http://www.apache.org/licenses/LICENSE-2.0                 *
- *                                                              *
- * Unless required by applicable law or agreed to in writing,   *
- * software distributed under the License is distributed on an  *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
- * KIND, either express or implied.  See the License for the    *
- * specific language governing permissions and limitations      *
- * under the License.                                           *
- ****************************************************************/
-
-package org.apache.james.mdn.modifier;
-
-
-/**
- * Class <code>ModifierMailboxTerminated</code>
- */    
-public class ModifierMailboxTerminated implements DispositionModifier
-{
-
-    /**
-     * Default Constructor
-     */
-    public ModifierMailboxTerminated()
-    {
-        super();
-    }
-    
-    /**
-     * @see java.lang.Object#toString()
-     */
-    public String toString()
-    {
-        return "mailbox-terminated";
-    }        
-
-}

http://git-wip-us.apache.org/repos/asf/james-project/blob/3d8120e9/mdn/src/main/java/org/apache/james/mdn/modifier/ModifierSuperseded.java
----------------------------------------------------------------------
diff --git 
a/mdn/src/main/java/org/apache/james/mdn/modifier/ModifierSuperseded.java 
b/mdn/src/main/java/org/apache/james/mdn/modifier/ModifierSuperseded.java
deleted file mode 100644
index 11786f9..0000000
--- a/mdn/src/main/java/org/apache/james/mdn/modifier/ModifierSuperseded.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one   *
- * or more contributor license agreements.  See the NOTICE file *
- * distributed with this work for additional information        *
- * regarding copyright ownership.  The ASF licenses this file   *
- * to you under the Apache License, Version 2.0 (the            *
- * "License"); you may not use this file except in compliance   *
- * with the License.  You may obtain a copy of the License at   *
- *                                                              *
- *   http://www.apache.org/licenses/LICENSE-2.0                 *
- *                                                              *
- * Unless required by applicable law or agreed to in writing,   *
- * software distributed under the License is distributed on an  *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
- * KIND, either express or implied.  See the License for the    *
- * specific language governing permissions and limitations      *
- * under the License.                                           *
- ****************************************************************/
-
-package org.apache.james.mdn.modifier;
-
-
-/**
- * Class <code>ModifierSuperseded</code>
- */    
-public class ModifierSuperseded implements DispositionModifier
-{
-
-    /**
-     * Default Constructor
-     */
-    public ModifierSuperseded()
-    {
-        super();
-    }
-    
-    /**
-     * @see java.lang.Object#toString()
-     */
-    public String toString()
-    {
-        return "superseded";
-    }        
-
-}

http://git-wip-us.apache.org/repos/asf/james-project/blob/3d8120e9/mdn/src/main/java/org/apache/james/mdn/modifier/ModifierWarning.java
----------------------------------------------------------------------
diff --git 
a/mdn/src/main/java/org/apache/james/mdn/modifier/ModifierWarning.java 
b/mdn/src/main/java/org/apache/james/mdn/modifier/ModifierWarning.java
deleted file mode 100644
index de8d1c6..0000000
--- a/mdn/src/main/java/org/apache/james/mdn/modifier/ModifierWarning.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one   *
- * or more contributor license agreements.  See the NOTICE file *
- * distributed with this work for additional information        *
- * regarding copyright ownership.  The ASF licenses this file   *
- * to you under the Apache License, Version 2.0 (the            *
- * "License"); you may not use this file except in compliance   *
- * with the License.  You may obtain a copy of the License at   *
- *                                                              *
- *   http://www.apache.org/licenses/LICENSE-2.0                 *
- *                                                              *
- * Unless required by applicable law or agreed to in writing,   *
- * software distributed under the License is distributed on an  *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
- * KIND, either express or implied.  See the License for the    *
- * specific language governing permissions and limitations      *
- * under the License.                                           *
- ****************************************************************/
-
-package org.apache.james.mdn.modifier;
-
-
-/**
- * Class <code>ModifierWarning</code>
- */    
-public class ModifierWarning implements DispositionModifier
-{
-
-    /**
-     * Default Constructor
-     */
-    public ModifierWarning()
-    {
-        super();
-    }
-    
-    /**
-     * @see java.lang.Object#toString()
-     */
-    public String toString()
-    {
-        return "warning";
-    }        
-
-}

http://git-wip-us.apache.org/repos/asf/james-project/blob/3d8120e9/mdn/src/main/java/org/apache/james/mdn/sending/mode/DispositionSendingMode.java
----------------------------------------------------------------------
diff --git 
a/mdn/src/main/java/org/apache/james/mdn/sending/mode/DispositionSendingMode.java
 
b/mdn/src/main/java/org/apache/james/mdn/sending/mode/DispositionSendingMode.java
index 741c661..99e63c1 100644
--- 
a/mdn/src/main/java/org/apache/james/mdn/sending/mode/DispositionSendingMode.java
+++ 
b/mdn/src/main/java/org/apache/james/mdn/sending/mode/DispositionSendingMode.java
@@ -19,11 +19,30 @@
 
 package org.apache.james.mdn.sending.mode;
 
+import java.util.Optional;
+import java.util.stream.Stream;
+
 /**
  * Interface <code>DispositionSendingMode</code> marks a type encapsulating
  * disposition sending mode information as defined by RFC 2298.
  */
-public interface DispositionSendingMode
-{
+public enum DispositionSendingMode {
+    Manual("MDN-sent-manually"),
+    Automatic("MDN-sent-automatically");
+
+    public static Optional<DispositionSendingMode> fromString(String value) {
+        return Stream.of(values())
+            .filter(sendingMode -> 
sendingMode.getValue().equalsIgnoreCase(value))
+            .findFirst();
+    }
+
+    private final String value;
+
+    DispositionSendingMode(String value) {
+        this.value = value;
+    }
 
+    public String getValue() {
+        return value;
+    }
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/3d8120e9/mdn/src/main/java/org/apache/james/mdn/sending/mode/SendingModeAutomatic.java
----------------------------------------------------------------------
diff --git 
a/mdn/src/main/java/org/apache/james/mdn/sending/mode/SendingModeAutomatic.java 
b/mdn/src/main/java/org/apache/james/mdn/sending/mode/SendingModeAutomatic.java
deleted file mode 100644
index f847007..0000000
--- 
a/mdn/src/main/java/org/apache/james/mdn/sending/mode/SendingModeAutomatic.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one   *
- * or more contributor license agreements.  See the NOTICE file *
- * distributed with this work for additional information        *
- * regarding copyright ownership.  The ASF licenses this file   *
- * to you under the Apache License, Version 2.0 (the            *
- * "License"); you may not use this file except in compliance   *
- * with the License.  You may obtain a copy of the License at   *
- *                                                              *
- *   http://www.apache.org/licenses/LICENSE-2.0                 *
- *                                                              *
- * Unless required by applicable law or agreed to in writing,   *
- * software distributed under the License is distributed on an  *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
- * KIND, either express or implied.  See the License for the    *
- * specific language governing permissions and limitations      *
- * under the License.                                           *
- ****************************************************************/
-
-package org.apache.james.mdn.sending.mode;
-
-
-/**
- * Class <code>SendingModeAutomatic</code>
- */
-public class SendingModeAutomatic implements DispositionSendingMode
-{
-
-    /**
-     * Default Constructor
-     */
-    public SendingModeAutomatic()
-    {
-        super();
-    }
-    
-    /**
-     * @see java.lang.Object#toString()
-     */
-    public String toString()
-    {
-        return "MDN-sent-automatically";
-    }        
-
-}

http://git-wip-us.apache.org/repos/asf/james-project/blob/3d8120e9/mdn/src/main/java/org/apache/james/mdn/sending/mode/SendingModeManual.java
----------------------------------------------------------------------
diff --git 
a/mdn/src/main/java/org/apache/james/mdn/sending/mode/SendingModeManual.java 
b/mdn/src/main/java/org/apache/james/mdn/sending/mode/SendingModeManual.java
deleted file mode 100644
index 1087082..0000000
--- a/mdn/src/main/java/org/apache/james/mdn/sending/mode/SendingModeManual.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one   *
- * or more contributor license agreements.  See the NOTICE file *
- * distributed with this work for additional information        *
- * regarding copyright ownership.  The ASF licenses this file   *
- * to you under the Apache License, Version 2.0 (the            *
- * "License"); you may not use this file except in compliance   *
- * with the License.  You may obtain a copy of the License at   *
- *                                                              *
- *   http://www.apache.org/licenses/LICENSE-2.0                 *
- *                                                              *
- * Unless required by applicable law or agreed to in writing,   *
- * software distributed under the License is distributed on an  *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
- * KIND, either express or implied.  See the License for the    *
- * specific language governing permissions and limitations      *
- * under the License.                                           *
- ****************************************************************/
-
-package org.apache.james.mdn.sending.mode;
-
-
-/**
- * Class <code>SendingModeManual</code>
- */
-public class SendingModeManual implements DispositionSendingMode
-{
-
-    /**
-     * Default Constructor
-     */
-    public SendingModeManual()
-    {
-        super();
-    }
-    
-    /**
-     * @see java.lang.Object#toString()
-     */
-    public String toString()
-    {
-        return "MDN-sent-manually";
-    }         
-
-}

http://git-wip-us.apache.org/repos/asf/james-project/blob/3d8120e9/mdn/src/main/java/org/apache/james/mdn/type/DispositionType.java
----------------------------------------------------------------------
diff --git a/mdn/src/main/java/org/apache/james/mdn/type/DispositionType.java 
b/mdn/src/main/java/org/apache/james/mdn/type/DispositionType.java
index c02ba2e..2ce39b9 100644
--- a/mdn/src/main/java/org/apache/james/mdn/type/DispositionType.java
+++ b/mdn/src/main/java/org/apache/james/mdn/type/DispositionType.java
@@ -19,11 +19,34 @@
 
 package org.apache.james.mdn.type;
 
+import java.util.Optional;
+import java.util.stream.Stream;
+
 /**
  * Interface <code>DispositionType</code> marks a type encapsulating
  * disposition type information as defined by RFC 2298.
  */
-public interface DispositionType
-{
+public enum DispositionType {
+    Deleted("deleted"),
+    Denied("denied"),
+    Dispatched("dispatched"),
+    Displayed("displayed"),
+    Failed("failed"),
+    Processed("processed");
+
+    public static Optional<DispositionType> fromString(String value) {
+        return Stream.of(values())
+            .filter(sendingMode -> 
sendingMode.getValue().equalsIgnoreCase(value))
+            .findFirst();
+    }
+
+    private final String value;
+
+    DispositionType(String value) {
+        this.value = value;
+    }
 
+    public String getValue() {
+        return value;
+    }
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/3d8120e9/mdn/src/main/java/org/apache/james/mdn/type/TypeDeleted.java
----------------------------------------------------------------------
diff --git a/mdn/src/main/java/org/apache/james/mdn/type/TypeDeleted.java 
b/mdn/src/main/java/org/apache/james/mdn/type/TypeDeleted.java
deleted file mode 100644
index 028e644..0000000
--- a/mdn/src/main/java/org/apache/james/mdn/type/TypeDeleted.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one   *
- * or more contributor license agreements.  See the NOTICE file *
- * distributed with this work for additional information        *
- * regarding copyright ownership.  The ASF licenses this file   *
- * to you under the Apache License, Version 2.0 (the            *
- * "License"); you may not use this file except in compliance   *
- * with the License.  You may obtain a copy of the License at   *
- *                                                              *
- *   http://www.apache.org/licenses/LICENSE-2.0                 *
- *                                                              *
- * Unless required by applicable law or agreed to in writing,   *
- * software distributed under the License is distributed on an  *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
- * KIND, either express or implied.  See the License for the    *
- * specific language governing permissions and limitations      *
- * under the License.                                           *
- ****************************************************************/
-
-package org.apache.james.mdn.type;
-
-
-/**
- * Class <code>TypeDeleted</code>
- */
-public class TypeDeleted implements DispositionType
-{
-
-    /**
-     * Default Constructor
-     */
-    public TypeDeleted()
-    {
-        super();
-    }
-    
-    /**
-     * @see java.lang.Object#toString()
-     */
-    public String toString()
-    {
-        return "deleted";
-    }         
-
-}

http://git-wip-us.apache.org/repos/asf/james-project/blob/3d8120e9/mdn/src/main/java/org/apache/james/mdn/type/TypeDenied.java
----------------------------------------------------------------------
diff --git a/mdn/src/main/java/org/apache/james/mdn/type/TypeDenied.java 
b/mdn/src/main/java/org/apache/james/mdn/type/TypeDenied.java
deleted file mode 100644
index 3430f65..0000000
--- a/mdn/src/main/java/org/apache/james/mdn/type/TypeDenied.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one   *
- * or more contributor license agreements.  See the NOTICE file *
- * distributed with this work for additional information        *
- * regarding copyright ownership.  The ASF licenses this file   *
- * to you under the Apache License, Version 2.0 (the            *
- * "License"); you may not use this file except in compliance   *
- * with the License.  You may obtain a copy of the License at   *
- *                                                              *
- *   http://www.apache.org/licenses/LICENSE-2.0                 *
- *                                                              *
- * Unless required by applicable law or agreed to in writing,   *
- * software distributed under the License is distributed on an  *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
- * KIND, either express or implied.  See the License for the    *
- * specific language governing permissions and limitations      *
- * under the License.                                           *
- ****************************************************************/
-
-package org.apache.james.mdn.type;
-
-
-/**
- * Class <code>TypeDenied</code>
- */    
-public class TypeDenied implements DispositionType
-{
-
-    /**
-     * Default Constructor
-     */
-    public TypeDenied()
-    {
-        super();
-    }
-    
-    /**
-     * @see java.lang.Object#toString()
-     */
-    public String toString()
-    {
-        return "denied";
-    }         
-}

http://git-wip-us.apache.org/repos/asf/james-project/blob/3d8120e9/mdn/src/main/java/org/apache/james/mdn/type/TypeDispatched.java
----------------------------------------------------------------------
diff --git a/mdn/src/main/java/org/apache/james/mdn/type/TypeDispatched.java 
b/mdn/src/main/java/org/apache/james/mdn/type/TypeDispatched.java
deleted file mode 100644
index 5bf9190..0000000
--- a/mdn/src/main/java/org/apache/james/mdn/type/TypeDispatched.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one   *
- * or more contributor license agreements.  See the NOTICE file *
- * distributed with this work for additional information        *
- * regarding copyright ownership.  The ASF licenses this file   *
- * to you under the Apache License, Version 2.0 (the            *
- * "License"); you may not use this file except in compliance   *
- * with the License.  You may obtain a copy of the License at   *
- *                                                              *
- *   http://www.apache.org/licenses/LICENSE-2.0                 *
- *                                                              *
- * Unless required by applicable law or agreed to in writing,   *
- * software distributed under the License is distributed on an  *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
- * KIND, either express or implied.  See the License for the    *
- * specific language governing permissions and limitations      *
- * under the License.                                           *
- ****************************************************************/
-
-package org.apache.james.mdn.type;
-
-
-/**
- * Class <code>TypeDispatched</code>
- */
-public class TypeDispatched implements DispositionType
-{
-    /**
-     * Default Constructor
-     */
-    public TypeDispatched()
-    {
-        super();
-    }
-    
-    /**
-     * @see java.lang.Object#toString()
-     */
-    public String toString()
-    {
-        return "dispatched";
-    }         
-}

http://git-wip-us.apache.org/repos/asf/james-project/blob/3d8120e9/mdn/src/main/java/org/apache/james/mdn/type/TypeDisplayed.java
----------------------------------------------------------------------
diff --git a/mdn/src/main/java/org/apache/james/mdn/type/TypeDisplayed.java 
b/mdn/src/main/java/org/apache/james/mdn/type/TypeDisplayed.java
deleted file mode 100644
index 48e9323..0000000
--- a/mdn/src/main/java/org/apache/james/mdn/type/TypeDisplayed.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one   *
- * or more contributor license agreements.  See the NOTICE file *
- * distributed with this work for additional information        *
- * regarding copyright ownership.  The ASF licenses this file   *
- * to you under the Apache License, Version 2.0 (the            *
- * "License"); you may not use this file except in compliance   *
- * with the License.  You may obtain a copy of the License at   *
- *                                                              *
- *   http://www.apache.org/licenses/LICENSE-2.0                 *
- *                                                              *
- * Unless required by applicable law or agreed to in writing,   *
- * software distributed under the License is distributed on an  *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
- * KIND, either express or implied.  See the License for the    *
- * specific language governing permissions and limitations      *
- * under the License.                                           *
- ****************************************************************/
-
-package org.apache.james.mdn.type;
-
-
-/**
- * Class <code>TypeDisplayed</code>
- */
-public class TypeDisplayed implements DispositionType
-{
-
-    /**
-     * Default Constructor
-     */
-    public TypeDisplayed()
-    {
-        super();
-    }
-    
-    /**
-     * @see java.lang.Object#toString()
-     */
-    public String toString()
-    {
-        return "displayed";
-    }         
-}

http://git-wip-us.apache.org/repos/asf/james-project/blob/3d8120e9/mdn/src/main/java/org/apache/james/mdn/type/TypeFailed.java
----------------------------------------------------------------------
diff --git a/mdn/src/main/java/org/apache/james/mdn/type/TypeFailed.java 
b/mdn/src/main/java/org/apache/james/mdn/type/TypeFailed.java
deleted file mode 100644
index 067c892..0000000
--- a/mdn/src/main/java/org/apache/james/mdn/type/TypeFailed.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one   *
- * or more contributor license agreements.  See the NOTICE file *
- * distributed with this work for additional information        *
- * regarding copyright ownership.  The ASF licenses this file   *
- * to you under the Apache License, Version 2.0 (the            *
- * "License"); you may not use this file except in compliance   *
- * with the License.  You may obtain a copy of the License at   *
- *                                                              *
- *   http://www.apache.org/licenses/LICENSE-2.0                 *
- *                                                              *
- * Unless required by applicable law or agreed to in writing,   *
- * software distributed under the License is distributed on an  *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
- * KIND, either express or implied.  See the License for the    *
- * specific language governing permissions and limitations      *
- * under the License.                                           *
- ****************************************************************/
-
-package org.apache.james.mdn.type;
-
-
-/**
- * Class <code>TypeFailed</code>
- */    
-public class TypeFailed implements DispositionType
-{
-
-    /**
-     * Default Constructor
-     */
-    public TypeFailed()
-    {
-        super();
-    }
-    
-    /**
-     * @see java.lang.Object#toString()
-     */
-    public String toString()
-    {
-        return "failed";
-    }         
-}

http://git-wip-us.apache.org/repos/asf/james-project/blob/3d8120e9/mdn/src/main/java/org/apache/james/mdn/type/TypeProcessed.java
----------------------------------------------------------------------
diff --git a/mdn/src/main/java/org/apache/james/mdn/type/TypeProcessed.java 
b/mdn/src/main/java/org/apache/james/mdn/type/TypeProcessed.java
deleted file mode 100644
index ed1895b..0000000
--- a/mdn/src/main/java/org/apache/james/mdn/type/TypeProcessed.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one   *
- * or more contributor license agreements.  See the NOTICE file *
- * distributed with this work for additional information        *
- * regarding copyright ownership.  The ASF licenses this file   *
- * to you under the Apache License, Version 2.0 (the            *
- * "License"); you may not use this file except in compliance   *
- * with the License.  You may obtain a copy of the License at   *
- *                                                              *
- *   http://www.apache.org/licenses/LICENSE-2.0                 *
- *                                                              *
- * Unless required by applicable law or agreed to in writing,   *
- * software distributed under the License is distributed on an  *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
- * KIND, either express or implied.  See the License for the    *
- * specific language governing permissions and limitations      *
- * under the License.                                           *
- ****************************************************************/
-
-package org.apache.james.mdn.type;
-
-
-/**
- * Class <code>TypeProcessed</code>
- */    
-public class TypeProcessed implements DispositionType
-{
-
-    /**
-     * Default Constructor
-     */
-    public TypeProcessed()
-    {
-        super();
-    }
-    
-    /**
-     * @see java.lang.Object#toString()
-     */
-    public String toString()
-    {
-        return "processed";
-    }         
-}

http://git-wip-us.apache.org/repos/asf/james-project/blob/3d8120e9/mdn/src/test/java/org/apache/james/mdn/MDNFactoryTest.java
----------------------------------------------------------------------
diff --git a/mdn/src/test/java/org/apache/james/mdn/MDNFactoryTest.java 
b/mdn/src/test/java/org/apache/james/mdn/MDNFactoryTest.java
index 18337c6..5272252 100644
--- a/mdn/src/test/java/org/apache/james/mdn/MDNFactoryTest.java
+++ b/mdn/src/test/java/org/apache/james/mdn/MDNFactoryTest.java
@@ -21,26 +21,10 @@ package org.apache.james.mdn;
 
 import static org.assertj.core.api.Assertions.assertThat;
 
-import org.apache.james.mdn.action.mode.ActionModeAutomatic;
-import org.apache.james.mdn.action.mode.ActionModeManual;
 import org.apache.james.mdn.action.mode.DispositionActionMode;
 import org.apache.james.mdn.modifier.DispositionModifier;
-import org.apache.james.mdn.modifier.ModifierError;
-import org.apache.james.mdn.modifier.ModifierExpired;
-import org.apache.james.mdn.modifier.ModifierFailed;
-import org.apache.james.mdn.modifier.ModifierMailboxTerminated;
-import org.apache.james.mdn.modifier.ModifierSuperseded;
-import org.apache.james.mdn.modifier.ModifierWarning;
 import org.apache.james.mdn.sending.mode.DispositionSendingMode;
-import org.apache.james.mdn.sending.mode.SendingModeAutomatic;
-import org.apache.james.mdn.sending.mode.SendingModeManual;
 import org.apache.james.mdn.type.DispositionType;
-import org.apache.james.mdn.type.TypeDeleted;
-import org.apache.james.mdn.type.TypeDenied;
-import org.apache.james.mdn.type.TypeDispatched;
-import org.apache.james.mdn.type.TypeDisplayed;
-import org.apache.james.mdn.type.TypeFailed;
-import org.apache.james.mdn.type.TypeProcessed;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.ExpectedException;
@@ -52,8 +36,8 @@ public class MDNFactoryTest {
 
     @Test
     public void generateMDNReportShouldFormatAutomaticActions() {
-        Disposition disposition = new Disposition(new ActionModeAutomatic(), 
new SendingModeAutomatic(), new TypeProcessed());
-        DispositionModifier[] dispostionModifiers = {new ModifierError(), new 
ModifierFailed()};
+        Disposition disposition = new 
Disposition(DispositionActionMode.Automatic, DispositionSendingMode.Automatic, 
DispositionType.Processed);
+        DispositionModifier[] dispostionModifiers = 
{DispositionModifier.Error, DispositionModifier.Failed};
         disposition.setDispositionModifiers(dispostionModifiers);
 
         String report = MDNFactory.generateMDNReport("UA_name", "UA_product", 
"originalRecipient",
@@ -69,8 +53,8 @@ public class MDNFactoryTest {
 
     @Test
     public void generateMDNReportShouldFormatManualActions() {
-        Disposition disposition = new Disposition(new ActionModeManual(), new 
SendingModeManual(), new TypeProcessed());
-        DispositionModifier[] dispostionModifiers = {new ModifierError(), new 
ModifierFailed()};
+        Disposition disposition = new 
Disposition(DispositionActionMode.Manual, DispositionSendingMode.Manual, 
DispositionType.Processed);
+        DispositionModifier[] dispostionModifiers = 
{DispositionModifier.Error, DispositionModifier.Failed};
         disposition.setDispositionModifiers(dispostionModifiers);
 
         String report = MDNFactory.generateMDNReport("UA_name", "UA_product", 
"originalRecipient",
@@ -86,8 +70,8 @@ public class MDNFactoryTest {
 
     @Test
     public void generateMDNReportShouldFormatTypeDenied() {
-        Disposition disposition = new Disposition(new ActionModeManual(), new 
SendingModeManual(), new TypeDenied());
-        DispositionModifier[] dispostionModifiers = {new ModifierError(), new 
ModifierFailed()};
+        Disposition disposition = new 
Disposition(DispositionActionMode.Manual, DispositionSendingMode.Manual, 
DispositionType.Denied);
+        DispositionModifier[] dispostionModifiers = 
{DispositionModifier.Error, DispositionModifier.Failed};
         disposition.setDispositionModifiers(dispostionModifiers);
 
         String report = MDNFactory.generateMDNReport("UA_name", "UA_product", 
"originalRecipient",
@@ -103,8 +87,8 @@ public class MDNFactoryTest {
 
     @Test
     public void generateMDNReportShouldFormatTypeDispatcher() {
-        Disposition disposition = new Disposition(new ActionModeManual(), new 
SendingModeManual(), new TypeDispatched());
-        DispositionModifier[] dispostionModifiers = {new ModifierError(), new 
ModifierFailed()};
+        Disposition disposition = new 
Disposition(DispositionActionMode.Manual, DispositionSendingMode.Manual, 
DispositionType.Dispatched);
+        DispositionModifier[] dispostionModifiers = 
{DispositionModifier.Error, DispositionModifier.Failed};
         disposition.setDispositionModifiers(dispostionModifiers);
 
         String report = MDNFactory.generateMDNReport("UA_name", "UA_product", 
"originalRecipient",
@@ -120,8 +104,8 @@ public class MDNFactoryTest {
 
     @Test
     public void generateMDNReportShouldFormatTypeDisplayed() {
-        Disposition disposition = new Disposition(new ActionModeManual(), new 
SendingModeManual(), new TypeDisplayed());
-        DispositionModifier[] dispostionModifiers = {new ModifierError(), new 
ModifierFailed()};
+        Disposition disposition = new 
Disposition(DispositionActionMode.Manual, DispositionSendingMode.Manual, 
DispositionType.Displayed);
+        DispositionModifier[] dispostionModifiers = 
{DispositionModifier.Error, DispositionModifier.Failed};
         disposition.setDispositionModifiers(dispostionModifiers);
 
         String report = MDNFactory.generateMDNReport("UA_name", "UA_product", 
"originalRecipient",
@@ -137,8 +121,8 @@ public class MDNFactoryTest {
 
     @Test
     public void generateMDNReportShouldFormatTypeFailed() {
-        Disposition disposition = new Disposition(new ActionModeManual(), new 
SendingModeManual(), new TypeFailed());
-        DispositionModifier[] dispostionModifiers = {new ModifierError(), new 
ModifierFailed()};
+        Disposition disposition = new 
Disposition(DispositionActionMode.Manual, DispositionSendingMode.Manual, 
DispositionType.Failed);
+        DispositionModifier[] dispostionModifiers = 
{DispositionModifier.Error, DispositionModifier.Failed};
         disposition.setDispositionModifiers(dispostionModifiers);
 
         String report = MDNFactory.generateMDNReport("UA_name", "UA_product", 
"originalRecipient",
@@ -154,8 +138,8 @@ public class MDNFactoryTest {
 
     @Test
     public void generateMDNReportShouldFormatTypeDeleted() {
-        Disposition disposition = new Disposition(new ActionModeManual(), new 
SendingModeManual(), new TypeDeleted());
-        DispositionModifier[] dispostionModifiers = {new ModifierError(), new 
ModifierFailed()};
+        Disposition disposition = new 
Disposition(DispositionActionMode.Manual, DispositionSendingMode.Manual, 
DispositionType.Deleted);
+        DispositionModifier[] dispostionModifiers = 
{DispositionModifier.Error, DispositionModifier.Failed};
         disposition.setDispositionModifiers(dispostionModifiers);
 
         String report = MDNFactory.generateMDNReport("UA_name", "UA_product", 
"originalRecipient",
@@ -171,9 +155,9 @@ public class MDNFactoryTest {
 
     @Test
     public void generateMDNReportShouldFormatAllModifier() {
-        Disposition disposition = new Disposition(new ActionModeManual(), new 
SendingModeManual(), new TypeDeleted());
-        DispositionModifier[] dispostionModifiers = {new ModifierError(), new 
ModifierExpired(), new ModifierFailed(),
-            new ModifierMailboxTerminated(), new ModifierSuperseded(), new 
ModifierWarning()};
+        Disposition disposition = new 
Disposition(DispositionActionMode.Manual, DispositionSendingMode.Manual, 
DispositionType.Deleted);
+        DispositionModifier[] dispostionModifiers = 
{DispositionModifier.Error, DispositionModifier.Expired, 
DispositionModifier.Failed,
+            DispositionModifier.MailboxTerminated, 
DispositionModifier.Superseded, DispositionModifier.Warning};
         disposition.setDispositionModifiers(dispostionModifiers);
 
         String report = MDNFactory.generateMDNReport("UA_name", "UA_product", 
"originalRecipient",
@@ -189,7 +173,7 @@ public class MDNFactoryTest {
 
     @Test
     public void generateMDNReportShouldFormatNoModifier() {
-        Disposition disposition = new Disposition(new ActionModeManual(), new 
SendingModeManual(), new TypeDeleted());
+        Disposition disposition = new 
Disposition(DispositionActionMode.Manual, DispositionSendingMode.Manual, 
DispositionType.Deleted);
         DispositionModifier[] dispostionModifiers = {};
         disposition.setDispositionModifiers(dispostionModifiers);
 
@@ -207,7 +191,7 @@ public class MDNFactoryTest {
     @Test
     public void generateMDNReportShouldFormatNoModifierNullType() {
         DispositionType type = null;
-        Disposition disposition = new Disposition(new ActionModeManual(), new 
SendingModeManual(), type);
+        Disposition disposition = new 
Disposition(DispositionActionMode.Manual, DispositionSendingMode.Manual, type);
         DispositionModifier[] dispostionModifiers = {};
         disposition.setDispositionModifiers(dispostionModifiers);
 
@@ -225,8 +209,8 @@ public class MDNFactoryTest {
     @Test
     public void generateMDNReportShouldFormatNullActionMode() {
         DispositionActionMode actionMode = null;
-        Disposition disposition = new Disposition(actionMode, new 
SendingModeManual(), new TypeDeleted());
-        DispositionModifier[] dispostionModifiers = {new ModifierError(), new 
ModifierFailed()};
+        Disposition disposition = new Disposition(actionMode, 
DispositionSendingMode.Manual, DispositionType.Deleted);
+        DispositionModifier[] dispostionModifiers = 
{DispositionModifier.Error, DispositionModifier.Failed};
         disposition.setDispositionModifiers(dispostionModifiers);
 
         String report = MDNFactory.generateMDNReport("UA_name", "UA_product", 
"originalRecipient",
@@ -243,8 +227,8 @@ public class MDNFactoryTest {
     @Test
     public void generateMDNReportShouldFormatNullSendingMode() {
         DispositionSendingMode sendingMode = null;
-        Disposition disposition = new Disposition(new ActionModeManual(), 
sendingMode, new TypeDeleted());
-        DispositionModifier[] dispostionModifiers = {new ModifierError(), new 
ModifierFailed()};
+        Disposition disposition = new 
Disposition(DispositionActionMode.Manual, sendingMode, DispositionType.Deleted);
+        DispositionModifier[] dispostionModifiers = 
{DispositionModifier.Error, DispositionModifier.Failed};
         disposition.setDispositionModifiers(dispostionModifiers);
 
         String report = MDNFactory.generateMDNReport("UA_name", "UA_product", 
"originalRecipient",
@@ -260,8 +244,8 @@ public class MDNFactoryTest {
 
     @Test
     public void generateMDNReportShouldFormatNullUserAgentName() {
-        Disposition disposition = new Disposition(new ActionModeManual(), new 
SendingModeAutomatic(), new TypeDeleted());
-        DispositionModifier[] dispostionModifiers = {new ModifierError(), new 
ModifierFailed()};
+        Disposition disposition = new 
Disposition(DispositionActionMode.Manual, DispositionSendingMode.Automatic, 
DispositionType.Deleted);
+        DispositionModifier[] dispostionModifiers = 
{DispositionModifier.Error, DispositionModifier.Failed};
         disposition.setDispositionModifiers(dispostionModifiers);
 
         String reporting_ua_name = null;
@@ -278,8 +262,8 @@ public class MDNFactoryTest {
 
     @Test
     public void generateMDNReportShouldFormatNullUserAgentProduct() {
-        Disposition disposition = new Disposition(new ActionModeManual(), new 
SendingModeAutomatic(), new TypeDeleted());
-        DispositionModifier[] dispostionModifiers = {new ModifierError(), new 
ModifierFailed()};
+        Disposition disposition = new 
Disposition(DispositionActionMode.Manual, DispositionSendingMode.Automatic, 
DispositionType.Deleted);
+        DispositionModifier[] dispostionModifiers = 
{DispositionModifier.Error, DispositionModifier.Failed};
         disposition.setDispositionModifiers(dispostionModifiers);
 
         String reporting_ua_product = null;
@@ -296,8 +280,8 @@ public class MDNFactoryTest {
 
     @Test
     public void generateMDNReportShouldFormatNullOriginalRecipient() {
-        Disposition disposition = new Disposition(new ActionModeManual(), new 
SendingModeAutomatic(), new TypeDeleted());
-        DispositionModifier[] dispostionModifiers = {new ModifierError(), new 
ModifierFailed()};
+        Disposition disposition = new 
Disposition(DispositionActionMode.Manual, DispositionSendingMode.Automatic, 
DispositionType.Deleted);
+        DispositionModifier[] dispostionModifiers = 
{DispositionModifier.Error, DispositionModifier.Failed};
         disposition.setDispositionModifiers(dispostionModifiers);
 
         String original_recipient = null;
@@ -313,8 +297,8 @@ public class MDNFactoryTest {
 
     @Test
     public void generateMDNReportShouldFormatNullFinalRecipient() {
-        Disposition disposition = new Disposition(new ActionModeManual(), new 
SendingModeAutomatic(), new TypeDeleted());
-        DispositionModifier[] dispostionModifiers = {new ModifierError(), new 
ModifierFailed()};
+        Disposition disposition = new 
Disposition(DispositionActionMode.Manual, DispositionSendingMode.Automatic, 
DispositionType.Deleted);
+        DispositionModifier[] dispostionModifiers = 
{DispositionModifier.Error, DispositionModifier.Failed};
         disposition.setDispositionModifiers(dispostionModifiers);
 
         String final_recipient = null;
@@ -331,8 +315,8 @@ public class MDNFactoryTest {
 
     @Test
     public void generateMDNReportShouldFormatNullOriginalMessageId() {
-        Disposition disposition = new Disposition(new ActionModeManual(), new 
SendingModeAutomatic(), new TypeDeleted());
-        DispositionModifier[] dispostionModifiers = {new ModifierError(), new 
ModifierFailed()};
+        Disposition disposition = new 
Disposition(DispositionActionMode.Manual, DispositionSendingMode.Automatic, 
DispositionType.Deleted);
+        DispositionModifier[] dispostionModifiers = 
{DispositionModifier.Error, DispositionModifier.Failed};
         disposition.setDispositionModifiers(dispostionModifiers);
 
         String original_message_id = null;

http://git-wip-us.apache.org/repos/asf/james-project/blob/3d8120e9/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/RejectAction.java
----------------------------------------------------------------------
diff --git 
a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/RejectAction.java
 
b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/RejectAction.java
index c2ee308..d206303 100644
--- 
a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/RejectAction.java
+++ 
b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/RejectAction.java
@@ -31,11 +31,10 @@ import javax.mail.internet.MimeMultipart;
 
 import org.apache.james.mdn.Disposition;
 import org.apache.james.mdn.MDNFactory;
-import org.apache.james.mdn.action.mode.ActionModeAutomatic;
+import org.apache.james.mdn.action.mode.DispositionActionMode;
 import org.apache.james.mdn.modifier.DispositionModifier;
-import org.apache.james.mdn.modifier.ModifierError;
-import org.apache.james.mdn.sending.mode.SendingModeAutomatic;
-import org.apache.james.mdn.type.TypeDeleted;
+import org.apache.james.mdn.sending.mode.DispositionSendingMode;
+import org.apache.james.mdn.type.DispositionType;
 import org.apache.jsieve.mail.Action;
 import org.apache.jsieve.mail.ActionReject;
 import org.apache.mailet.Mail;
@@ -113,9 +112,9 @@ public class RejectAction implements MailAction {
 
         String original_message_id = aMail.getMessage().getMessageID();
 
-        DispositionModifier modifiers[] = {new ModifierError()};
-        Disposition disposition = new Disposition(new ActionModeAutomatic(),
-                new SendingModeAutomatic(), new TypeDeleted(), modifiers);
+        DispositionModifier modifiers[] = {DispositionModifier.Error};
+        Disposition disposition = new 
Disposition(DispositionActionMode.Automatic,
+                DispositionSendingMode.Automatic, DispositionType.Deleted, 
modifiers);
 
         MimeMultipart multiPart = MDNFactory.create(humanText.toString(),
                 reporting_UA_name, reporting_UA_product, original_recipient,


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

Reply via email to