*/
#include "Person.h"
-
-#include <dpl/log/log.h>
#include <dpl/exception.h>
#include <Commons/Exception.h>
#include <Commons/Regex.h>
#include "ContactUtility.h"
#include "ContactsSvcObjectConverter.h"
+#include <Logger.h>
namespace DeviceAPI {
namespace Contact {
Person::Person()
: IPerson()
{
- LogDebug("entered");
+ LoggerD("entered");
}
Person::Person(contacts_record_h record)
: IPerson()
{
- LogDebug("entered");
+ LoggerD("entered");
}
Person::~Person()
void Person::OnRequestReceived(const EventPersonLinkPtr &event)
{
- LogDebug("entered");
+ LoggerD("entered");
int errorCode = 0;
contacts_record_h contacts_record = NULL;
contacts_record_destroy(contacts_record, true);
contacts_record = NULL;
- LogDebug("Linking person : " << personId);
+ LoggerD("Linking person : " << personId);
errorCode = contacts_person_link_person(selfPersonId, personId);
if(errorCode == CONTACTS_ERROR_INVALID_PARAMETER)
}
Catch (InvalidArgumentException)
{
- LogError("Invalid person id : " << _rethrown_exception.GetMessage());
+ LoggerE("Invalid person id : " << _rethrown_exception.GetMessage());
event->setResult(false);
event->setExceptionCode(ExceptionCodes::InvalidArgumentException);
return;
}
Catch (NotFoundException)
{
- LogError("Person doesn't exist : " << _rethrown_exception.GetMessage());
+ LoggerE("Person doesn't exist : " << _rethrown_exception.GetMessage());
event->setResult(false);
event->setExceptionCode(ExceptionCodes::NotFoundException);
return;
}
Catch (PlatformException) {
- LogError("Error during linking person : " << _rethrown_exception.GetMessage());
+ LoggerE("Error during linking person : " << _rethrown_exception.GetMessage());
event->setResult(false);
event->setExceptionCode(ExceptionCodes::PlatformException);
return;
}
Catch (Exception) {
- LogError("Error during linking person : " << _rethrown_exception.GetMessage());
+ LoggerE("Error during linking person : " << _rethrown_exception.GetMessage());
event->setResult(false);
event->setExceptionCode(ExceptionCodes::PlatformException);
return;
void Person::OnRequestReceived(const EventPersonUnlinkPtr &event)
{
- LogDebug("entered");
+ LoggerD("entered");
int errorCode = 0;
int selfPersonId;
ThrowMsg(OutOfRangeException, "Contact (id:" << contactId << ") is not a member of person");
}
- LogDebug("Unlinking contact : " << contactId);
+ LoggerD("Unlinking contact : " << contactId);
int newPersonId = 0;
int errorCode = contacts_person_unlink_contact(selfPersonId, contactId, &newPersonId);
ThrowMsg(NotFoundException, "Error during executing contacts_person_unlink_contact()");
else if (errorCode != CONTACTS_ERROR_NONE)
ThrowMsg(PlatformException, "Error during executing contacts_person_unlink_contact()");
- LogDebug("newPersonId : " << newPersonId);
+ LoggerD("newPersonId : " << newPersonId);
errorCode = contacts_db_get_record(_contacts_person._uri, newPersonId, &contacts_record);
if(errorCode != CONTACTS_ERROR_NONE)
}
Catch (InvalidArgumentException)
{
- LogError("Invalid person id : " << _rethrown_exception.GetMessage());
+ LoggerE("Invalid person id : " << _rethrown_exception.GetMessage());
event->setResult(false);
event->setExceptionCode(ExceptionCodes::InvalidArgumentException);
return;
}
Catch (NotFoundException)
{
- LogError("Contact doesn't exist : " << _rethrown_exception.GetMessage());
+ LoggerE("Contact doesn't exist : " << _rethrown_exception.GetMessage());
event->setResult(false);
event->setExceptionCode(ExceptionCodes::NotFoundException);
return;
}
Catch (OutOfRangeException)
{
- LogError("Contact doesn't exist : " << _rethrown_exception.GetMessage());
+ LoggerE("Contact doesn't exist : " << _rethrown_exception.GetMessage());
event->setResult(false);
event->setExceptionCode(ExceptionCodes::OutOfRangeException);
return;
}
Catch (PlatformException) {
- LogError("Error during linking person : " << _rethrown_exception.GetMessage());
+ LoggerE("Error during linking person : " << _rethrown_exception.GetMessage());
event->setResult(false);
event->setExceptionCode(ExceptionCodes::PlatformException);
return;
}
Catch (Exception) {
- LogError("Error during linking person : " << _rethrown_exception.GetMessage());
+ LoggerE("Error during linking person : " << _rethrown_exception.GetMessage());
event->setResult(false);
event->setExceptionCode(ExceptionCodes::PlatformException);
return;