mirror of
https://github.com/moparisthebest/davmail
synced 2024-12-13 03:02:22 -05:00
EWS: rename equals to isEqualTo and format search date
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1300 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
875e7894ff
commit
fddab4b812
@ -116,9 +116,9 @@ public abstract class ExchangeSession {
|
||||
private final String userName;
|
||||
|
||||
private boolean disableGalLookup;
|
||||
private static final String YYYY_MM_DD_HH_MM_SS = "yyyy/MM/dd HH:mm:ss";
|
||||
protected static final String YYYY_MM_DD_HH_MM_SS = "yyyy/MM/dd HH:mm:ss";
|
||||
private static final String YYYYMMDD_T_HHMMSS_Z = "yyyyMMdd'T'HHmmss'Z'";
|
||||
private static final String YYYY_MM_DD_T_HHMMSS_Z = "yyyy-MM-dd'T'HH:mm:ss'Z'";
|
||||
protected static final String YYYY_MM_DD_T_HHMMSS_Z = "yyyy-MM-dd'T'HH:mm:ss'Z'";
|
||||
private static final String YYYY_MM_DD = "yyyy-MM-dd";
|
||||
private static final String YYYY_MM_DD_T_HHMMSS_SSS_Z = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'";
|
||||
|
||||
@ -193,11 +193,7 @@ public abstract class ExchangeSession {
|
||||
* @param date date object
|
||||
* @return formatted search date
|
||||
*/
|
||||
public static String formatSearchDate(Date date) {
|
||||
SimpleDateFormat dateFormatter = new SimpleDateFormat(YYYY_MM_DD_HH_MM_SS, Locale.ENGLISH);
|
||||
dateFormatter.setTimeZone(GMT_TIMEZONE);
|
||||
return dateFormatter.format(date);
|
||||
}
|
||||
public abstract String formatSearchDate(Date date);
|
||||
|
||||
/**
|
||||
* Return standard zulu date formatter.
|
||||
@ -762,7 +758,7 @@ public abstract class ExchangeSession {
|
||||
* @param value attribute value
|
||||
* @return condition
|
||||
*/
|
||||
public abstract Condition equals(String attributeName, String value);
|
||||
public abstract Condition isEqualTo(String attributeName, String value);
|
||||
|
||||
/**
|
||||
* Equals condition.
|
||||
@ -771,7 +767,7 @@ public abstract class ExchangeSession {
|
||||
* @param value attribute value
|
||||
* @return condition
|
||||
*/
|
||||
public abstract Condition equals(String attributeName, int value);
|
||||
public abstract Condition isEqualTo(String attributeName, int value);
|
||||
|
||||
/**
|
||||
* MIME header equals condition.
|
||||
@ -780,7 +776,7 @@ public abstract class ExchangeSession {
|
||||
* @param value attribute value
|
||||
* @return condition
|
||||
*/
|
||||
public abstract Condition headerEquals(String headerName, String value);
|
||||
public abstract Condition headerIsEqualTo(String headerName, String value);
|
||||
|
||||
/**
|
||||
* Greater than or equals condition.
|
||||
@ -870,7 +866,7 @@ public abstract class ExchangeSession {
|
||||
* @throws IOException on error
|
||||
*/
|
||||
public List<Folder> getSubFolders(String folderName, boolean recursive) throws IOException {
|
||||
return getSubFolders(folderName, or(equals("folderclass", "IPF.Note"), isNull("folderclass")),
|
||||
return getSubFolders(folderName, or(isEqualTo("folderclass", "IPF.Note"), isNull("folderclass")),
|
||||
recursive);
|
||||
}
|
||||
|
||||
@ -883,7 +879,7 @@ public abstract class ExchangeSession {
|
||||
* @throws IOException on error
|
||||
*/
|
||||
public List<Folder> getSubCalendarFolders(String folderName, boolean recursive) throws IOException {
|
||||
return getSubFolders(folderName, equals("folderclass", "IPF.Appointment"), recursive);
|
||||
return getSubFolders(folderName, isEqualTo("folderclass", "IPF.Appointment"), recursive);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -939,7 +935,7 @@ public abstract class ExchangeSession {
|
||||
*/
|
||||
public void sendMessage(List<String> rcptToRecipients, MimeMessage mimeMessage) throws IOException, MessagingException {
|
||||
// check Sent folder for duplicates
|
||||
ExchangeSession.MessageList messages = searchMessages(SENT, headerEquals("message-id", mimeMessage.getMessageID()));
|
||||
ExchangeSession.MessageList messages = searchMessages(SENT, headerIsEqualTo("message-id", mimeMessage.getMessageID()));
|
||||
if (!messages.isEmpty()) {
|
||||
LOGGER.debug("Dropping message id " + mimeMessage.getMessageID() + ": already sent");
|
||||
} else {
|
||||
@ -2521,7 +2517,7 @@ public abstract class ExchangeSession {
|
||||
* @throws IOException on error
|
||||
*/
|
||||
public List<ExchangeSession.Contact> getAllContacts(String folderPath) throws IOException {
|
||||
return searchContacts(folderPath, ITEM_PROPERTIES, equals("outlookmessageclass", "IPM.Contact"));
|
||||
return searchContacts(folderPath, ITEM_PROPERTIES, isEqualTo("outlookmessageclass", "IPM.Contact"));
|
||||
}
|
||||
|
||||
|
||||
@ -2545,7 +2541,7 @@ public abstract class ExchangeSession {
|
||||
*/
|
||||
public List<Event> getEventMessages(String folderPath) throws IOException {
|
||||
return searchEvents(folderPath, ITEM_PROPERTIES,
|
||||
and(equals("outlookmessageclass", "IPM.Schedule.Meeting.Request"),
|
||||
and(isEqualTo("outlookmessageclass", "IPM.Schedule.Meeting.Request"),
|
||||
or(isNull("processed"), isFalse("processed"))));
|
||||
}
|
||||
|
||||
@ -2587,7 +2583,7 @@ public abstract class ExchangeSession {
|
||||
if (timeRangeEnd != null) {
|
||||
andCondition.add(lte("dtend", formatSearchDate(parser.parse(timeRangeEnd))));
|
||||
}
|
||||
andCondition.add(equals("instancetype", 0));
|
||||
andCondition.add(isEqualTo("instancetype", 0));
|
||||
return searchEvents(folderPath, ITEM_PROPERTIES, andCondition);
|
||||
} catch (ParseException e) {
|
||||
throw new IOException(e);
|
||||
@ -2607,14 +2603,14 @@ public abstract class ExchangeSession {
|
||||
Condition privateCondition = null;
|
||||
if (isSharedFolder(folderPath)) {
|
||||
LOGGER.debug("Shared or public calendar: exclude private events");
|
||||
privateCondition = equals("sensitivity", 0);
|
||||
privateCondition = isEqualTo("sensitivity", 0);
|
||||
}
|
||||
// instancetype 0 single appointment / 1 master recurring appointment
|
||||
return searchEvents(folderPath, ITEM_PROPERTIES,
|
||||
and(or(isNull("instancetype"),
|
||||
equals("instancetype", 1),
|
||||
and(equals("instancetype", 0), dateCondition)),
|
||||
equals("outlookmessageclass", "IPM.Appointment"),
|
||||
isEqualTo("instancetype", 1),
|
||||
and(isEqualTo("instancetype", 0), dateCondition)),
|
||||
isEqualTo("outlookmessageclass", "IPM.Appointment"),
|
||||
privateCondition));
|
||||
}
|
||||
|
||||
|
@ -51,6 +51,7 @@ import java.net.NoRouteToHostException;
|
||||
import java.net.URL;
|
||||
import java.net.UnknownHostException;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
|
||||
@ -501,17 +502,17 @@ public class DavExchangeSession extends ExchangeSession {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Condition equals(String attributeName, String value) {
|
||||
public Condition isEqualTo(String attributeName, String value) {
|
||||
return new AttributeCondition(attributeName, Operator.IsEqualTo, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Condition equals(String attributeName, int value) {
|
||||
public Condition isEqualTo(String attributeName, int value) {
|
||||
return new AttributeCondition(attributeName, Operator.IsEqualTo, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Condition headerEquals(String headerName, String value) {
|
||||
public Condition headerIsEqualTo(String headerName, String value) {
|
||||
return new HeaderCondition(headerName, Operator.IsEqualTo, value);
|
||||
}
|
||||
|
||||
@ -648,7 +649,7 @@ public class DavExchangeSession extends ExchangeSession {
|
||||
} else if (status == HttpStatus.SC_NOT_FOUND) {
|
||||
LOGGER.debug("Contact not found at " + encodedHref + ", searching permanenturl by urlcompname");
|
||||
// failover, search item by urlcompname
|
||||
MultiStatusResponse[] responses = searchItems(folderPath, EVENT_REQUEST_PROPERTIES, DavExchangeSession.this.equals("urlcompname", convertItemNameToEML(itemName)), FolderQueryTraversal.Shallow);
|
||||
MultiStatusResponse[] responses = searchItems(folderPath, EVENT_REQUEST_PROPERTIES, DavExchangeSession.this.isEqualTo("urlcompname", convertItemNameToEML(itemName)), FolderQueryTraversal.Shallow);
|
||||
if (responses.length == 1) {
|
||||
encodedHref = getPropertyIfExists(responses[0].getProperties(HttpStatus.SC_OK), "permanenturl");
|
||||
LOGGER.warn("Contact found, permanenturl is " + encodedHref);
|
||||
@ -861,7 +862,7 @@ public class DavExchangeSession extends ExchangeSession {
|
||||
} else if (status == HttpStatus.SC_NOT_FOUND) {
|
||||
LOGGER.debug("Event not found at " + encodedHref + ", searching permanenturl by urlcompname");
|
||||
// failover, search item by urlcompname
|
||||
MultiStatusResponse[] responses = searchItems(folderPath, EVENT_REQUEST_PROPERTIES, DavExchangeSession.this.equals("urlcompname", convertItemNameToEML(itemName)), FolderQueryTraversal.Shallow);
|
||||
MultiStatusResponse[] responses = searchItems(folderPath, EVENT_REQUEST_PROPERTIES, DavExchangeSession.this.isEqualTo("urlcompname", convertItemNameToEML(itemName)), FolderQueryTraversal.Shallow);
|
||||
if (responses.length == 1) {
|
||||
encodedHref = getPropertyIfExists(responses[0].getProperties(HttpStatus.SC_OK), "permanenturl");
|
||||
LOGGER.warn("Event found, permanenturl is " + encodedHref);
|
||||
@ -1182,7 +1183,7 @@ public class DavExchangeSession extends ExchangeSession {
|
||||
public List<ExchangeSession.Contact> searchContacts(String folderPath, Set<String> attributes, Condition condition) throws IOException {
|
||||
List<ExchangeSession.Contact> contacts = new ArrayList<ExchangeSession.Contact>();
|
||||
MultiStatusResponse[] responses = searchItems(folderPath, attributes,
|
||||
and(equals("outlookmessageclass", "IPM.Contact"), isFalse("isfolder"), isFalse("ishidden"), condition),
|
||||
and(isEqualTo("outlookmessageclass", "IPM.Contact"), isFalse("isfolder"), isFalse("ishidden"), condition),
|
||||
FolderQueryTraversal.Shallow);
|
||||
for (MultiStatusResponse response : responses) {
|
||||
contacts.add(new Contact(response));
|
||||
@ -1267,7 +1268,7 @@ public class DavExchangeSession extends ExchangeSession {
|
||||
} catch (HttpNotFoundException e) {
|
||||
LOGGER.debug(itemPath + " not found, searching by urlcompname");
|
||||
// failover: try to get event by displayname
|
||||
responses = searchItems(folderPath, EVENT_REQUEST_PROPERTIES, equals("urlcompname", emlItemName), FolderQueryTraversal.Shallow);
|
||||
responses = searchItems(folderPath, EVENT_REQUEST_PROPERTIES, isEqualTo("urlcompname", emlItemName), FolderQueryTraversal.Shallow);
|
||||
if (responses.length == 0) {
|
||||
throw new HttpNotFoundException(itemPath + " not found");
|
||||
}
|
||||
@ -1277,7 +1278,7 @@ public class DavExchangeSession extends ExchangeSession {
|
||||
String urlcompname = getPropertyIfExists(responses[0].getProperties(HttpStatus.SC_OK), "urlcompname");
|
||||
if ("urn:content-classes:person".equals(contentClass)) {
|
||||
// retrieve Contact properties
|
||||
List<ExchangeSession.Contact> contacts = searchContacts(folderPath, CONTACT_ATTRIBUTES, equals("urlcompname", urlcompname));
|
||||
List<ExchangeSession.Contact> contacts = searchContacts(folderPath, CONTACT_ATTRIBUTES, isEqualTo("urlcompname", urlcompname));
|
||||
if (contacts.isEmpty()) {
|
||||
LOGGER.warn("Item found, but unable to build contact");
|
||||
throw new HttpNotFoundException(itemPath + " not found");
|
||||
@ -1453,7 +1454,7 @@ public class DavExchangeSession extends ExchangeSession {
|
||||
Set<String> attributes = new HashSet<String>();
|
||||
attributes.add("roamingdictionary");
|
||||
|
||||
MultiStatusResponse[] responses = searchItems("/users/" + getEmail() + "/NON_IPM_SUBTREE", attributes, equals("messageclass", "IPM.Configuration.OWA.UserOptions"), DavExchangeSession.FolderQueryTraversal.Deep);
|
||||
MultiStatusResponse[] responses = searchItems("/users/" + getEmail() + "/NON_IPM_SUBTREE", attributes, isEqualTo("messageclass", "IPM.Configuration.OWA.UserOptions"), DavExchangeSession.FolderQueryTraversal.Deep);
|
||||
if (responses.length == 1) {
|
||||
byte[] roamingdictionary = getBinaryPropertyIfExists(responses[0].getProperties(HttpStatus.SC_OK), "roamingdictionary");
|
||||
if (roamingdictionary != null) {
|
||||
@ -1742,4 +1743,18 @@ public class DavExchangeSession extends ExchangeSession {
|
||||
}
|
||||
return zuluDateValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format date to exchange search format.
|
||||
*
|
||||
* @param date date object
|
||||
* @return formatted search date
|
||||
*/
|
||||
@Override
|
||||
public String formatSearchDate(Date date) {
|
||||
SimpleDateFormat dateFormatter = new SimpleDateFormat(YYYY_MM_DD_HH_MM_SS, Locale.ENGLISH);
|
||||
dateFormatter.setTimeZone(GMT_TIMEZONE);
|
||||
return dateFormatter.format(date);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -36,6 +36,7 @@ import java.net.HttpURLConnection;
|
||||
import java.net.NoRouteToHostException;
|
||||
import java.net.UnknownHostException;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
@ -428,17 +429,17 @@ public class EwsExchangeSession extends ExchangeSession {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Condition equals(String attributeName, String value) {
|
||||
public Condition isEqualTo(String attributeName, String value) {
|
||||
return new AttributeCondition(attributeName, Operator.IsEqualTo, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Condition equals(String attributeName, int value) {
|
||||
public Condition isEqualTo(String attributeName, int value) {
|
||||
return new AttributeCondition(attributeName, Operator.IsEqualTo, String.valueOf(value));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Condition headerEquals(String headerName, String value) {
|
||||
public Condition headerIsEqualTo(String headerName, String value) {
|
||||
return new HeaderCondition(headerName, Operator.IsEqualTo, value);
|
||||
}
|
||||
|
||||
@ -714,7 +715,7 @@ public class EwsExchangeSession extends ExchangeSession {
|
||||
String currentEtag = null;
|
||||
ItemId currentItemId = null;
|
||||
FileAttachment currentFileAttachment = null;
|
||||
List<EWSMethod.Item> responses = searchItems(folderPath, EVENT_REQUEST_PROPERTIES, EwsExchangeSession.this.equals("urlcompname", urlcompname), FolderQueryTraversal.SHALLOW);
|
||||
List<EWSMethod.Item> responses = searchItems(folderPath, EVENT_REQUEST_PROPERTIES, EwsExchangeSession.this.isEqualTo("urlcompname", urlcompname), FolderQueryTraversal.SHALLOW);
|
||||
if (!responses.isEmpty()) {
|
||||
EWSMethod.Item response = responses.get(0);
|
||||
currentItemId = new ItemId(response);
|
||||
@ -836,7 +837,7 @@ public class EwsExchangeSession extends ExchangeSession {
|
||||
String urlcompname = convertItemNameToEML(itemName);
|
||||
String currentEtag = null;
|
||||
ItemId currentItemId = null;
|
||||
List<EWSMethod.Item> responses = searchItems(folderPath, EVENT_REQUEST_PROPERTIES, EwsExchangeSession.this.equals("urlcompname", urlcompname), FolderQueryTraversal.SHALLOW);
|
||||
List<EWSMethod.Item> responses = searchItems(folderPath, EVENT_REQUEST_PROPERTIES, EwsExchangeSession.this.isEqualTo("urlcompname", urlcompname), FolderQueryTraversal.SHALLOW);
|
||||
if (!responses.isEmpty()) {
|
||||
EWSMethod.Item response = responses.get(0);
|
||||
currentItemId = new ItemId(response);
|
||||
@ -952,14 +953,14 @@ public class EwsExchangeSession extends ExchangeSession {
|
||||
@Override
|
||||
public Item getItem(String folderPath, String itemName) throws IOException {
|
||||
String urlcompname = convertItemNameToEML(itemName);
|
||||
List<EWSMethod.Item> responses = searchItems(folderPath, EVENT_REQUEST_PROPERTIES, equals("urlcompname", urlcompname), FolderQueryTraversal.SHALLOW);
|
||||
List<EWSMethod.Item> responses = searchItems(folderPath, EVENT_REQUEST_PROPERTIES, isEqualTo("urlcompname", urlcompname), FolderQueryTraversal.SHALLOW);
|
||||
if (responses.isEmpty()) {
|
||||
throw new DavMailException("EXCEPTION_ITEM_NOT_FOUND");
|
||||
}
|
||||
String itemType = responses.get(0).type;
|
||||
if ("Contact".equals(itemType)) {
|
||||
// retrieve Contact properties
|
||||
List<ExchangeSession.Contact> contacts = searchContacts(folderPath, CONTACT_ATTRIBUTES, equals("urlcompname", urlcompname));
|
||||
List<ExchangeSession.Contact> contacts = searchContacts(folderPath, CONTACT_ATTRIBUTES, isEqualTo("urlcompname", urlcompname));
|
||||
if (contacts.isEmpty()) {
|
||||
throw new DavMailException("EXCEPTION_ITEM_NOT_FOUND");
|
||||
}
|
||||
@ -1005,7 +1006,7 @@ public class EwsExchangeSession extends ExchangeSession {
|
||||
@Override
|
||||
public void deleteItem(String folderPath, String itemName) throws IOException {
|
||||
String urlcompname = convertItemNameToEML(itemName);
|
||||
List<EWSMethod.Item> responses = searchItems(folderPath, EVENT_REQUEST_PROPERTIES, equals("urlcompname", urlcompname), FolderQueryTraversal.SHALLOW);
|
||||
List<EWSMethod.Item> responses = searchItems(folderPath, EVENT_REQUEST_PROPERTIES, isEqualTo("urlcompname", urlcompname), FolderQueryTraversal.SHALLOW);
|
||||
if (!responses.isEmpty()) {
|
||||
DeleteItemMethod deleteItemMethod = new DeleteItemMethod(new ItemId(responses.get(0)), DeleteType.HardDelete);
|
||||
executeMethod(deleteItemMethod);
|
||||
@ -1015,7 +1016,7 @@ public class EwsExchangeSession extends ExchangeSession {
|
||||
@Override
|
||||
public void processItem(String folderPath, String itemName) throws IOException {
|
||||
String urlcompname = convertItemNameToEML(itemName);
|
||||
List<EWSMethod.Item> responses = searchItems(folderPath, EVENT_REQUEST_PROPERTIES, equals("urlcompname", urlcompname), FolderQueryTraversal.SHALLOW);
|
||||
List<EWSMethod.Item> responses = searchItems(folderPath, EVENT_REQUEST_PROPERTIES, isEqualTo("urlcompname", urlcompname), FolderQueryTraversal.SHALLOW);
|
||||
if (!responses.isEmpty()) {
|
||||
HashMap<String, String> localProperties = new HashMap<String, String>();
|
||||
localProperties.put("processed", "1");
|
||||
@ -1157,5 +1158,19 @@ public class EwsExchangeSession extends ExchangeSession {
|
||||
return zuluDateValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format date to exchange search format.
|
||||
*
|
||||
* @param date date object
|
||||
* @return formatted search date
|
||||
*/
|
||||
@Override
|
||||
public String formatSearchDate(Date date) {
|
||||
SimpleDateFormat dateFormatter = new SimpleDateFormat(YYYY_MM_DD_T_HHMMSS_Z, Locale.ENGLISH);
|
||||
dateFormatter.setTimeZone(GMT_TIMEZONE);
|
||||
return dateFormatter.format(date);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -1042,7 +1042,7 @@ public class ImapConnection extends AbstractConnection {
|
||||
return session.isFalse("read");
|
||||
} else if ("DELETED".equals(token)) {
|
||||
// conditions.deleted = Boolean.TRUE;
|
||||
return session.equals("deleted", "1");
|
||||
return session.isEqualTo("deleted", "1");
|
||||
} else if ("UNDELETED".equals(token) || "NOT DELETED".equals(token)) {
|
||||
// conditions.deleted = Boolean.FALSE;
|
||||
return session.isNull("deleted");
|
||||
@ -1060,7 +1060,7 @@ public class ImapConnection extends AbstractConnection {
|
||||
if ("message-id".equals(headerName) && !value.startsWith("<")) {
|
||||
value = '<' + value + '>';
|
||||
}
|
||||
return session.headerEquals(headerName, value);
|
||||
return session.headerIsEqualTo(headerName, value);
|
||||
} else if ("UID".equals(token)) {
|
||||
String range = tokens.nextToken();
|
||||
if ("1:*".equals(range)) {
|
||||
|
@ -1091,7 +1091,7 @@ public class LdapConnection extends AbstractConnection {
|
||||
ExchangeSession.Condition condition = null;
|
||||
|
||||
if (operator == LDAP_FILTER_EQUALITY) {
|
||||
condition = session.equals(contactAttributeName, value);
|
||||
condition = session.isEqualTo(contactAttributeName, value);
|
||||
} else if ("*".equals(value)) {
|
||||
condition = session.not(session.isNull(contactAttributeName));
|
||||
// do not allow substring search on integer field imapUid
|
||||
@ -1263,7 +1263,7 @@ public class LdapConnection extends AbstractConnection {
|
||||
try {
|
||||
// check if this is a contact uid
|
||||
Integer.parseInt(uid);
|
||||
persons = contactFind(session.equals("imapUid", uid), returningAttributes);
|
||||
persons = contactFind(session.isEqualTo("imapUid", uid), returningAttributes);
|
||||
} catch (NumberFormatException e) {
|
||||
// ignore, this is not a contact uid
|
||||
}
|
||||
|
@ -156,7 +156,7 @@ public class TestCaldav extends AbstractDavMailTestCase {
|
||||
session.gt("dtstart", session.formatSearchDate(start)),
|
||||
session.lt("dtend", session.formatSearchDate(end))
|
||||
)
|
||||
, session.or(session.equals("instancetype", 1), session.equals("instancetype", 0))
|
||||
, session.or(session.isEqualTo("instancetype", 1), session.isEqualTo("instancetype", 0))
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -104,7 +104,7 @@ public class TestExchangeSessionMessage extends AbstractExchangeSessionTestCase
|
||||
HashMap<String, String> properties = new HashMap<String, String>();
|
||||
properties.put("draft", "0");
|
||||
session.createMessage("testfolder", messageName, properties, getMimeBody(mimeMessage));
|
||||
ExchangeSession.MessageList messageList = session.searchMessages("testfolder", session.equals("urlcompname", messageName));
|
||||
ExchangeSession.MessageList messageList = session.searchMessages("testfolder", session.isEqualTo("urlcompname", messageName));
|
||||
assertNotNull(messageList);
|
||||
assertEquals(1, messageList.size());
|
||||
}
|
||||
@ -117,7 +117,7 @@ public class TestExchangeSessionMessage extends AbstractExchangeSessionTestCase
|
||||
HashMap<String, String> properties = new HashMap<String, String>();
|
||||
properties.put("draft", "0");
|
||||
session.createMessage("testfolder", messageName, properties, getMimeBody(mimeMessage));
|
||||
ExchangeSession.MessageList messageList = session.searchMessages("testfolder", session.equals("urlcompname", messageName));
|
||||
ExchangeSession.MessageList messageList = session.searchMessages("testfolder", session.isEqualTo("urlcompname", messageName));
|
||||
assertNotNull(messageList);
|
||||
assertEquals(1, messageList.size());
|
||||
}
|
||||
@ -131,7 +131,7 @@ public class TestExchangeSessionMessage extends AbstractExchangeSessionTestCase
|
||||
HashMap<String, String> properties = new HashMap<String, String>();
|
||||
properties.put("draft", "0");
|
||||
session.createMessage("testfolder", messageName, properties, getMimeBody(mimeMessage));
|
||||
ExchangeSession.MessageList messageList = session.searchMessages("testfolder", session.equals("urlcompname", messageName));
|
||||
ExchangeSession.MessageList messageList = session.searchMessages("testfolder", session.isEqualTo("urlcompname", messageName));
|
||||
assertNotNull(messageList);
|
||||
assertEquals(1, messageList.size());
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ public class TestExchangeSessionSearchContact extends AbstractExchangeSessionTes
|
||||
attributes.add("uid");
|
||||
List<ExchangeSession.Contact> contacts = session.searchContacts(ExchangeSession.CONTACTS, attributes, null);
|
||||
for (ExchangeSession.Contact contact : contacts) {
|
||||
System.out.println(session.searchContacts(ExchangeSession.CONTACTS, attributes, session.equals("uid", contact.get("uid"))));
|
||||
System.out.println(session.searchContacts(ExchangeSession.CONTACTS, attributes, session.isEqualTo("uid", contact.get("uid"))));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -112,7 +112,7 @@ public class TestDavExchangeSession extends AbstractExchangeSessionTestCase {
|
||||
Set<String> attributes = new HashSet<String>();
|
||||
attributes.add("permanenturl");
|
||||
attributes.add("roamingxmlstream");
|
||||
MultiStatusResponse[] responses = davSession.searchItems("/users/" + davSession.getEmail() + "/calendar", attributes, davSession.and(davSession.isFalse("isfolder"), davSession.equals("messageclass", "IPM.Configuration.CategoryList")), DavExchangeSession.FolderQueryTraversal.Shallow);
|
||||
MultiStatusResponse[] responses = davSession.searchItems("/users/" + davSession.getEmail() + "/calendar", attributes, davSession.and(davSession.isFalse("isfolder"), davSession.isEqualTo("messageclass", "IPM.Configuration.CategoryList")), DavExchangeSession.FolderQueryTraversal.Shallow);
|
||||
String value = (String) responses[0].getProperties(HttpStatus.SC_OK).get(Field.getPropertyName("roamingxmlstream")).getValue();
|
||||
String propertyList = new String(Base64.decodeBase64(value.getBytes()), "UTF-8");
|
||||
System.out.println(propertyList);
|
||||
@ -127,7 +127,7 @@ public class TestDavExchangeSession extends AbstractExchangeSessionTestCase {
|
||||
Set<String> attributes = new HashSet<String>();
|
||||
attributes.add("permanenturl");
|
||||
attributes.add("roamingxmlstream");
|
||||
MultiStatusResponse[] responses = davSession.searchItems("/users/" + davSession.getEmail() + "/calendar", attributes, davSession.and(davSession.isFalse("isfolder"), davSession.equals("messageclass", "IPM.Configuration.Calendar")), DavExchangeSession.FolderQueryTraversal.Shallow);
|
||||
MultiStatusResponse[] responses = davSession.searchItems("/users/" + davSession.getEmail() + "/calendar", attributes, davSession.and(davSession.isFalse("isfolder"), davSession.isEqualTo("messageclass", "IPM.Configuration.Calendar")), DavExchangeSession.FolderQueryTraversal.Shallow);
|
||||
String value = (String) responses[0].getProperties(HttpStatus.SC_OK).get(Field.getPropertyName("roamingxmlstream")).getValue();
|
||||
String propertyList = new String(Base64.decodeBase64(value.getBytes()), "UTF-8");
|
||||
System.out.println(propertyList);
|
||||
|
@ -114,7 +114,7 @@ public class TestSmtp extends AbstractDavMailTestCase {
|
||||
// wait for asynchronous message send
|
||||
ExchangeSession.MessageList messages = null;
|
||||
for (int i=0;i<5;i++) {
|
||||
messages = session.searchMessages("Sent", session.headerEquals("message-id", mimeMessage.getMessageID()));
|
||||
messages = session.searchMessages("Sent", session.headerIsEqualTo("message-id", mimeMessage.getMessageID()));
|
||||
if (messages.size() > 0) {
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user