1 17 package org.apache.james.util.mail.mdn; 18 19 23 public class Disposition 24 { 25 private DispositionActionMode fieldActionMode; 26 private DispositionSendingMode fieldSendingMode; 27 private DispositionType fieldDispositionType; 28 private DispositionModifier[] fieldDispositionModifiers; 29 30 33 private Disposition() 34 { 35 super(); 36 } 37 38 45 public Disposition(DispositionActionMode actionMode, DispositionSendingMode sendingMode, DispositionType type) 46 { 47 this(); 48 setActionMode(actionMode); 49 setSendingMode(sendingMode); 50 setDispositionType(type); 51 } 52 53 61 public Disposition(DispositionActionMode actionMode, DispositionSendingMode sendingMode, DispositionType type, 62 DispositionModifier[] modifiers) 63 { 64 this(actionMode, sendingMode, type); 65 setDispositionModifiers(modifiers); 66 } 67 68 73 protected DispositionActionMode getActionMode() 74 { 75 return fieldActionMode; 76 } 77 78 83 protected void setActionMode(DispositionActionMode dispostionMode) 84 { 85 fieldActionMode = dispostionMode; 86 } 87 88 93 protected DispositionModifier[] getDispositionModifiers() 94 { 95 return fieldDispositionModifiers; 96 } 97 98 103 protected void setDispositionModifiers(DispositionModifier[] dispostionModifiers) 104 { 105 fieldDispositionModifiers = dispostionModifiers; 106 } 107 108 113 protected DispositionType getDispositionType() 114 { 115 return fieldDispositionType; 116 } 117 118 123 protected void setDispositionType(DispositionType dispostionType) 124 { 125 fieldDispositionType = dispostionType; 126 } 127 128 131 public String toString() 132 { 133 StringBuffer buffer = new StringBuffer (64); 134 buffer.append("Disposition: "); 135 buffer.append(getActionMode() == null ? "" : getActionMode().toString()); 136 buffer.append('/'); 137 buffer.append(getSendingMode() == null ? "" : getSendingMode().toString()); 138 buffer.append(';'); 139 buffer.append(getDispositionType() == null ? "" : getDispositionType().toString()); 140 if (null != getDispositionModifiers() 141 && getDispositionModifiers().length > 0) 142 { 143 buffer.append('/'); 144 for (int i = 0; i < getDispositionModifiers().length; i++) 145 { 146 if (i > 0) 147 buffer.append(','); 148 buffer.append(getDispositionModifiers()[i]); 149 } 150 } 151 return buffer.toString(); 152 } 153 154 159 protected DispositionSendingMode getSendingMode() 160 { 161 return fieldSendingMode; 162 } 163 164 169 protected void setSendingMode(DispositionSendingMode sendingMode) 170 { 171 fieldSendingMode = sendingMode; 172 } 173 } 174 | Popular Tags |