#include "StorageChangesFolderGenerator.h"
#include "StorageChangesFolderFilterValidatorFactory.h"
-
#include "IMessagingTypes.h"
-
#include <email-types.h>
-
-#include <dpl/log/log.h>
+#include <Logger.h>
using namespace std;
using namespace DeviceAPI::Tizen;
m_type = (unsigned short)folder->getType();
m_synchronizable = folder->getSynchronizable();
- LogDebug("m_type:" << m_type );
+ LoggerD("m_type:" << m_type );
}
void StorageChangesFolderGenerator::visitPreComposite(DeviceAPI::Tizen::FilterType& type, int depth){
- LogDebug("<<<");
+ LoggerD("<<<");
m_operand.push_back(leftblank);
- LogDebug("Left_blank");
- LogDebug(">>>");
+ LoggerD("Left_blank");
+ LoggerD(">>>");
}
void StorageChangesFolderGenerator::visitInComposite(DeviceAPI::Tizen::FilterType& type, int depth){
- LogDebug("<<<");
+ LoggerD("<<<");
if(type == UNION_FILTER ){
- LogDebug("UNION_FILTER");
+ LoggerD("UNION_FILTER");
m_operand.push_back(operandUnion);
}else if(type == INTERSECTION_FILTER){
- LogDebug("INTERSECTION_FILTER");
+ LoggerD("INTERSECTION_FILTER");
m_operand.push_back(operandIntersection);
}else{
- LogError("[ERROR] invalid Filter type:" << type);
+ LoggerE("[ERROR] invalid Filter type:" << type);
}
- LogDebug(">>>");
+ LoggerD(">>>");
}
void StorageChangesFolderGenerator::visitPostComposite(DeviceAPI::Tizen::FilterType& type, int depth){
- LogDebug("<<<");
+ LoggerD("<<<");
bool data1, data2;
do
{
- LogDebug("m_result size =" << m_result.size());
+ LoggerD("m_result size =" << m_result.size());
data1 = m_result.back();
m_result.pop_back();
data2 = m_result.back();
m_result.pop_back();
- LogDebug("m_result size =" << m_result.size());
- LogDebug("m_operand.back() =" << m_operand.back());
- LogDebug("m_operand size =" << m_operand.size());
+ LoggerD("m_result size =" << m_result.size());
+ LoggerD("m_operand.back() =" << m_operand.back());
+ LoggerD("m_operand size =" << m_operand.size());
if(m_operand.back() == operandUnion)
{
- LogDebug("Union");
- LogDebug("data1 = " << data1);
- LogDebug("data2 = " << data2);
- LogDebug("data1 || data2 = " << (data1 || data2));
+ LoggerD("Union");
+ LoggerD("data1 = " << data1);
+ LoggerD("data2 = " << data2);
+ LoggerD("data1 || data2 = " << (data1 || data2));
m_operand.pop_back();
m_result.push_back(data1 || data2);
- LogDebug("result" << m_result.back());
- LogDebug("m_result size =" << m_result.size());
+ LoggerD("result" << m_result.back());
+ LoggerD("m_result size =" << m_result.size());
}
else if(m_operand.back() == operandIntersection)
{
- LogDebug("Intersection");
- LogDebug("data1 = " << data1);
- LogDebug("data2 = " << data2);
- LogDebug("data1 && data2 = " << (data1 && data2));
+ LoggerD("Intersection");
+ LoggerD("data1 = " << data1);
+ LoggerD("data2 = " << data2);
+ LoggerD("data1 && data2 = " << (data1 && data2));
m_operand.pop_back();
m_result.push_back(data1 && data2);
- LogDebug("result " << m_result.back());
- LogDebug("m_result size =" << m_result.size());
+ LoggerD("result " << m_result.back());
+ LoggerD("m_result size =" << m_result.size());
}
}while(m_operand.back() != leftblank);
m_operand.pop_back();
- LogDebug("elase leftblank from m_operand");
- LogDebug("m_operand size =" << m_operand.size());
- LogDebug(">>>");
+ LoggerD("elase leftblank from m_operand");
+ LoggerD("m_operand size =" << m_operand.size());
+ LoggerD(">>>");
}
bool StorageChangesFolderGenerator::getMatchExactlyClause(std::string& attrName, DeviceAPI::Tizen::AnyPtr& value)
{
std::string valueString = value->toString();
- LogDebug("<<< attrName : " << attrName);
- LogDebug("<<< valueString : " << valueString);
- LogDebug("<<< attrName.compare(valueString) : " << attrName.compare(valueString));
+ LoggerD("<<< attrName : " << attrName);
+ LoggerD("<<< valueString : " << valueString);
+ LoggerD("<<< attrName.compare(valueString) : " << attrName.compare(valueString));
if(attrName.compare(valueString) == 0)
{
- LogDebug("<<< getMatchExactlyClause SAME >>>");
+ LoggerD("<<< getMatchExactlyClause SAME >>>");
return TRUE;
}
else{
- LogDebug("<<< getMatchExactlyClause DIFF >>>");
+ LoggerD("<<< getMatchExactlyClause DIFF >>>");
return FALSE;
}
}
std::string tempString2;
std::string valueString = value->toString();
- LogDebug("<<< attrName : " << attrName);
- LogDebug("<<< valueString : " << valueString);
+ LoggerD("<<< attrName : " << attrName);
+ LoggerD("<<< valueString : " << valueString);
tempString1.assign(attrName);
tempString2.assign(valueString);
StrLowChange(tempString1);
StrLowChange(tempString2);
- LogDebug("<<< attrName : " << tempString1);
- LogDebug("<<< valueString : " << tempString2);
+ LoggerD("<<< attrName : " << tempString1);
+ LoggerD("<<< valueString : " << tempString2);
if(tempString1.compare(tempString2) == 0)
{
- LogDebug("<<< getMatchFullstringClause SAME >>>");
+ LoggerD("<<< getMatchFullstringClause SAME >>>");
return TRUE;
}
else{
- LogDebug("<<< getMatchFullstringClause DIFF >>>");
+ LoggerD("<<< getMatchFullstringClause DIFF >>>");
return FALSE;
}
}
std::string tempString2;
std::string valueString = value->toString();
- LogDebug("<<< attrName : " << attrName);
- LogDebug("<<< valueString : " << valueString);
+ LoggerD("<<< attrName : " << attrName);
+ LoggerD("<<< valueString : " << valueString);
tempString1.assign(attrName);
tempString2.assign(valueString);
StrLowChange(tempString1);
StrLowChange(tempString2);
- LogDebug("<<< attrName : " << tempString1);
- LogDebug("<<< valueString : " << tempString2);
+ LoggerD("<<< attrName : " << tempString1);
+ LoggerD("<<< valueString : " << tempString2);
if(tempString1.find(tempString2) != std::string::npos)
{
- LogDebug("<<< getMatchContainsClause CONTAINS >>>");
+ LoggerD("<<< getMatchContainsClause CONTAINS >>>");
return TRUE;
}else{
- LogDebug("<<< getMatchContainsClause NOT CONTAINS >>>");
+ LoggerD("<<< getMatchContainsClause NOT CONTAINS >>>");
return FALSE;
}
}
std::string tempString2;
std::string valueString = value->toString();
- LogDebug("<<< attrName : " << attrName);
- LogDebug("<<< valueString : " << valueString);
+ LoggerD("<<< attrName : " << attrName);
+ LoggerD("<<< valueString : " << valueString);
tempString1.assign(attrName);
tempString2.assign(valueString);
StrLowChange(tempString1);
StrLowChange(tempString2);
- LogDebug("<<< attrName : " << tempString1);
- LogDebug("<<< valueString : " << tempString2);
+ LoggerD("<<< attrName : " << tempString1);
+ LoggerD("<<< valueString : " << tempString2);
if(tempString1.size() < tempString2.size())
return FALSE;
if(tempString1.compare(0,tempString2.size(), tempString2) == 0)
{
- LogDebug("<<< getMatchStartwithClause START WITH >>>");
+ LoggerD("<<< getMatchStartwithClause START WITH >>>");
return TRUE;
}
else{
- LogDebug("<<< getMatchStartwithClause NOT START WITH >>>");
+ LoggerD("<<< getMatchStartwithClause NOT START WITH >>>");
return FALSE;
}
}
std::string tempString2;
std::string valueString = value->toString();
- LogDebug("<<< attrName : " << attrName);
- LogDebug("<<< valueString : " << valueString);
+ LoggerD("<<< attrName : " << attrName);
+ LoggerD("<<< valueString : " << valueString);
tempString1.assign(attrName);
tempString2.assign(valueString);
StrLowChange(tempString1);
StrLowChange(tempString2);
- LogDebug("<<< attrName : " << tempString1);
- LogDebug("<<< valueString : " << tempString2);
+ LoggerD("<<< attrName : " << tempString1);
+ LoggerD("<<< valueString : " << tempString2);
if(tempString1.size() < tempString2.size())
return FALSE;
if(tempString1.compare(tempString1.size()-tempString2.size(),tempString2.size(), tempString2) == 0 )
{
- LogDebug("<<< getMatchEndwithClause END WITH >>>");
+ LoggerD("<<< getMatchEndwithClause END WITH >>>");
return TRUE;
}
else{
- LogDebug("<<< getMatchEndwithClause NOT END WITH >>>");
+ LoggerD("<<< getMatchEndwithClause NOT END WITH >>>");
return FALSE;
}
}
bool StorageChangesFolderGenerator::getMatchExistClause(std::string& attrName)
{
- LogDebug("<<< attrName : " << attrName);
+ LoggerD("<<< attrName : " << attrName);
if(attrName.size()> 0)
return TRUE;
else
void StorageChangesFolderGenerator::visitAttribute(std::string& attrName,
DeviceAPI::Tizen::MatchFlag& matchFlag, DeviceAPI::Tizen::AnyPtr& matchValue, int depth){
- LogDebug("<<< attrName:[" << attrName << "], matchFlag:[" << matchFlag << "]");
+ LoggerD("<<< attrName:[" << attrName << "], matchFlag:[" << matchFlag << "]");
if(matchFlag != DeviceAPI::Tizen::MATCH_EXISTS){
if(matchValue == NULL) {
}
}
- LogDebug("matchValue:" << matchValue->toString());
+ LoggerD("matchValue:" << matchValue->toString());
visitAttributeEach(attrName, matchFlag, matchValue, depth);
}
void StorageChangesFolderGenerator::visitAttributeEach(std::string& attrName, DeviceAPI::Tizen::MatchFlag& matchFlag, DeviceAPI::Tizen::AnyPtr& value, int depth){
- LogDebug("<<< attrName:[" << attrName << "], value:[" << value->toString() << "]");
+ LoggerD("<<< attrName:[" << attrName << "], value:[" << value->toString() << "]");
std::string valueString;
// Check Folder_type and filter_type
if(attrName.compare( StorageChangesFolderFilterValidatorFactory::ATTRIBUTE_ACCOUNT_ID)==0){
- LogDebug("<<< value:[" << value << "]");
+ LoggerD("<<< value:[" << value << "]");
int nType = atoi(value->toString().c_str());
if((int)m_accountid == nType)
{
m_result.push_back(TRUE);
- LogDebug("<<< accountid is same");
+ LoggerD("<<< accountid is same");
}
else
{
m_result.push_back(FALSE);
- LogDebug("<<< accountid is different");
+ LoggerD("<<< accountid is different");
}
return;
}
if(attrName.compare(StorageChangesFolderFilterValidatorFactory::ATTRIBUTE_CONTENT_TYPE)==0){
- LogDebug("<<< value:[" << value << "]");
+ LoggerD("<<< value:[" << value << "]");
std::string convertType = value->toString();
int nType = convertMessageType(convertType);
if((int)m_contestType == nType)
{
m_result.push_back(TRUE);
- LogDebug("<<< contestType is same");
+ LoggerD("<<< contestType is same");
}
else
{
m_result.push_back(FALSE);
- LogDebug("<<< contestType is different");
+ LoggerD("<<< contestType is different");
}
return;
}
if(attrName.compare(StorageChangesFolderFilterValidatorFactory::ATTRIBUTE_TYPE )==0){
- LogDebug("<<< value:[" << value << "]");
+ LoggerD("<<< value:[" << value << "]");
std::string convertType = value->toString();
int nType = convertFolderType(convertType);
if((int)m_type == nType)
{
m_result.push_back(TRUE);
- LogDebug("<<< type is same");
+ LoggerD("<<< type is same");
}
else
{
m_result.push_back(FALSE);
- LogDebug("<<< type is different");
+ LoggerD("<<< type is different");
}
return;
}
if(attrName.compare(StorageChangesFolderFilterValidatorFactory::ATTRIBUTE_SYNCHRONIZABLE)==0){
- LogDebug("<<< value:[" << value << "]");
+ LoggerD("<<< value:[" << value << "]");
std::string lowerString;
lowerString.assign(value->toString());
StrLowChange(lowerString);
if((int)m_synchronizable != nType)
{
m_result.push_back(TRUE);
- LogDebug("<<< synchronizable is same");
+ LoggerD("<<< synchronizable is same");
}
else
{
m_result.push_back(FALSE);
- LogDebug("<<< synchronizable is different");
+ LoggerD("<<< synchronizable is different");
}
return;
}
if(attrName.compare(StorageChangesFolderFilterValidatorFactory::ATTRIBUTE_NAME)==0){
- LogDebug("<<< value:[" << value << "]");
- LogDebug("<<< value->toString():[" << value->toString() << "]");
- LogDebug("<<< m_name:[" << m_name << "]");
+ LoggerD("<<< value:[" << value << "]");
+ LoggerD("<<< value->toString():[" << value->toString() << "]");
+ LoggerD("<<< m_name:[" << m_name << "]");
valueString = m_name;
if(getMatchFlagResult(value, valueString, matchFlag))
{
m_result.push_back(TRUE);
- LogDebug("<<< name is same");
+ LoggerD("<<< name is same");
}
else
{
m_result.push_back(FALSE);
- LogDebug("<<< name is different");
+ LoggerD("<<< name is different");
}
return;
}
if(attrName.compare(StorageChangesFolderFilterValidatorFactory::ATTRIBUTE_PATH)==0){
- LogDebug("<<< value:[" << value << "]");
- LogDebug("<<< value->toString():[" << value->toString() << "]");
- LogDebug("<<< m_path:[" << m_path << "]");
+ LoggerD("<<< value:[" << value << "]");
+ LoggerD("<<< value->toString():[" << value->toString() << "]");
+ LoggerD("<<< m_path:[" << m_path << "]");
valueString = m_path;
if(getMatchFlagResult(value, valueString, matchFlag))
{
m_result.push_back(TRUE);
- LogDebug("<<< path is same");
+ LoggerD("<<< path is same");
}
else
{
m_result.push_back(FALSE);
- LogDebug("<<< path is different");
+ LoggerD("<<< path is different");
}
return;
}
- LogDebug(">>>");
+ LoggerD(">>>");
}
int StorageChangesFolderGenerator::convertMessageType(std::string& stringType){
- LogDebug("<<< stringType:[" << stringType << "]");
+ LoggerD("<<< stringType:[" << stringType << "]");
int retMessageType = -1;
}else if(stringType.compare("messaging.email") ==0){
retMessageType = EMAIL;
}else{
- LogError("invalid type:[" << stringType << "]");
+ LoggerE("invalid type:[" << stringType << "]");
return -1;
}
- LogDebug(">>> retMessageType:" << retMessageType);
+ LoggerD(">>> retMessageType:" << retMessageType);
return retMessageType;
}
int StorageChangesFolderGenerator::convertFolderType(std::string& stringType){
- LogDebug("<<< stringType:[" << stringType << "]");
+ LoggerD("<<< stringType:[" << stringType << "]");
int retMessageType = -1;
}else if(stringType.compare("SENTBOX") ==0){
retMessageType = SENTBOX;
}else{
- LogError("invalid type:[" << stringType << "]");
+ LoggerE("invalid type:[" << stringType << "]");
return -1;
}
- LogDebug(">>> retMessageType:" << retMessageType);
+ LoggerD(">>> retMessageType:" << retMessageType);
return retMessageType;
}
void StorageChangesFolderGenerator::visitAttributeRange(std::string& attrName, DeviceAPI::Tizen::AnyPtr& initialValue, DeviceAPI::Tizen::AnyPtr& endValue, int depth) {
- LogDebug("<<< NOT SUPPROTED");
- LogDebug(">>>");
+ LoggerD("<<< NOT SUPPROTED");
+ LoggerD(">>>");
m_result.push_back(FALSE);
}
std::vector<std::string>::iterator iter;
bool result = FALSE;
if(matchFlag == DeviceAPI::Tizen::MATCH_EXACTLY){
- LogDebug("STRING_MATCH_EXACTLY");
+ LoggerD("STRING_MATCH_EXACTLY");
result = result || getMatchExactlyClause(valueString, value);
}else if(matchFlag == DeviceAPI::Tizen::MATCH_FULLSTRING){
- LogDebug("STRING_MATCH_FULLSTRING");
+ LoggerD("STRING_MATCH_FULLSTRING");
result = result || getMatchFullstringClause(valueString, value);
}else if(matchFlag == DeviceAPI::Tizen::MATCH_CONTAINS){
- LogDebug("STRING_MATCH_CONTAINS");
+ LoggerD("STRING_MATCH_CONTAINS");
result = result || getMatchContainsClause(valueString, value);
}else if(matchFlag == DeviceAPI::Tizen::MATCH_STARTSWITH){
- LogDebug("STRING_MATCH_STARTSWITH");
+ LoggerD("STRING_MATCH_STARTSWITH");
result = result || getMatchStartwithClause(valueString, value);
}else if(matchFlag == DeviceAPI::Tizen::MATCH_ENDSWITH){
- LogDebug("STRING_MATCH_ENDSWITH");
+ LoggerD("STRING_MATCH_ENDSWITH");
result = result || getMatchEndwithClause(valueString, value);
}else if(matchFlag == DeviceAPI::Tizen::MATCH_EXISTS){
- LogDebug("STRING_MATCH_EXIST");
+ LoggerD("STRING_MATCH_EXIST");
result = result || getMatchExistClause(valueString);
}else{
- LogDebug("[ERROR]invalid match flag : iter:" << *iter);
+ LoggerD("[ERROR]invalid match flag : iter:" << *iter);
}
return result;
}
bool StorageChangesFolderGenerator::getCompareResult()
{
bool result;
- LogDebug("m_result.size() " << m_result.size());
+ LoggerD("m_result.size() " << m_result.size());
result = m_result.back();
m_result.pop_back();
- LogDebug("result = " << result);
+ LoggerD("result = " << result);
return result;
}