/// <remarks>
/// The Calendar Service API provides functions and ienumerations used in the entire Content Service.
/// The Information about calendar items i.e. book, event, todo, alarm, attendee and extended are managed in the database
-/// and operations that involve database requires an active connection with the calendar contact service.
+/// and operations that involve database requires an active connection with the calendar service.
/// </remarks>
namespace Tizen.Pims.Calendar
{
/// <summary>
- /// CalendarDatabase class is the interface class for managing the record from/to the database.
- /// This class allows usre to access/create/update db operations for media content.
+ /// CalendarDatabase provides methods to manage calendar information from/to the database.
/// </summary>
+ /// <remarks>
+ /// This class allows usre to access/create/update db operations for calendar information.
+ /// </remarks>
public class CalendarDatabase
{
/// <summary>
+ /// Delegete for detecting the calendar database changes.
/// </summary>
/// <param name="uri">The record uri</param>
+ /// <remarks>
+ /// The delegate must be registered using AddDBChangedDelegate.
+ /// It's invoked when the designated view changes.
+ /// </remarks>
+ /// <see cref="AddDBChangedDelegate"/>
public delegate void CalendarDBChangedDelegate(string uri);
private Object thisLock = new Object();
internal CalendarDatabase()
{
-
+ ///To be created in CalendarManager only
}
/// <summary>
}
/// <summary>
- /// The calendar database version on the current connection.
+ /// Gets last successful changed calendar database version on the current connection.
/// </summary>
+ /// <returns>The last successful changed calendar database version on the current connection</returns>
+ /// <privilege>http://tizen.org/privilege/calendar.read</privilege>
+ /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
+ /// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown when application does not have proper privileges</exception>
public int LastChangeVersion
{
get
/// Inserts a record into the calendar database.
/// </summary>
/// <param name="record">The record to be inserted</param>
- /// <returns>
- /// The record id
- /// </returns>
+ /// <returns>The ID of inserted record</returns>
+ /// <privilege>http://tizen.org/privilege/calendar.write</privilege>
+ /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
+ /// <exception cref="NotSupportedException">Thrown when an invoked method is not supported</exception>
+ /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
+ /// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown when application does not have proper privileges</exception>
public int Insert(CalendarRecord record)
{
int id = -1;
/// <param name="viewUri">The view URI of a record</param>
/// <param name="recordId">The record ID</param>
/// <returns>
- /// CalendarRecord instance.
+ /// The record associated with the record ID
/// </returns>
+ /// <privilege>http://tizen.org/privilege/calendar.read</privilege>
+ /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
+ /// <exception cref="NotSupportedException">Thrown when an invoked method is not supported</exception>
+ /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
+ /// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown when application does not have proper privileges</exception>
public CalendarRecord Get(string viewUri, int recordId)
{
IntPtr handle;
int error = Interop.Calendar.Database.Get(viewUri, recordId, out handle);
if (CalendarError.None != (CalendarError)error)
{
- Log.Error(Globals.LogTag, "Get Failed with error " + error);
- throw CalendarErrorFactory.GetException(error);
+ if (CalendarError.DBNotFound == (CalendarError)error)
+ {
+ Log.Error(Globals.LogTag, "No data" + error);
+ return null;
+ }
+ Log.Error(Globals.LogTag, "Get Failed with error " + error);
+ throw CalendarErrorFactory.GetException(error);
}
return new CalendarRecord(handle);
}
/// Updates a record in the calendar database.
/// </summary>
/// <param name="record">The record to be updated</param>
+ /// <privilege>http://tizen.org/privilege/calendar.write</privilege>
+ /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
+ /// <exception cref="NotSupportedException">Thrown when an invoked method is not supported</exception>
+ /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
+ /// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown when application does not have proper privileges</exception>
public void Update(CalendarRecord record)
{
int error = Interop.Calendar.Database.Update(record._recordHandle);
/// </summary>
/// <param name="viewUri">The view URI of a record</param>
/// <param name="recordId">The record ID to be deleted</param>
+ /// <privilege>http://tizen.org/privilege/calendar.write</privilege>
+ /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
+ /// <exception cref="NotSupportedException">Thrown when an invoked method is not supported</exception>
+ /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
+ /// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown when application does not have proper privileges</exception>
public void Delete(string viewUri, int recordId)
{
int error = Interop.Calendar.Database.Delete(viewUri, recordId);
/// </summary>
/// <param name="record">The record to be replaced</param>
/// <param name="id">the record id</param>
+ /// <privilege>http://tizen.org/privilege/calendar.write</privilege>
+ /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
+ /// <exception cref="NotSupportedException">Thrown when an invoked method is not supported</exception>
+ /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
+ /// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown when application does not have proper privileges</exception>
public void Replace(CalendarRecord record, int id)
{
int error = Interop.Calendar.Database.Replace(record._recordHandle, id);
/// <param name="offset">The index from which results are received</param>
/// <param name="limit">The maximum number of results(value 0 is used for all records)</param>
/// <returns>
- /// CalendarList
+ /// The record list
/// </returns>
+ /// <privilege>http://tizen.org/privilege/calendar.read</privilege>
+ /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
+ /// <exception cref="NotSupportedException">Thrown when an invoked method is not supported</exception>
+ /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
+ /// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown when application does not have proper privileges</exception>
public CalendarList GetAll(string viewUri, int offset, int limit)
{
IntPtr handle;
/// <returns>
/// CalendarList
/// </returns>
+ /// <privilege>http://tizen.org/privilege/calendar.read</privilege>
+ /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
+ /// <exception cref="NotSupportedException">Thrown when an invoked method is not supported</exception>
+ /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
+ /// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown when application does not have proper privileges</exception>
public CalendarList GetRecordsWithQuery(CalendarQuery query, int offset, int limit)
{
IntPtr handle;
/// <returns>
/// The inserted record id array
/// </returns>
+ /// <privilege>http://tizen.org/privilege/calendar.write</privilege>
+ /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
+ /// <exception cref="NotSupportedException">Thrown when an invoked method is not supported</exception>
+ /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
+ /// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown when application does not have proper privileges</exception>
public int[] Insert(CalendarList list)
{
IntPtr ids;
/// Updates multiple records into the calendar database as a batch operation.
/// </summary>
/// <param name="list">The record list</param>
+ /// <privilege>http://tizen.org/privilege/calendar.write</privilege>
+ /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
+ /// <exception cref="NotSupportedException">Thrown when an invoked method is not supported</exception>
+ /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
+ /// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown when application does not have proper privileges</exception>
public void Update(CalendarList list)
{
int error = Interop.Calendar.Database.UpdateRecords(list._listHandle);
/// </summary>
/// <param name="viewUri">The view URI of the records to delete</param>
/// <param name="idArray">The record IDs to delete</param>
+ /// <privilege>http://tizen.org/privilege/calendar.write</privilege>
+ /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
+ /// <exception cref="NotSupportedException">Thrown when an invoked method is not supported</exception>
+ /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
+ /// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown when application does not have proper privileges</exception>
public void Delete(string viewUri, int[] idArray)
{
int error = Interop.Calendar.Database.DeleteRecords(viewUri, idArray, idArray.Length);
/// Deletes multiple records with related child records from the calendar database as a batch operation.
/// </summary>
/// <param name="list">The record list</param>
+ /// <privilege>http://tizen.org/privilege/calendar.write</privilege>
+ /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
+ /// <exception cref="NotSupportedException">Thrown when an invoked method is not supported</exception>
+ /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
+ /// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown when application does not have proper privileges</exception>
public void Delete(CalendarList list)
{
CalendarRecord record = null;
/// </summary>
/// <param name="list">The record list</param>
/// <param name="idArray">The record IDs</param>
+ /// <privilege>http://tizen.org/privilege/calendar.write</privilege>
+ /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
+ /// <exception cref="NotSupportedException">Thrown when an invoked method is not supported</exception>
+ /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
+ /// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown when application does not have proper privileges</exception>
public void Replace(CalendarList list, int[] idArray)
{
int error = Interop.Calendar.Database.ReplaceRecords(list._listHandle, idArray, idArray.Length);
/// <param name="calendarDBVersion">The calendar database version</param>
/// <param name="currentDBVersion"The current calendar database versio></param>
/// <returns>
- /// CalendarList
+ /// The record list
/// </returns>
+ /// <privilege>http://tizen.org/privilege/calendar.read</privilege>
+ /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
+ /// <exception cref="NotSupportedException">Thrown when an invoked method is not supported</exception>
+ /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
+ /// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown when application does not have proper privileges</exception>
public CalendarList GetChangesByVersion(string viewUri, int BookId, int calendarDBVersion, out int currentDBVersion)
{
IntPtr recordList;
/// </summary>
/// <param name="viewUri">The view URI to get records from</param>
/// <returns>
- /// The count
+ /// The count of records
/// </returns>
+ /// <privilege>http://tizen.org/privilege/calendar.read</privilege>
public int GetCount(string viewUri)
{
int count = -1;
/// </summary>
/// <param name="query">The query used for filtering the results</param>
/// <returns>
- /// The count
+ /// The count of records
/// </returns>
+ /// <privilege>http://tizen.org/privilege/calendar.read</privilege>
public int GetCount(CalendarQuery query)
{
int count = -1;
/// </summary>
/// <param name="viewUri">The view URI of the record to subscribe for change notifications</param>
/// <param name="callback">The callback function to register</param>
+ /// <privilege>http://tizen.org/privilege/calendar.read</privilege>
public void AddDBChangedDelegate(string viewUri, CalendarDBChangedDelegate callback)
{
Log.Debug(Globals.LogTag, "AddDBChangedDelegate");
/// </summary>
/// <param name="viewUri">The view URI of the record to subscribe for change notifications</param>
/// <param name="callback">The callback function to register</param>
+ /// <privilege>http://tizen.org/privilege/calendar.read</privilege>
public void RemoveDBChangedDelegate(string viewUri, CalendarDBChangedDelegate callback)
{
Log.Debug(Globals.LogTag, "RemoveDBChangedDelegate");
/// </summary>
/// <param name="baseId">The base record ID</param>
/// <param name="recordId">The record ID to link to</param>
+ /// <privilege>http://tizen.org/privilege/calendar.write</privilege>
+ /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
+ /// <exception cref="NotSupportedException">Thrown when an invoked method is not supported</exception>
+ /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
+ /// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown when application does not have proper privileges</exception>
public void LinkRecord(int baseId, int recordId)
{
Log.Debug(Globals.LogTag, "LinkRecord");
/// Unlink a record from base record.
/// </summary>
/// <param name="recordId">The record ID to unlink</param>
+ /// <privilege>http://tizen.org/privilege/calendar.write</privilege>
+ /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
+ /// <exception cref="NotSupportedException">Thrown when an invoked method is not supported</exception>
+ /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
+ /// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown when application does not have proper privileges</exception>
public void UnlinkRecord(int recordId)
{
Log.Debug(Globals.LogTag, "UnlinkRecord");
internal enum CalendarError
{
None = Tizen.Internals.Errors.ErrorCode.None, /**< Successful */
- OutOfMemory = Tizen.Internals.Errors.ErrorCode.OutOfMemory, /**< Out of Memory */
- InvalidParameter = Tizen.Internals.Errors.ErrorCode.InvalidParameter, /**< Invalid parameter */
- FileNoSpace = Tizen.Internals.Errors.ErrorCode.FileNoSpaceOnDevice, /** <FS Full*/
- PermissionDenied = Tizen.Internals.Errors.ErrorCode.PermissionDenied, /**< Permission denied */
- NotSupported = Tizen.Internals.Errors.ErrorCode.NotSupported, /**< Not supported */
- NoData = Tizen.Internals.Errors.ErrorCode.NoData, /**< Requested data does not exist */
- DBLocked = Globals.ErrorCalendar | 0x81, /**< Database table locked or file locked */
- ErrorDB = Globals.ErrorCalendar | 0x9F, /**< Unknown DB error */
- IPCNotAvailable = Globals.ErrorCalendar | 0xB1, /**< IPC server is not available */
- ErrorIPC = Globals.ErrorCalendar | 0xBF, /**< Unknown IPC error */
- ErrorSystem = Globals.ErrorCalendar | 0xEF, /**< Internal system module error */
- ErrorInternal = Globals.ErrorCalendar | 0xFF, /**< Implementation Error Temporary Use */
+ OutOfMemory = Tizen.Internals.Errors.ErrorCode.OutOfMemory, /**< Out of Memory (-12) */
+ InvalidParameter = Tizen.Internals.Errors.ErrorCode.InvalidParameter, /**< Invalid parameter (-22) */
+ FileNoSpace = Tizen.Internals.Errors.ErrorCode.FileNoSpaceOnDevice, /** <FS Full (-28) */
+ PermissionDenied = Tizen.Internals.Errors.ErrorCode.PermissionDenied, /**< Permission denied (-13) */
+ NotSupported = Tizen.Internals.Errors.ErrorCode.NotSupported, /**< Not supported (-1073741822) */
+ NoData = Tizen.Internals.Errors.ErrorCode.NoData, /**< Requested data does not exist (-61) */
+ DBLocked = Globals.ErrorCalendar | 0x81, /**< Database table locked or file locked (-33619839) */
+ ErrorDB = Globals.ErrorCalendar | 0x9F, /**< Unknown DB error (-33619809) */
+ IPCNotAvailable = Globals.ErrorCalendar | 0xB1, /**< IPC server is not available (-33619791) */
+ ErrorIPC = Globals.ErrorCalendar | 0xBF, /**< Unknown IPC error (-33619777) */
+ ErrorSystem = Globals.ErrorCalendar | 0xEF, /**< Internal system module error (-33619729) */
+ ErrorInternal = Globals.ErrorCalendar | 0x04, /**< Implementation Error Temporary Use (-33619713) */
+ DBNotFound = Globals.ErrorCalendar | 0x05, /**< No data in DB (-33554427) */
};
internal static class Globals
{
internal const string LogTag = "Tizen.Pims.Calendar";
- internal const int ErrorCalendar = -0x02010000;
+ internal const int ErrorCalendar = -0x02000000;
}
internal static class CalendarErrorFactory
using System;
using System.Collections.Generic;
-/// <summary>
-/// </summary>
-/// <remarks>
-/// </remarks>
namespace Tizen.Pims.Calendar
{
/// <summary>
+ /// A filter includes the conditions for the search.
/// </summary>
public class CalendarFilter:IDisposable
{
internal IntPtr _filterHandle;
/// <summary>
- /// Creates a filter with string type.
+ /// Creates a filter with a condition for a string type.
/// </summary>
/// <param name="viewUri">The view URI of a filter</param>
/// <param name="propertyId">The property ID to add a condition</param>
/// <param name="matchType">The match flag</param>
/// <param name="matchValue">The match value</param>
+ /// <exception cref="NotSupportedException">Thrown when an invoked method is not supported</exception>
+ /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
+ /// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory</exception>
public CalendarFilter(string viewUri, uint propertyId, StringMatchType matchType, string matchValue)
{
int error = 0;
}
/// <summary>
- /// Creates a filter with integer type.
+ /// Creates a filter with a condition for an integer type.
/// </summary>
/// <param name="viewUri">The view URI of a filter</param>
/// <param name="propertyId">The property ID to add a condition</param>
/// <param name="matchType">The match flag</param>
/// <param name="matchValue">The match value</param>
+ /// <exception cref="NotSupportedException">Thrown when an invoked method is not supported</exception>
+ /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
+ /// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory</exception>
public CalendarFilter(string viewUri, uint propertyId, IntegerMatchType matchType, int matchValue)
{
int error = 0;
}
/// <summary>
- /// Creates a filter with long type.
+ /// Creates a filter with a condition for long type.
/// </summary>
/// <param name="viewUri">The view URI of a filter</param>
/// <param name="propertyId">The property ID to add a condition</param>
/// <param name="matchType">The match flag</param>
/// <param name="matchValue">The match value</param>
+ /// <exception cref="NotSupportedException">Thrown when an invoked method is not supported</exception>
+ /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
+ /// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory</exception>
public CalendarFilter(string viewUri, uint propertyId, IntegerMatchType matchType, long matchValue)
{
int error = 0;
}
/// <summary>
- /// Creates a filter with double type.
+ /// Creates a filter with a condition for double type.
/// </summary>
/// <param name="viewUri">The view URI of a filter</param>
/// <param name="propertyId">The property ID to add a condition</param>
/// <param name="matchType">The match flag</param>
/// <param name="matchValue">The match value</param>
+ /// <exception cref="NotSupportedException">Thrown when an invoked method is not supported</exception>
+ /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
+ /// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory</exception>
public CalendarFilter(string viewUri, uint propertyId, IntegerMatchType matchType, double matchValue)
{
int error = 0;
}
/// <summary>
- /// Creates a filter with CalendarTime type.
+ /// Creates a filter with a condition for CalendarTime type.
/// </summary>
/// <param name="viewUri">The view URI of a filter</param>
/// <param name="propertyId">The property ID to add a condition</param>
/// <param name="matchType">The match flag</param>
/// <param name="matchValue">The match value</param>
+ /// <exception cref="NotSupportedException">Thrown when an invoked method is not supported</exception>
+ /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
+ /// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory</exception>
public CalendarFilter(string viewUri, uint propertyId, IntegerMatchType matchType, CalendarTime matchValue)
{
int error = 0;
}
}
+ /// <summary>
+ /// Releases all resources used by the CalendarFilter.
+ /// It should be called after finished using of the object.
+ /// </summary>
public void Dispose()
{
Dispose(true);
#endregion
/// <summary>
- /// Adds a condition for the string type property.
+ /// Adds a condition for the string type.
/// </summary>
/// <param name="logicalOperator">The operator type</param>
/// <param name="propertyId">The property ID to add a condition</param>
/// <param name="matchType">The match flag</param>
/// <param name="matchValue">The match valu</param>
+ /// <exception cref="NotSupportedException">Thrown when an invoked method is not supported</exception>
+ /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
public void AddCondition(LogicalOperator logicalOperator, uint propertyId, StringMatchType matchType, string matchValue)
{
int error = Interop.Calendar.Filter.AddOperator(_filterHandle, logicalOperator);
}
/// <summary>
- /// Adds a condition for the integer type property.
+ /// Adds a condition for the integer type.
/// </summary>
/// <param name="logicalOperator">The operator type</param>
/// <param name="propertyId">The property ID to add a condition</param>
/// <param name="matchType">The match flag</param>
/// <param name="matchValue">The match valu</param>
+ /// <exception cref="NotSupportedException">Thrown when an invoked method is not supported</exception>
+ /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
public void AddCondition(LogicalOperator logicalOperator, uint propertyId, IntegerMatchType matchType, int matchValue)
{
int error = Interop.Calendar.Filter.AddOperator(_filterHandle, logicalOperator);
}
/// <summary>
- /// Adds a condition for the long type property.
+ /// Adds a condition for the long type.
/// </summary>
/// <param name="logicalOperator">The operator type</param>
/// <param name="propertyId">The property ID to add a condition</param>
/// <param name="matchType">The match flag</param>
/// <param name="matchValue">The match valu</param>
+ /// <exception cref="NotSupportedException">Thrown when an invoked method is not supported</exception>
+ /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
public void AddCondition(LogicalOperator logicalOperator, uint propertyId, IntegerMatchType matchType, long matchValue)
{
int error = Interop.Calendar.Filter.AddOperator(_filterHandle, logicalOperator);
}
/// <summary>
- /// Adds a condition for the double type property.
+ /// Adds a condition for the double type.
/// </summary>
/// <param name="logicalOperator">The operator type</param>
/// <param name="propertyId">The property ID to add a condition</param>
/// <param name="matchType">The match flag</param>
/// <param name="matchValue">The match valu</param>
+ /// <exception cref="NotSupportedException">Thrown when an invoked method is not supported</exception>
+ /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
public void AddCondition(LogicalOperator logicalOperator, uint propertyId, IntegerMatchType matchType, double matchValue)
{
int error = Interop.Calendar.Filter.AddOperator(_filterHandle, logicalOperator);
}
/// <summary>
- /// Adds a condition for the CalendarTime type property.
+ /// Adds a condition for the CalendarTime type.
/// </summary>
/// <param name="logicalOperator">The operator type</param>
/// <param name="propertyId">The property ID to add a condition</param>
/// <param name="matchType">The match flag</param>
/// <param name="matchValue">The match valu</param>
+ /// <exception cref="NotSupportedException">Thrown when an invoked method is not supported</exception>
+ /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
public void AddCondition(LogicalOperator logicalOperator, uint propertyId, IntegerMatchType matchType, CalendarTime matchValue)
{
int error = Interop.Calendar.Filter.AddOperator(_filterHandle, logicalOperator);
/// </summary>
/// <param name="logicalOperator">The operator type</param>
/// <param name="filter">The child filter</param>
+ /// <exception cref="NotSupportedException">Thrown when an invoked method is not supported</exception>
+ /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
public void AddFilter(LogicalOperator logicalOperator, CalendarFilter filter)
{
int error = Interop.Calendar.Filter.AddOperator(_filterHandle, logicalOperator);
using System.Collections;
using System.Collections.Generic;
-/// <summary>
-/// </summary>
-/// <remarks>
-/// </remarks>
namespace Tizen.Pims.Calendar
{
/// <summary>
+ /// A list of records with the same type.
/// </summary>
public class CalendarList:IDisposable
{
/// <summary>
/// Creates a calendar list.
/// </summary>
+ /// <exception cref="NotSupportedException">Thrown when an invoked method is not supported</exception>
+ /// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory</exception>
public CalendarList()
{
int error = Interop.Calendar.List.Create(out _listHandle);
}
}
+ /// <summary>
+ /// Releases all resources used by the CalendarList.
+ /// It should be called after finished using of the object.
+ /// </summary>
public void Dispose()
{
Dispose(true);
/// Adds a record to the calendar list.
/// </summary>
/// <param name="record">The record to be added</param>
+ /// <exception cref="NotSupportedException">Thrown when an invoked method is not supported</exception>
+ /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
public void AddRecord(CalendarRecord record)
{
int error = Interop.Calendar.List.Add(_listHandle, record._recordHandle);
/// Removes a record from the calendar list.
/// </summary>
/// <param name="record">The record to be removed</param>
+ /// <exception cref="NotSupportedException">Thrown when an invoked method is not supported</exception>
+ /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
public void RemoveRecord(CalendarRecord record)
{
int error = Interop.Calendar.List.Remove(_listHandle, record._recordHandle);
/// Retrieves a record from the calendar list.
/// </summary>
/// <returns>
- /// CalendarRecord
+ /// calendar record
/// </returns>
public CalendarRecord GetCurrentRecord()
{
{
int error = Interop.Calendar.List.Prev(_listHandle);
if (CalendarError.None == (CalendarError)error)
+ {
return true;
+ }
else if (this.Count > 0 && CalendarError.NoData == (CalendarError)error)
{
Log.Debug(Globals.LogTag, "Nodata MovePrevious " + error);
{
int error = Interop.Calendar.List.Next(_listHandle);
if (CalendarError.None == (CalendarError)error)
+ {
return true;
+ }
else if (this.Count > 0 && CalendarError.NoData == (CalendarError)error)
{
Log.Debug(Globals.LogTag, "Nodata MoveNext" + error);
using System.Collections.Generic;
using static Interop.Calendar.Service;
-/// <summary>
-/// </summary>
-/// <remarks>
-/// </remarks>
namespace Tizen.Pims.Calendar
{
/// <summary>
+ /// A class for managing calendar information. It allows applications to use calendar service.
/// </summary>
public class CalendarManager : IDisposable
{
/// <summary>
/// Create a manager.
/// </summary>
+ /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
public CalendarManager()
{
int error = Interop.Calendar.Service.Connect();
}
#region IDisposable Support
- private bool disposedValue = false; // To detect redundant calls
+ /// To detect redundant calls
+ private bool disposedValue = false;
protected virtual void Dispose(bool disposing)
{
}
}
+ /// <summary>
+ /// Releases all resources used by the CalendarManager.
+ /// It should be called after finished using of the object.
+ /// </summary>
public void Dispose()
{
Dispose(true);
using System;
using static Interop.Calendar.Query;
-/// <summary>
-/// </summary>
-/// <remarks>
-/// </remarks>
namespace Tizen.Pims.Calendar
{
- /// <summary>
+ /// A query is used to retrieve data which satisfies given criteria.
/// </summary>
+ /// <remarks>
+ /// A query is used to retrieve calendar data which satisfies a given criteria,
+ /// such as an integer property being greater than a given value,
+ /// or a string property containing a given substring.
+ /// A query needs a filter which can set the conditions for the search.
+ /// </remarks>
public class CalendarQuery : IDisposable
{
internal IntPtr _queryHandle;
/// Creates a query.
/// </summary>
/// <param name="viewUri">The view URI of a query</param>
+ /// <exception cref="NotSupportedException">Thrown when an invoked method is not supported</exception>
+ /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
+ /// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory</exception>
public CalendarQuery(string viewUri)
{
int error = Interop.Calendar.Query.Create(viewUri, out _queryHandle);
}
}
+ /// <summary>
+ /// Releases all resources used by the CalendarQuery.
+ /// It should be called after finished using of the object.
+ /// </summary>
public void Dispose()
{
Dispose(true);
/// Adds property IDs for projection.
/// </summary>
/// <param name="propertyIdArray">The property ID array </param>
+ /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
public void SetProjection(uint[] propertyIdArray)
{
int error = Interop.Calendar.Query.SetProjection(_queryHandle, propertyIdArray, propertyIdArray.Length);
/// Sets the "distinct" option for projection.
/// </summary>
/// <param name="set">If true it is set, otherwise if false it is unset</param>
+ /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
public void SetDistinct(bool set)
{
int error = Interop.Calendar.Query.SetDistinct(_queryHandle, set);
/// Sets the filter for a query.
/// </summary>
/// <param name="filter">The filter</param>
+ /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
public void SetFilter(CalendarFilter filter)
{
int error = Interop.Calendar.Query.SetFilter(_queryHandle, filter._filterHandle);
/// </summary>
/// <param name="propertyId">The property ID to sort</param>
/// <param name="isAscending">If true it sorts in the ascending order, otherwise if false it sorts in the descending order</param>
+ /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
public void SetSort(uint propertyId, bool isAscending)
{
int error = Interop.Calendar.Query.SetSort(_queryHandle, propertyId, isAscending);
using System.Collections.Generic;
using System.Runtime.InteropServices;
-/// <summary>
-/// </summary>
-/// <remarks>
-/// </remarks>
namespace Tizen.Pims.Calendar
{
/// <summary>
+ /// A record represents an actual record in the database
/// </summary>
+ /// <remarks>
+ /// A record represents an actual record in the database,
+ /// but you can also consider it a piece of information, such as an alarm, attendee and extended.
+ /// A record can be a complex set of data, containing other data.
+ /// For example, a calendar record contains the alarm property, which is a reference to an alarm record.
+ /// An alarm record could belong to a event record,
+ /// and its alarm id property is set to the identifier of the corresponding event.
+ /// In this case, the alarm is the child record of the event and the event is the parent record.
+ /// </remarks>
public class CalendarRecord : IDisposable
{
internal string _uri;
/// Creates a record.
/// </summary>
/// <param name="viewUri">The view URI</param>
+ /// <exception cref="NotSupportedException">Thrown when an invoked method is not supported</exception>
+ /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
+ /// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory</exception>
public CalendarRecord(string viewUri)
{
int error = 0;
}
#region IDisposable Support
- internal bool _disposedValue = false; // To detect redundant calls
+ /// To detect redundant calls
+ internal bool _disposedValue = false;
protected virtual void Dispose(bool disposing)
{
}
}
+ /// <summary>
+ /// Releases all resources used by the CalendarRecord.
+ /// It should be called after finished using of the object.
+ /// </summary>
public void Dispose()
{
Dispose(true);
/// <summary>
/// Makes a clone of a record.
/// </summary>
+ /// <returns>
+ /// A cloned record
+ /// </returns>
+ /// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory</exception>
public CalendarRecord Clone()
{
IntPtr _clonedRecordHandle;
/// </summary>
/// <param name="propertyId">The property ID</param>
/// <returns>
- /// The value of record which property id is matched.
+ /// The value of the property corresponding to property id.
/// </returns>
+ /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
public T Get<T>(uint propertyId)
{
object parsedValue = null;
}
/// <summary>
- /// Sets a object to a record.
+ /// Sets a value of the property to a record.
/// </summary>
/// <param name="propertyId">The property ID</param>
/// <param name="value">value</param>
+ /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
public void Set<T>(uint propertyId, T value)
{
if (typeof(T) == typeof(string))
/// </summary>
/// <param name="propertyId">The property ID</param>
/// <param name="childRecord">The child record</param>
+ /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
public void AddChildRecord(uint propertyId, CalendarRecord childRecord)
{
int error = Interop.Calendar.Record.AddChildRecord(_recordHandle, propertyId, childRecord._recordHandle);
/// </summary>
/// <param name="propertyId">The property ID</param>
/// <param name="childRecord">The child record</param>
+ /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
public void RemoveChildRecord(uint propertyId, CalendarRecord childRecord)
{
int error = Interop.Calendar.Record.RemoveChildRecord(_recordHandle, propertyId, childRecord._recordHandle);
}
/// <summary>
- /// Get a child record count.
+ /// Gets a child record from the parent record
/// </summary>
/// <param name="propertyId">The property ID</param>
/// <returns>
- /// Count
+ /// The number of child records corresponding to property ID
/// </returns>
+ /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
public int GetChildRecordCount(uint propertyId)
{
int count = 0;
}
/// <summary>
- /// Get a child record with index.
+ /// Gets a child record from the parent record
/// </summary>
/// <param name="propertyId">The property ID</param>
/// <param name="index">The child record index</param>
/// <returns>
- /// CalendarRecord
+ /// The record
/// </returns>
+ /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
public CalendarRecord GetChildRecord(uint propertyId, int index)
{
IntPtr handle;
}
/// <summary>
- /// Makes a clone of a given record's child record list.
+ /// Clones a child record list corresponding to property ID
/// </summary>
/// <param name="propertyId">The property ID</param>
/// <returns>
- /// CalendarList
+ /// the record list
/// </returns>
+ /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
public CalendarList CloneChildRecordList(uint propertyId)
{
IntPtr listHandle;
using System;
using static Interop.Calendar.Reminder;
-/// <summary>
-/// </summary>
-/// <remarks>
-/// </remarks>
namespace Tizen.Pims.Calendar
{
/// <summary>
+ /// A class for reminder for event.
/// </summary>
+ /// <remarks>
+ /// The client who wants to be alerted at specific time should register MIME("application/x-tizen.calendar.reminder") type in manifest.xml file.
+ /// </remarks>
public class CalendarReminder : IDisposable
{
#region IDisposable Support
}
}
+ /// <summary>
+ /// Releases all resources used by the CalendarReminder.
+ /// It should be called after finished using of the object.
+ /// </summary>
public void Dispose()
{
Dispose(true);
if (s_reminderAlerted == null)
{
/// _reminderAlertedCallback is removed by .Net Core
- /// int error = Interop.Calendar.Reminder.Remove(_reminderAlertedCallback, IntPtr.Zero);
- /// if (CalendarError.None != (CalendarError)error)
- /// {
- /// Log.Error(Globals.LogTag, "Remove reminder Failed with error " + error);
- /// throw CalendarErrorFactory.GetException(error);
- /// }
+ int error = Interop.Calendar.Reminder.Remove(_reminderAlertedCallback, IntPtr.Zero);
+ if (CalendarError.None != (CalendarError)error)
+ {
+ Log.Error(Globals.LogTag, "Remove reminder Failed with error " + error);
+ throw CalendarErrorFactory.GetException(error);
+ }
}
}
}
using System;
using System.Runtime.InteropServices;
-/// <summary>
-/// </summary>
-/// <remarks>
-/// </remarks>
namespace Tizen.Pims.Calendar
{
/// <summary>
+ /// A class for time to set, get or calcurate.
/// </summary>
public class CalendarTime : IComparable<CalendarTime>
{
/// <param name="hour">hour</param>
/// <param name="minute">minute</param>
/// <param name="second">second</param>
+ /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
+ /// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory</exception>
public CalendarTime(int year, int month, int day, int hour, int minute, int second)
{
_type = (int)Type.Local;
/// <returns>
/// A 32-bit signed integer that indicates the relative order of the objects being compared.
/// </returns>
+ /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
+ /// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory</exception>
public int CompareTo(CalendarTime t)
{
if (_type != t._type)
- throw new NotImplementedException("Not to compare with different type");
+ {
+ Log.Error(Globals.LogTag, "Not to compare with different type");
+ throw CalendarErrorFactory.GetException((int)CalendarError.InvalidParameter);
+ }
if (_type == (int)Type.Utc)
return UtcTime.CompareTo(t.UtcTime);
using System.Collections.Generic;
using System.Threading.Tasks;
-/// <summary>
-/// </summary>
-/// <remarks>
-/// </remarks>
namespace Tizen.Pims.Calendar
{
/// <summary>
+ /// A class for parsing and composing vCalendar.
/// </summary>
+ /// <remarks>
+ /// It's based on the vCalendar v2.0 specification
+ /// </remarks>
public class CalendarVcalendar
{
internal CalendarVcalendar()
/// <returns>
/// The composed stream.
/// </returns>
+ /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
+ /// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory</exception>
public static string Compose(CalendarList list)
{
string stream;
/// </summary>
/// <param name="stream">The vcalendar stream</param>
/// <returns>
- /// List of records
+ /// the record list
/// </returns>
+ /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
+ /// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory</exception>
public static CalendarList Parse(string stream)
{
int error = 0;
/// Parse vcalendar file with foreach
/// </summary>
/// <param name="path">The file path of the vCalendar stream file</param>
- /// <param name="callback"></param>
+ /// <param name="callback">he callback function to invoke</param>
+ /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
+ /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
+ /// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory</exception>
public static void ParseForEach(string path, ParseDelegate callback)
{
int error = 0;
using System.Collections;
using System.Collections.Generic;
-/// <summary>
-/// </summary>
-/// <remarks>
-/// </remarks>
namespace Tizen.Pims.Calendar
{
/// <summary>
+ /// This class provides information about views with properties.
/// </summary>
+ /// <remarks>
+ /// A view is a class which describes properties of a record.
+ /// A record can have basic properties of five types: integer, string, long, double, CalendarTime.
+ /// </remarks>
public static class CalendarViews
{
/// data type mask 0x0FF00000
ExtendedValue = (ViewExtended|DataTypeString) + 4,
}
- internal const uint AverageSizeOfRecord = 56; ///average size
+ ///average size
+ internal const uint AverageSizeOfRecord = 56;
- /// <summary>
- /// </summary>
- public class Book
+ public static class Book
{
- internal Book()
- {
- }
-
/// <summary>
/// Identifier of this calendar book view
/// </summary>
public const uint Mode = (uint)PropertyIds.BookMode;
}
- /// <summary>
- /// </summary>
- public class Event
+ public static class Event
{
- internal Event()
- {
- }
-
/// <summary>
/// Identifier of this event view
/// </summary>
public const uint LinkBaseId = (uint)PropertyIds.EventLinkBaseId;
}
- /// <summary>
- /// </summary>
- /// <param name=""></param>
- public class Todo
+ public static class Todo
{
- internal Todo()
- {
- }
-
/// <summary>
/// Identifier of this todo view
/// </summary>
public const uint IsAllday = (uint)PropertyIds.TodoIsAllday;
}
- /// <summary>
- /// </summary>
- /// <param name=""></param>
- public class Timezone
+ public static class Timezone
{
- internal Timezone()
- {
- }
-
/// <summary>
/// Identifier of this timezone view
/// </summary>
public const uint CalendarId = (uint)PropertyIds.TimezoneCalendarId;
}
- /// <summary>
- /// </summary>
- public class Attendee
+ public static class Attendee
{
- internal Attendee()
- {
- }
-
/// <summary>
/// Identifier of this calendar attendee view
/// </summary>
public const uint ParentId = (uint)PropertyIds.AttendeeParentId;
}
- /// <summary>
- /// </summary>
- public class Alarm
+ public static class Alarm
{
- internal Alarm()
- {
- }
-
/// <summary>
/// Identifier of this calendar alarm view
/// </summary>
public const uint AlarmTime = (uint)PropertyIds.AlarmAlarm;
}
- /// <summary>
- /// </summary>
- public class InstanceUtimeBook
+ public static class InstanceUtimeBook
{
- internal InstanceUtimeBook()
- {
- }
-
/// <summary>
/// Identifier of this instance utime book
/// </summary>
public const uint SyncData1 = (uint)PropertyIds.InstanceUtimeBookSyncData1;
}
- /// <summary>
- /// </summary>
- public class InstanceLocaltimeBook
+ public static class InstanceLocaltimeBook
{
- internal InstanceLocaltimeBook()
- {
- }
-
/// <summary>
/// Uri
/// </summary>
public const uint IsAllday = (uint)PropertyIds.InstanceLocaltimeBookIsAllday;
}
- /// <summary>
- /// </summary>
- /// <param name=""></param>
- public class InstanceUtimeBookExtended
+ public static class InstanceUtimeBookExtended
{
- internal InstanceUtimeBookExtended()
- {
- }
-
/// <summary>
/// Uri
/// </summary>
public const uint SyncData4 = (uint)PropertyIds.InstanceUtimeBookExtendedSyncData4;
}
- /// <summary>
- /// </summary>
- /// <param name=""></param>
- public class InstanceLocaltimeBookExtended
+ public static class InstanceLocaltimeBookExtended
{
- internal InstanceLocaltimeBookExtended()
- {
- }
-
/// <summary>
/// Uri
/// </summary>
public const uint IsAllday = (uint)PropertyIds.InstanceLocaltimeBookExtendedIsAllday;
}
- /// <summary>
- /// </summary>
- public class UpdatedInfo
+ public static class UpdatedInfo
{
- internal UpdatedInfo()
- {
- }
-
/// <summary>
/// Identifier of this updatedInfo view
/// </summary>
public const uint Version = (uint)PropertyIds.UpdateInfoVersion;
}
- /// <summary>
- /// </summary>
- public class Extended
+ public static class Extended
{
- internal Extended()
- {
- }
-
/// <summary>
/// Identifier of this extended_property view
/// </summary>
using System;
using System.Collections.Generic;
-/// <summary>
-/// </summary>
-/// <remarks>
-/// </remarks>
namespace Tizen.Pims.Calendar
{
/// <summary>