Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZCS-12421: Adding tags for instance and series in appointments #1418

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions common/src/java/com/zimbra/common/soap/MailConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -856,6 +856,10 @@ private MailConstants() {
// messages
public static final String E_MIMEPART = "mp";
public static final String E_SUBJECT = "su";

public static final String E_OPERATION_TYPE = "op";
public static final String E_TAG_COLOUR = "tn";

public static final String E_FRAG = "fr";
public static final String E_MSG_ID_HDR = "mid";
public static final String E_IN_REPLY_TO = "irt";
Expand Down
79 changes: 78 additions & 1 deletion store/src/java/com/zimbra/cs/mailbox/calendar/Invite.java
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,63 @@ public class Invite {
setRecurId(recurrenceId);
}

Invite(MailItem.Type type, String methodStr, TimeZoneMap tzmap, CalendarItem calItem, String uid, String status,
String priority, String pctComplete, long completed, String freebusy, String transp, String classProp,
ParsedDateTime start, ParsedDateTime end, ParsedDuration duration, Recurrence.IRecurrence recurrence,
boolean isOrganizer, ZOrganizer org, List<ZAttendee> attendees, String name, String operationType, String tagColour,
String loc, int flags, String partStat, Boolean rsvp, RecurId recurrenceId, long dtstamp, long lastModified,
int seqno, int lastFullSeqno, int mailboxId, int mailItemId, int componentNum, boolean sentByMe,
String description, String descHtml, String fragment, List<String> comments, List<String> categories,
List<String> contacts, Geo geo, String url) {
setItemType(type);
mMethod = lookupMethod(methodStr);
mTzMap = tzmap;
mCalItem = calItem;
mUid = uid;
mStatus = status;
mPriority = priority;
mPercentComplete = pctComplete;
mCompleted = completed;
mFreeBusy = freebusy;
mTransparency = transp;
mClass = classProp;
mClassSetByMe = sentByMe;
mStart = start;
mEnd = end;
mDuration = duration;
mIsOrganizer = isOrganizer;
mOrganizer = org;
mAttendees = attendees;
mName = name != null ? name : "";
mOpType = operationType;
mTagColour = tagColour;
mLocation = loc != null ? loc : "";
mFlags = flags;
mPartStat = partStat;
mRsvp = rsvp;
mSeqNo = seqno;
// bug 74117 : mLastSeqNo contains the sequence number for which invitation is sent to all the attendees.
// This will be used when accepting the replies.
mLastFullSeqNo = lastFullSeqno;
setDtStamp(dtstamp);
setLastModified(lastModified);

mMailboxId = mailboxId;
mMailItemId = mailItemId;
mComponentNum = componentNum;
mSentByMe = sentByMe;
setDescription(description, descHtml);
mFragment = fragment != null ? fragment : "";
mComments = comments != null ? comments : new ArrayList<String>();
mCategories = categories != null ? categories : new ArrayList<String>();
mContacts = contacts != null ? contacts : new ArrayList<String>();
mGeo = geo;
setUrl(url);

setRecurrence(recurrence);
setRecurId(recurrenceId);
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overload the existing constructor rather than duplicating the entire constructor code

private Recurrence.IRecurrence mRecurrence;
public Recurrence.IRecurrence getRecurrence() { return mRecurrence; }
public void setRecurrence(Recurrence.IRecurrence recur) {
Expand Down Expand Up @@ -278,6 +335,8 @@ public void setInviteId(int invId) {
private static final String FN_LAST_MODIFIED = "lastMod";
private static final String FN_METHOD = "mthd";
private static final String FN_NAME = "n";
private static final String FN_OPERATION_TYPE = "op";
private static final String FN_TAG_COLOUR = "tn";
private static final String FN_NUM_ATTENDEES = "numAt";
private static final String FN_NUM_CATEGORIES = "numCat";
private static final String FN_NUM_COMMENTS = "numCmt";
Expand Down Expand Up @@ -357,6 +416,9 @@ public static Metadata encodeMetadata(Invite inv) {
}

meta.put(FN_NAME, inv.getName());
meta.put(FN_OPERATION_TYPE, inv.getOperationType());
meta.put(FN_TAG_COLOUR, inv.getTagColour());

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra space

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Above line - meta.put(FN_NAME, inv.getName()); has also extra space. Still shall I remove the space. Please confirm.


meta.put(FN_LOCATION, inv.mLocation);
meta.put(FN_APPT_FLAGS, inv.getFlags());
Expand Down Expand Up @@ -579,6 +641,10 @@ public static Invite decodeMetadata(int mailboxId, Metadata meta, CalendarItem c
String name = meta.get(FN_NAME, "");
String loc = meta.get(FN_LOCATION, null);

// Tag related data
String opType = meta.get(FN_OPERATION_TYPE, null);
String tagCol = meta.get(FN_TAG_COLOUR, null);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra space, check in other part of code changes as well

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure I have modified it.

// For existing invites with no partstat, default to ACCEPTED status.
String partStat = meta.get(FN_PARTSTAT, IcalXmlStrMap.PARTSTAT_ACCEPTED);
// For existing invites with no RSVP, default to true.
Expand Down Expand Up @@ -673,7 +739,7 @@ public static Invite decodeMetadata(int mailboxId, Metadata meta, CalendarItem c

Invite invite = new Invite(type, methodStr, tzMap, calItem, uid, status, priority, pctComplete, completed,
freebusy, transp, classProp, dtStart, dtEnd, duration, recurrence, isOrganizer, org, attendees, name,
loc, flags, partStat, rsvp, recurrenceId, dtstamp, lastModified,
opType, tagCol, loc, flags, partStat, rsvp, recurrenceId, dtstamp, lastModified,
seqno, lastFullSeqno, mailboxId, mailItemId, componentNum, sentByMe,
desc, descHtml, fragment, comments, categories, contacts, geo, url);
invite.mDescInMeta = descInMeta; // a little hacky, but necessary
Expand Down Expand Up @@ -989,6 +1055,13 @@ public void setIsAllDayEvent(boolean allDayEvent) {
public void setUid(String uid) { mUid = uid; }
public String getName() { return mName; };
public void setName(String name) { mName = name; }

public String getOperationType() { return mOpType; };
public void setOperationType(String op) { mOpType = op; }

public String getTagColour() { return mTagColour; };
public void setTagColour(String tagColour) { mTagColour = tagColour; }

public String getStatus() { return mStatus; }
public void setStatus(String status) { mStatus = status; }
public boolean hasFreeBusy() { return mFreeBusy != null; }
Expand Down Expand Up @@ -1299,6 +1372,10 @@ public String toString() {
protected long mCompleted = 0; // COMPLETED DATE-TIME of VTODO

protected String mName; /* name of the invite, aka "subject" */

protected String mOpType; /* name of the operationType, aka "op" */
protected String mTagColour; /* name of the colour, aka "tn" */

protected String mLocation;
protected int mFlags = APPT_FLAG_EVENT;
protected long mDTStamp = 0;
Expand Down
6 changes: 6 additions & 0 deletions store/src/java/com/zimbra/cs/service/mail/CalendarUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -1086,6 +1086,10 @@ private static void parseInviteElementCommon(Account account, MailItem.Type type
String name = element.getAttribute(MailConstants.A_NAME, "");
String location = element.getAttribute(MailConstants.A_CAL_LOCATION, "");

// Tag related data
String operationType = element.getAttribute(MailConstants.E_OPERATION_TYPE, "");
String tagColour = element.getAttribute(MailConstants.E_TAG_COLOUR, "");

// CATEGORIES
for (Iterator<Element> catIter = element.elementIterator(MailConstants.E_CAL_CATEGORY); catIter.hasNext(); ) {
String cat = catIter.next().getText();
Expand Down Expand Up @@ -1121,6 +1125,8 @@ private static void parseInviteElementCommon(Account account, MailItem.Type type

// SUMMARY (aka Name or Subject)
newInv.setName(name);
newInv.setOperationType(operationType);
newInv.setTagColour(tagColour);

// DESCRIPTION
Element descElem = element.getOptionalElement(MailConstants.E_CAL_DESCRIPTION);
Expand Down
2 changes: 2 additions & 0 deletions store/src/java/com/zimbra/cs/service/mail/ToXML.java
Original file line number Diff line number Diff line change
Expand Up @@ -2237,6 +2237,8 @@ public static Element encodeInviteComponent(Element parent, ItemIdFormatter ifmt
}
e.addAttribute(MailConstants.A_NAME, invite.getName());
e.addAttribute(MailConstants.A_CAL_LOCATION, invite.getLocation());
e.addAttribute(MailConstants.E_OPERATION_TYPE, invite.getOperationType());
e.addAttribute(MailConstants.E_TAG_COLOUR, invite.getTagColour());

List<String> categories = invite.getCategories();
if (categories != null) {
Expand Down