1
0
mirror of https://github.com/moparisthebest/davmail synced 2024-12-13 03:02:22 -05:00

More fixes from audit

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1474 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2010-09-24 08:44:13 +00:00
parent fe73982491
commit cabb7b6c1f
11 changed files with 83 additions and 9 deletions

View File

@ -42,9 +42,15 @@ public class ICSBufferedWriter {
* @param line ics event line
*/
public void writeLine(String line) {
writeLine(line, false);
writeLine(line, false);
}
/**
* Write line with or without continuation prefix.
*
* @param line line content
* @param prefix continuation flag
*/
public void writeLine(String line, boolean prefix) {
int maxLength = 77;
if (prefix) {

View File

@ -252,7 +252,7 @@ public class ExchangePropPatchMethod extends PostMethod {
protected void handleProperty(XMLStreamReader reader, MultiStatusResponse multiStatusResponse) throws XMLStreamException {
while (reader.hasNext() && !XMLStreamUtil.isEndTag(reader, "prop")){
while (reader.hasNext() && !XMLStreamUtil.isEndTag(reader, "prop")) {
reader.next();
if (XMLStreamUtil.isStartTag(reader)) {
String tagLocalName = reader.getLocalName();
@ -288,6 +288,12 @@ public class ExchangePropPatchMethod extends PostMethod {
return responses.get(0);
}
/**
* Return method http status code.
*
* @return http status code
* @throws HttpException on error
*/
public int getResponseStatusCode() throws HttpException {
String responseDescription = getResponse().getResponseDescription();
if ("HTTP/1.1 201 Created".equals(responseDescription)) {

View File

@ -25,8 +25,9 @@ public class DeleteItemMethod extends EWSMethod {
/**
* Delete item method.
*
* @param itemId item id
* @param deleteType delete mode
* @param itemId item id
* @param deleteType delete mode
* @param sendMeetingCancellations send meeting cancellation notifications
*/
public DeleteItemMethod(ItemId itemId, DeleteType deleteType, SendMeetingCancellations sendMeetingCancellations) {
super("Item", "DeleteItem");

View File

@ -412,10 +412,25 @@ public abstract class EWSMethod extends PostMethod {
this.serverVersion = serverVersion;
}
/**
* Meeting attendee object
*/
public static class Attendee {
/**
* attendee role
*/
public String role;
/**
* attendee email address
*/
public String email;
/**
* attendee participation status
*/
public String partstat;
/**
* attendee fullname
*/
public String name;
}
@ -565,10 +580,18 @@ public abstract class EWSMethod extends PostMethod {
return result;
}
/**
* Get all attendees.
* @return all attendees
*/
public List<Attendee> getAttendees() {
return attendees;
}
/**
* Add attendee.
* @param attendee attendee object
*/
public void addAttendee(Attendee attendee) {
if (attendees == null) {
attendees = new ArrayList<Attendee>();

View File

@ -29,12 +29,22 @@ public class FileAttachment {
protected String contentType;
protected String content;
protected String attachmentId;
protected boolean isContactPhoto;
protected boolean isContactPhoto;
/**
* Default constructor
*/
public FileAttachment() {
// empty constructor
}
/**
* Build file attachment.
*
* @param name attachment name
* @param contentType content type
* @param content body as string
*/
public FileAttachment(String name, String contentType, String content) {
this.name = name;
this.contentType = contentType;
@ -49,7 +59,7 @@ public class FileAttachment {
*/
public void write(Writer writer) throws IOException {
writer.write("<t:FileAttachment>");
if (name != null) {
if (name != null) {
writer.write("<t:Name>");
writer.write(name);
writer.write("</t:Name>");
@ -70,8 +80,13 @@ public class FileAttachment {
writer.write("</t:FileAttachment>");
}
/**
* Exchange 2010 only: set contact photo flag on attachment.
*
* @param isContactPhoto contact photo flag
*/
public void setIsContactPhoto(boolean isContactPhoto) {
this.isContactPhoto = isContactPhoto;
this.isContactPhoto = isContactPhoto;
}
}

View File

@ -28,6 +28,7 @@ public class FindItemMethod extends EWSMethod {
* @param traversal folder traversal mode
* @param baseShape base item shape
* @param parentFolderId parent folder id
* @param maxCount maximum result count
*/
public FindItemMethod(FolderQueryTraversal traversal, BaseShape baseShape, FolderId parentFolderId, int maxCount) {
super("Item", "FindItem");

View File

@ -25,6 +25,8 @@ public class GetAttachmentMethod extends EWSMethod {
/**
* Get Attachment Method.
*
* @param attachmentId attachment id
*/
public GetAttachmentMethod(String attachmentId) {
super("Attachment", "GetAttachment");

View File

@ -92,7 +92,7 @@ public class GetUserAvailabilityMethod extends EWSMethod {
writer.write(end);
writer.write("</t:EndTime>" +
"</t:TimeWindow>" +
"<t:MergedFreeBusyIntervalInMinutes>"+interval+"</t:MergedFreeBusyIntervalInMinutes>" +
"<t:MergedFreeBusyIntervalInMinutes>" + interval + "</t:MergedFreeBusyIntervalInMinutes>" +
"<t:RequestedView>MergedOnly</t:RequestedView>" +
"</t:FreeBusyViewOptions>");
}
@ -104,6 +104,11 @@ public class GetUserAvailabilityMethod extends EWSMethod {
}
}
/**
* Get merged freebusy string.
*
* @return freebusy string
*/
public String getMergedFreeBusy() {
return mergedFreeBusy;
}

View File

@ -30,10 +30,20 @@ public class IndexedFieldUpdate extends FieldUpdate {
final Set<FieldUpdate> updates = new HashSet<FieldUpdate>();
protected final String collectionName;
/**
* Create indexed field update object.
*
* @param collectionName values collection name e.g. EmailAddresses
*/
public IndexedFieldUpdate(String collectionName) {
this.collectionName = collectionName;
}
/**
* Add indexed field value.
*
* @param fieldUpdate field update object
*/
public void addFieldValue(FieldUpdate fieldUpdate) {
updates.add(fieldUpdate);
}

View File

@ -38,6 +38,11 @@ public class ItemId {
this.changeKey = item.get("ChangeKey");
}
/**
* Build Item id object from item id.
*
* @param itemId item id
*/
public ItemId(String itemId) {
this.id = itemId;
this.changeKey = null;

View File

@ -293,7 +293,7 @@ public final class StringUtil {
public static String base64ToUrl(String value) {
String result = value;
if (value != null) {
if (result != null) {
if (result.indexOf('+') >= 0) {
result = PLUS_PATTERN.matcher(result).replaceAll("-");
}