2010-06-07 17:19:09 -04:00
|
|
|
/*
|
|
|
|
* DavMail POP/IMAP/SMTP/CalDav/LDAP Exchange Gateway
|
|
|
|
* Copyright (C) 2010 Mickael Guessant
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
package davmail.exchange.ews;
|
|
|
|
|
2010-07-20 11:00:48 -04:00
|
|
|
import davmail.util.StringUtil;
|
|
|
|
|
2010-06-07 17:19:09 -04:00
|
|
|
/**
|
|
|
|
* Indexed FieldURI
|
|
|
|
*/
|
|
|
|
public class IndexedFieldURI implements FieldURI {
|
2010-07-19 05:22:42 -04:00
|
|
|
protected final String fieldURI;
|
|
|
|
protected final String fieldIndex;
|
2010-11-09 06:47:34 -05:00
|
|
|
protected final String fieldItemType;
|
|
|
|
protected final String collectionName;
|
2010-06-07 17:19:09 -04:00
|
|
|
|
2010-07-10 20:13:28 -04:00
|
|
|
/**
|
|
|
|
* Create indexed field uri.
|
2010-08-18 12:56:25 -04:00
|
|
|
*
|
2011-06-08 15:58:29 -04:00
|
|
|
* @param fieldURI base field uri
|
|
|
|
* @param fieldIndex field name
|
|
|
|
* @param fieldItemType field item type
|
|
|
|
* @param collectionName collection name
|
2010-07-10 20:13:28 -04:00
|
|
|
*/
|
2010-11-09 06:47:34 -05:00
|
|
|
public IndexedFieldURI(String fieldURI, String fieldIndex, String fieldItemType, String collectionName) {
|
2010-06-07 17:19:09 -04:00
|
|
|
this.fieldURI = fieldURI;
|
|
|
|
this.fieldIndex = fieldIndex;
|
2010-11-09 06:47:34 -05:00
|
|
|
this.fieldItemType = fieldItemType;
|
|
|
|
this.collectionName = collectionName;
|
2010-06-07 17:19:09 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
public void appendTo(StringBuilder buffer) {
|
|
|
|
buffer.append("<t:IndexedFieldURI FieldURI=\"").append(fieldURI);
|
|
|
|
buffer.append("\" FieldIndex=\"").append(fieldIndex);
|
|
|
|
buffer.append("\"/>");
|
|
|
|
}
|
2010-06-29 10:15:50 -04:00
|
|
|
|
|
|
|
public void appendValue(StringBuilder buffer, String itemType, String value) {
|
2010-11-09 06:47:34 -05:00
|
|
|
if (itemType != null) {
|
|
|
|
// append IndexedFieldURI
|
|
|
|
appendTo(buffer);
|
|
|
|
buffer.append("<t:").append(fieldItemType).append('>');
|
|
|
|
buffer.append("<t:").append(collectionName).append('>');
|
|
|
|
}
|
2010-09-21 09:12:19 -04:00
|
|
|
buffer.append("<t:Entry Key=\"").append(fieldIndex).append("\">");
|
2011-02-23 17:23:06 -05:00
|
|
|
buffer.append(StringUtil.xmlEncodeAttribute(value));
|
2010-09-21 09:12:19 -04:00
|
|
|
buffer.append("</t:Entry>");
|
2010-11-09 06:47:34 -05:00
|
|
|
if (itemType != null) {
|
|
|
|
buffer.append("</t:").append(collectionName).append('>');
|
|
|
|
buffer.append("</t:").append(fieldItemType).append('>');
|
|
|
|
}
|
2010-06-29 10:15:50 -04:00
|
|
|
}
|
2010-07-01 12:12:57 -04:00
|
|
|
|
|
|
|
public String getResponseName() {
|
|
|
|
return fieldIndex;
|
|
|
|
}
|
2010-06-07 17:19:09 -04:00
|
|
|
}
|