void Error::readSystemException(hash data) { if (!data.contains(1)) { LOG_ERROR("Empty User Exception"); return; } bool ok; int errorCode = data[1].toInt(&ok); if (!ok) { LOG_ERROR("Unknown User Exception"); return; } EDAMErrorCode(errorCode); if (data.contains(2)) { QString message = data[2].toString(); LOG_INFO(message); } if (data.contains(3)) { int rateLimitDuration = data[3].toInt(); LOG_INFO(QString("Rate Limit Duration: %1 s.").arg(rateLimitDuration)); } }
void Error::readExceptions(hash data) { if (data.contains(1)) readUserException(data[1].value<hash>()); if (data.contains(2)) readSystemException(data[2].value<hash>()); if (data.contains(3)) readNotFoundException(data[3].value<hash>()); }
void Error::readNotFoundException(hash data) { QString e("Not Found Exception"); if (data.contains(1)) { QString identifier = data[1].toString(); e.append(" Identifier:"); e.append(identifier); } if (data.contains(2)) { QString key = data[2].toString(); e.append(" Key:"); e.append(key); } LOG_ERROR(e); }
void Error::readUserException(hash data) { if (!data.contains(1)) { LOG_ERROR("Empty User Exception"); return; } bool ok; int errorCode = data[1].toInt(&ok); if (!ok) { LOG_ERROR("Unknown User Exception"); return; } EDAMErrorCode(errorCode); QString parameter; if (data.contains(2)) { parameter = QString::fromUtf8(data[2].toByteArray()); LOG_INFO(parameter); } }
void NoteBook::loadFromData(hash data) { qDebug() << "readData" << data.keys(); if (data.contains(1)) guid = QString::fromUtf8(data[1].toByteArray()); if (data.contains(2)) name = QString::fromUtf8(data[2].toByteArray()); if (data.contains(5)) updateSequenceNum = data[5].toInt(); if (data.contains(6)) defaultNotebook = data[6].toBool(); if (data.contains(7)) serviceCreated = QDateTime::fromMSecsSinceEpoch(data[7].toLongLong()); if (data.contains(8)) serviceUpdated = QDateTime::fromMSecsSinceEpoch(data[8].toLongLong()); if (data.contains(12)) stack = QString::fromUtf8(data[12].toByteArray()); }
void Note::readAttributes(hash data) { if (data.contains(1)) attributes["subjectDate"] = data[1]; if (data.contains(10)) attributes["latitude"] = data[10]; if (data.contains(11)) attributes["longitude"] = data[11]; if (data.contains(12)) attributes["altitude"] = data[12]; if (data.contains(13)) attributes["author"] = data[13]; if (data.contains(14)) attributes["sourceURL"] = data[14]; if (data.contains(15)) attributes["sourceURL"] = data[15]; if (data.contains(16)) attributes["sourceApplication"] = data[16]; if (data.contains(17)) attributes["shareDate"] = data[17]; if (data.contains(18)) attributes["reminderOrder"] = data[18]; if (data.contains(19)) attributes["reminderDoneTime"] = data[19]; if (data.contains(20)) attributes["reminderTime"] = data[20]; if (data.contains(21)) attributes["placeName"] = data[21]; if (data.contains(22)) attributes["contentClass"] = data[22]; if (data.contains(23)) attributes["applicationData"] = data[23]; if (data.contains(24)) attributes["lastEditedBy"] = data[24]; if (data.contains(25)) attributes["classifications"] = data[25]; if (data.contains(27)) attributes["creatorId"] = data[27]; if (data.contains(28)) attributes["lastEditorId"] = data[28]; }
void Note::loadFromData(hash data) { if (data.contains(1)) guid = QString::fromUtf8(data[1].toByteArray()); if (data.contains(2)) title = QString::fromUtf8(data[2].toByteArray()); if (data.contains(3)) content = QString::fromUtf8(data[3].toByteArray()); if (data.contains(4)) contentHash = data[4].toByteArray().toHex(); if (data.contains(5)) contentLength = data[5].toInt(); if (data.contains(6)) created = QDateTime::fromMSecsSinceEpoch(data[6].toLongLong()); if (data.contains(7)) updated = QDateTime::fromMSecsSinceEpoch(data[7].toLongLong()); if (data.contains(8)) deleted = QDateTime::fromMSecsSinceEpoch(data[8].toLongLong()); if (data.contains(9)) active = data[9].toBool(); if (data.contains(10)) updateSequenceNum = data[10].toInt(); if (data.contains(11)) notebookGuid = QString::fromUtf8(data[11].toByteArray()); if (data.contains(12)) { list l = data[12].toList(); for (int i=0; i<l.size(); i++){ QString tguid = QString::fromUtf8(l.at(i).toByteArray()); tagGuids.append(tguid); } } if (data.contains(13)) { list l = data[13].toList(); QSqlDatabase::database().transaction(); for (int i=0; i<l.size(); i++){ hash res = l.at(i).value<hash>(); Resource *r = new Resource(this, res); delete r; } QSqlDatabase::database().commit(); } if (data.contains(14)) { hash attr = data[14].value<hash>(); readAttributes(attr); } }