#include <ClientRecurrence.h>
Public Member Functions | |
ClientRecurrence () | |
Constructor. | |
~ClientRecurrence () | |
Destructor. | |
void | setCOMPtr (RecurrencePatternPtr &ptr) |
Set a COM pointer to this object. | |
int | read () |
Retrieve all properties from Outlook -> set isUpdated = true. | |
int | save () |
Save all the properties to Outlook. | |
bool | isRecurring () |
Return true if the rec pattern is active. | |
void | setRecurrence () |
Set 'recurring' to true. | |
void | clearRecurrence () |
Reset all members, set 'recurring' to false. | |
const int | getRecurrenceType () |
const int | getInterval () |
const int | getMonthOfYear () |
const int | getDayOfMonth () |
const int | getDayOfWeekMask () |
const int | getInstance () |
const std::wstring & | getPatternStartDate () |
const BOOL | getNoEndDate () |
const std::wstring & | getPatternEndDate () |
const int | getOccurrences () |
const std::wstring | getProperty (const std::wstring &propertyName) |
Return the property value (wstring) from its name. | |
void | setRecurrenceType (const int val) |
void | setInterval (const int val) |
void | setMonthOfYear (const int val) |
void | setDayOfMonth (const int val) |
void | setDayOfWeekMask (const int val) |
void | setInstance (const int val) |
void | setPatternStartDate (const std::wstring &val) |
void | setNoEndDate (const BOOL val) |
void | setPatternEndDate (const std::wstring &val) |
void | setOccurrences (const int val) |
void | setStart (const std::wstring &val) |
for the change-day option | |
void | setIsAllDay (const BOOL val) |
int | setProperty (const std::wstring &propertyName, const std::wstring &propertyValue) |
Set property value from its name: set internal object values. | |
ClientAppException * | getException (const int index) |
Returns the desired ClientAppException stored in 'appExceptions' internal list. | |
const int | getExceptionsCount () |
Returns the number of exceptions stored in this recurrence. | |
int | addException (ClientAppException *cException) |
Adds a ClientAppException into 'appExceptions' internal list. | |
void | resetExceptions () |
Reset the exception list 'appExceptions'. | |
int | saveAllExceptions () |
Save all exceptions from internal exception list to Outlook (server to client). | |
int | removeDuplicatedExceptions () |
This utility method is used to remove all duplicated exceptions that are extracted from Outlook. | |
_AppointmentItemPtr | getOccurrence (const DATE originalDate) |
Returns the specific occurrence of date "originalDate" from the recurrence pattern. | |
Private Member Functions | |
void | checkIfRecIsCorrect () |
bool | changeDay (const std::wstring dest) |
Change-day of rec props, according on UTC <-> Local time. | |
ClientAppException * | getExceptionOnClient (const int index) |
used during 'read()' method (get data from client) | |
const int | getExceptionsCountOnClient () |
Returns the number of appointment exceptions. | |
int | saveException (ClientAppException *cException) |
Save the exception 'cException' into Outlook. | |
Private Attributes | |
int | recurrenceType |
int | interval |
int | monthOfYear |
int | dayOfMonth |
int | dayOfWeekMask |
int | instance |
std::wstring | patternStartDate |
BOOL | noEndDate |
std::wstring | patternEndDate |
int | occurrences |
std::wstring | start |
for the change-day option | |
BOOL | isAllDay |
for the change-day option | |
RecurrencePatternPtr | pRec |
Pointer to microsoft outlook objects. | |
exceptionList | appExceptions |
Internal list of appointment exceptions. | |
bool | recurring |
Is this rec pattern active? this is linked to the property 'recurring' of Outlook event (it's set at constructor and each time setting property IsRecurring). | |
bool | isUpdated |
Internal use: true if values are updated with Outlook. | |
int | numRecursions |
Internal use: to avoid deadlocking into safeSaveException() recursive call. |
This object is the same contained by ClientAppointment and ClientTask objects. Contains all recurrence properties, MUST read and save them all together (read() and save()), so they're internally stored.
A recurrence object has a list of appointment exceptions inside it.
void ClientRecurrence::checkIfRecIsCorrect | ( | ) | [private] |
ClientAppException * ClientRecurrence::getExceptionOnClient | ( | const int | index | ) | [private] |
used during 'read()' method (get data from client)
Value is always retrieved from Outlook (not saved in this object). This method is used from client to server, initially to populate the exceptions list. Note: the pointer returned is a new allocated object.
index | : the index of Exception required |
const int ClientRecurrence::getExceptionsCountOnClient | ( | ) | [private] |
Returns the number of appointment exceptions.
Value is always retrieved from Outlook (not saved in this object). This method is used from client to server, initially to populate the exceptions list.
int ClientRecurrence::saveException | ( | ClientAppException * | cException | ) | [private] |
Save the exception 'cException' into Outlook.
No check on exceptions dependences is done here. Before saving the exception, we MUST check that the destination date is free (the "StartDate") -> call 'freeDestinationDays()'. Note: before calling this method, the Appointment Item MUST be already saved to Outlook.
void ClientRecurrence::setCOMPtr | ( | RecurrencePatternPtr & | ptr | ) |
Set a COM pointer to this object.
This method is used to link the object to the correspondent outlook COM pointer. The method MUST be called before using this object, as the constructor doesn't link the class COM pointer.
int ClientRecurrence::read | ( | ) |
Retrieve all properties from Outlook -> set isUpdated = true.
If UTC is used, all props are converted to correct values.
int ClientRecurrence::save | ( | ) |
Save all the properties to Outlook.
Properties are verified to be consistent all together, as Outlook doesn't accept wrong values. If UTC is used, all props are converted to correct values.
void ClientRecurrence::setRecurrence | ( | ) |
Set 'recurring' to true.
This is called by 'ClientAppointment.setProperty("IsRecurring", "1")'.
void ClientRecurrence::clearRecurrence | ( | ) |
Reset all members, set 'recurring' to false.
This is called by 'ClientAppointment.setProperty("IsRecurring", "0")'.
const wstring ClientRecurrence::getProperty | ( | const std::wstring & | propertyName | ) |
Return the property value (wstring) from its name.
Properties are retrieved from internal members (switch to correct property). Rec pattern values must be first retrieved all together, this is done internally when the first property is retrieved.
propertyName | : the name of the property |
int ClientRecurrence::setProperty | ( | const std::wstring & | propertyName, | |
const std::wstring & | propertyValue | |||
) |
Set property value from its name: set internal object values.
All rec pattern must be saved together at the end calling 'save()' method. This is because:
propertyName | : the name of the property | |
propertyValue | : the value to store |
ClientAppException * ClientRecurrence::getException | ( | const int | index | ) |
Returns the desired ClientAppException stored in 'appExceptions' internal list.
index | : the index of exception desired |
int ClientRecurrence::addException | ( | ClientAppException * | cException | ) |
Adds a ClientAppException into 'appExceptions' internal list.
The object passed is copied, so can be safely deleted by the caller.
cException | : the ClientAppException* to add |
int ClientRecurrence::saveAllExceptions | ( | ) |
Save all exceptions from internal exception list to Outlook (server to client).
All exceptions are 'deleted occurrence' exceptions, 'modified exceptions' are not expected at this level (should be normalized in upper layer).
int ClientRecurrence::removeDuplicatedExceptions | ( | ) |
This utility method is used to remove all duplicated exceptions that are extracted from Outlook.
We don't want more than one exception with the same "OriginalDate" (it's nonsense...). Outlook may send more than one, for example:
<OriginalDate>2007-01-15</OriginalDate> <ExAppointment> <ExSubject>Subject modified</ExSubject> <ExBody> <ExLocation> <ExStart>2007-01-16</ExStart> <ExEnd>2007-01-16</ExEnd> <ExAllDayEvent>1</ExAllDayEvent> <ExBusyStatus>1</ExBusyStatus> </ExAppointment>
<OriginalDate>2007-01-15</OriginalDate>
In this case, the second exception is nonsense, and will be removed from list.
_AppointmentItemPtr ClientRecurrence::getOccurrence | ( | const DATE | originalDate | ) |
Returns the specific occurrence of date "originalDate" from the recurrence pattern.
Returned object is an appointement COM pointer '_AppointmentItemPtr' (each occurrence is an appointment itself). If the occurrence is not found, returns NULL.
originalDate | : the original date of the occurrence to be found (double format) |
bool ClientRecurrence::isUpdated [private] |
Internal use: true if values are updated with Outlook.
Used because all values need to be retrieved together, so this flag notifies when it's necessary to update properties.