mirror of
https://github.com/moparisthebest/davmail
synced 2024-12-14 11:42:23 -05:00
EWS: fix from audit
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1112 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
342b5d4e12
commit
f52ea840e4
@ -45,7 +45,7 @@ public class EwsExchangeSession extends ExchangeSession {
|
|||||||
public FolderId folderId;
|
public FolderId folderId;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected class FolderPath {
|
protected static class FolderPath {
|
||||||
protected String parentPath;
|
protected String parentPath;
|
||||||
protected String folderName;
|
protected String folderName;
|
||||||
|
|
||||||
@ -94,14 +94,14 @@ public class EwsExchangeSession extends ExchangeSession {
|
|||||||
try {
|
try {
|
||||||
folderIdMap = new HashMap<String, String>();
|
folderIdMap = new HashMap<String, String>();
|
||||||
// load actual well known folder ids
|
// load actual well known folder ids
|
||||||
folderIdMap.put(getFolder(INBOX).folderId.value, INBOX);
|
folderIdMap.put(internalGetFolder(INBOX).folderId.value, INBOX);
|
||||||
folderIdMap.put(getFolder(CALENDAR).folderId.value, CALENDAR);
|
folderIdMap.put(internalGetFolder(CALENDAR).folderId.value, CALENDAR);
|
||||||
folderIdMap.put(getFolder(CONTACTS).folderId.value, CONTACTS);
|
folderIdMap.put(internalGetFolder(CONTACTS).folderId.value, CONTACTS);
|
||||||
folderIdMap.put(getFolder(SENT).folderId.value, SENT);
|
folderIdMap.put(internalGetFolder(SENT).folderId.value, SENT);
|
||||||
folderIdMap.put(getFolder(DRAFTS).folderId.value, DRAFTS);
|
folderIdMap.put(internalGetFolder(DRAFTS).folderId.value, DRAFTS);
|
||||||
folderIdMap.put(getFolder(TRASH).folderId.value, TRASH);
|
folderIdMap.put(internalGetFolder(TRASH).folderId.value, TRASH);
|
||||||
folderIdMap.put(getFolder(JUNK).folderId.value, JUNK);
|
folderIdMap.put(internalGetFolder(JUNK).folderId.value, JUNK);
|
||||||
folderIdMap.put(getFolder(UNSENT).folderId.value, UNSENT);
|
folderIdMap.put(internalGetFolder(UNSENT).folderId.value, UNSENT);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
LOGGER.error(e.getMessage(), e);
|
LOGGER.error(e.getMessage(), e);
|
||||||
throw new DavMailAuthenticationException("EXCEPTION_EWS_NOT_AVAILABLE");
|
throw new DavMailAuthenticationException("EXCEPTION_EWS_NOT_AVAILABLE");
|
||||||
@ -147,7 +147,6 @@ public class EwsExchangeSession extends ExchangeSession {
|
|||||||
super(operator, condition);
|
super(operator, condition);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void appendTo(StringBuilder buffer) {
|
public void appendTo(StringBuilder buffer) {
|
||||||
buffer.append("<t:").append(operator.toString()).append('>');
|
buffer.append("<t:").append(operator.toString()).append('>');
|
||||||
|
|
||||||
@ -164,7 +163,6 @@ public class EwsExchangeSession extends ExchangeSession {
|
|||||||
super(condition);
|
super(condition);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void appendTo(StringBuilder buffer) {
|
public void appendTo(StringBuilder buffer) {
|
||||||
buffer.append("<t:Not>");
|
buffer.append("<t:Not>");
|
||||||
condition.appendTo(buffer);
|
condition.appendTo(buffer);
|
||||||
@ -202,7 +200,6 @@ public class EwsExchangeSession extends ExchangeSession {
|
|||||||
return fieldURI;
|
return fieldURI;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void appendTo(StringBuilder buffer) {
|
public void appendTo(StringBuilder buffer) {
|
||||||
buffer.append("<t:").append(operator.toString());
|
buffer.append("<t:").append(operator.toString());
|
||||||
if (containmentMode != null) {
|
if (containmentMode != null) {
|
||||||
@ -235,14 +232,13 @@ public class EwsExchangeSession extends ExchangeSession {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static class IsNullCondition extends ExchangeSession.Condition implements SearchExpression {
|
protected static class IsNullCondition implements ExchangeSession.Condition, SearchExpression {
|
||||||
protected String attributeName;
|
protected String attributeName;
|
||||||
|
|
||||||
protected IsNullCondition(String attributeName) {
|
protected IsNullCondition(String attributeName) {
|
||||||
this.attributeName = attributeName;
|
this.attributeName = attributeName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void appendTo(StringBuilder buffer) {
|
public void appendTo(StringBuilder buffer) {
|
||||||
buffer.append("<t:Not><t:Exists>");
|
buffer.append("<t:Not><t:Exists>");
|
||||||
attributeMap.get(attributeName).appendTo(buffer);
|
attributeMap.get(attributeName).appendTo(buffer);
|
||||||
@ -251,12 +247,12 @@ public class EwsExchangeSession extends ExchangeSession {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MultiCondition and(Condition... condition) {
|
public ExchangeSession.MultiCondition and(Condition... condition) {
|
||||||
return new MultiCondition(Operator.And, condition);
|
return new MultiCondition(Operator.And, condition);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MultiCondition or(Condition... condition) {
|
public ExchangeSession.MultiCondition or(Condition... condition) {
|
||||||
return new MultiCondition(Operator.Or, condition);
|
return new MultiCondition(Operator.Or, condition);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -380,7 +376,18 @@ public class EwsExchangeSession extends ExchangeSession {
|
|||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public EwsExchangeSession.Folder getFolder(String folderPath) throws IOException {
|
public ExchangeSession.Folder getFolder(String folderPath) throws IOException {
|
||||||
|
return internalGetFolder(folderPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get folder by path.
|
||||||
|
*
|
||||||
|
* @param folderPath folder path
|
||||||
|
* @return folder object
|
||||||
|
* @throws IOException on error
|
||||||
|
*/
|
||||||
|
protected EwsExchangeSession.Folder internalGetFolder(String folderPath) throws IOException {
|
||||||
GetFolderMethod getFolderMethod = new GetFolderMethod(BaseShape.ID_ONLY, getFolderId(folderPath), FOLDER_PROPERTIES);
|
GetFolderMethod getFolderMethod = new GetFolderMethod(BaseShape.ID_ONLY, getFolderId(folderPath), FOLDER_PROPERTIES);
|
||||||
executeMethod(getFolderMethod);
|
executeMethod(getFolderMethod);
|
||||||
EWSMethod.Item item = getFolderMethod.getResponseItem();
|
EWSMethod.Item item = getFolderMethod.getResponseItem();
|
||||||
@ -416,7 +423,7 @@ public class EwsExchangeSession extends ExchangeSession {
|
|||||||
DeleteFolderMethod deleteFolderMethod = new DeleteFolderMethod(folderId);
|
DeleteFolderMethod deleteFolderMethod = new DeleteFolderMethod(folderId);
|
||||||
executeMethod(deleteFolderMethod);
|
executeMethod(deleteFolderMethod);
|
||||||
} else {
|
} else {
|
||||||
LOGGER.debug("Folder "+folderPath+" not found");
|
LOGGER.debug("Folder " + folderPath + " not found");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user