* org.apache.james.mailbox.store.user.SubscriptionMapper#delete(org.apache
* .james.imap.store.user.model.Subscription)
*/
public void delete(Subscription subscription) throws SubscriptionException {
JCRSubscription sub = (JCRSubscription) subscription;
try {
Node node = sub.getNode();
if (node != null) {
Property prop = node.getProperty(JCRSubscription.MAILBOXES_PROPERTY);
Value[] values = prop.getValues();
List<String> newValues = new ArrayList<String>();
for (int i = 0; i < values.length; i++) {
String m = values[i].getString();
if (m.equals(sub.getMailbox()) == false) {
newValues.add(m);
}
}
if (newValues.isEmpty() == false) {
prop.setValue(newValues.toArray(new String[newValues.size()]));