Example #1
0
bool WIZDOCUMENTDATAEX_XMLRPC_SIMPLE::LoadFromXmlRpc(CWizXmlRpcStructValue& data)
{
    data.GetStr(_T("document_guid"), strGUID);
    data.GetStr(_T("document_title"), strTitle);	/*用于同步过程,显示正在下载的文章标题////*/
    data.GetStr(_T("document_category"), strLocation);	/*用于CyberArticle判断是否需要下载该文档(是否属于当前书籍)////*/
    /*
        data.GetStr(_T("document_filename"), strName);
        data.GetStr(_T("document_seo"), strSEO);
        data.GetStr(_T("document_url"), strURL);
        data.GetStr(_T("document_author"), strAuthor);
        data.GetStr(_T("document_keywords"), strKeywords);
        data.GetStr(_T("document_type"), strType);
        data.GetStr(_T("document_owner"), strOwner);
        data.GetStr(_T("document_filetype"), strFileType);
        data.GetStr(_T("document_styleguid"), strStyleGUID);
        data.GetTime(_T("dt_created"), tCreated);
        data.GetTime(_T("dt_modified"), tModified);
        data.GetTime(_T("dt_accessed"), tAccessed);
        data.GetInt(_T("document_iconindex"), nIconIndex);
        data.GetInt(_T("document_protected"), nProtected);
        data.GetInt(_T("document_readcount"), nReadCount);
        data.GetInt(_T("document_attachment_count"), nAttachmentCount);
        */
    data.GetTime(_T("dt_info_modified"), tInfoModified);
    data.GetStr(_T("info_md5"), strInfoMD5);
    data.GetTime(_T("dt_data_modified"), tDataModified);
    data.GetStr(_T("data_md5"), strDataMD5);
    data.GetTime(_T("dt_param_modified"), tParamModified);
    data.GetStr(_T("param_md5"), strParamMD5);
    data.GetInt64(_T("version"), nVersion);
    //
    //data.GetArrayStringArray(_T("tags"), arrayTagGUID);
    //
    return !strGUID.isEmpty();
}
Example #2
0
/* -------------------------- WIZDOCUMENTPARAMDATA -------------------------- */
bool WIZDOCUMENTPARAMDATA::LoadFromXmlRpc(CWizXmlRpcStructValue& data,
                                          const QString& kbGUID)
{
    strKbGUID = kbGUID;
    return data.GetString("param_name", strName)
        && data.GetString("param_value", strValue);
}
Example #3
0
 BOOL LoadFromXmlRpc(CWizXmlRpcStructValue& data)
 {
     data.GetInt64(_T("obj_size"), nObjectSize);
     data.GetInt(_T("eof"), bEOF);
     data.GetInt64(_T("part_size"), nPartSize);
     data.GetString(_T("part_md5"), strPartMD5);
     return data.GetStream(_T("data"), stream);
 }
Example #4
0
/* ---------------------------- WIZKVRETURN ---------------------------- */
bool WIZKVRETURN::LoadFromXmlRpc(CWizXmlRpcStructValue& data)
{
    data.GetInt("return_code", nCode);
    data.GetString("value_of_key", value);
    data.GetInt64("version", nVersion);

    return nCode == 200;
}
Example #5
0
bool WIZDELETEDGUIDDATA::SaveToXmlRpc(CWizXmlRpcStructValue& data) const
{
    data.AddString("deleted_guid", strGUID);
    data.AddString("guid_type", WIZOBJECTDATA::ObjectTypeToTypeString(eType));
    data.AddTime("dt_deleted", tDeleted);
    data.AddInt64("version", nVersion);

    return true;
}
Example #6
0
BOOL WIZDELETEDGUIDDATA::SaveToXmlRpc(CWizXmlRpcStructValue& data) const
{
    data.AddString(_T("deleted_guid"), strGUID);
    data.AddString(_T("guid_type"), WIZOBJECTDATA::ObjectTypeToTypeString(eType));
    data.AddTime(_T("dt_deleted"), tDeleted);
    data.AddInt64(_T("version"), nVersion);
    //
    return TRUE;
}
Example #7
0
/* ---------------------------- WIZKVRETURN ---------------------------- */
bool WIZKVRETURN::LoadFromXmlRpc(CWizXmlRpcStructValue& data, const QString& kbGUID)
{
    Q_UNUSED(kbGUID);

    data.GetInt("return_code", nCode);
    data.GetString("value_of_key", value);
    data.GetInt64("version", nVersion);

    return nCode == 200;
}
Example #8
0
 BOOL LoadFromXmlRpc(CWizXmlRpcStructValue& data)
 {
     QString strType;
     //
     BOOL bRet = data.GetInt64(_T("document_version"), nDocumentVersion)
         && data.GetInt64(_T("tag_version"), nTagVersion)
         && data.GetInt64(_T("style_version"), nStyleVersion)
         && data.GetInt64(_T("attachment_version"), nAttachmentVersion)
         && data.GetInt64(_T("deleted_version"), nDeletedGUIDVersion);
     //
     return bRet;
 }
Example #9
0
bool WIZKBINFO::LoadFromXmlRpc(CWizXmlRpcStructValue& data)
{
    data.GetInt64(_T("storage_limit"), nStorageLimit);
    data.GetInt64(_T("storage_usage"), nStorageUsage);
    data.GetStr(_T("storage_limit_string"), strStorageLimit);
    data.GetStr(_T("storage_usage_string"), strStorageUsage);
    data.GetInt64(_T("traffic_limit"), nTrafficLimit);
    data.GetInt64(_T("traffic_usage"), nTrafficUsage);
    data.GetStr(_T("traffic_limit_string"), strTrafficLimit);
    data.GetStr(_T("traffic_usage_string"), strTrafficUsage);

    return true;
}
Example #10
0
bool WIZOBJECTPARTDATA::LoadFromXmlRpc(CWizXmlRpcStructValue& data)
{
    data.GetInt("eof", bEOF);
    data.GetInt64("obj_size", nObjectSize);
    data.GetString("part_md5", strPartMD5);
    data.GetInt64("part_size", nPartSize);

    if (!data.GetStream("data", arrayData)){
        TOLOG("Fault error, data is null!");
        return false;
    }

    return true;
}
Example #11
0
BOOL WIZDELETEDGUIDDATA::LoadFromXmlRpc(CWizXmlRpcStructValue& data, const QString& kbGUID)
{
    strKbGUID = kbGUID;

    CString strType;

    BOOL bRet = data.GetStr(_T("deleted_guid"), strGUID)
        && data.GetStr(_T("guid_type"), strType)
        && data.GetTime(_T("dt_deleted"), tDeleted)
        && data.GetInt64(_T("version"), nVersion);

    eType = WIZOBJECTDATA::TypeStringToObjectType(strType);

    return bRet;
}
Example #12
0
bool WIZOBJECTPARTDATA::LoadFromXmlRpc(CWizXmlRpcStructValue& data, const QString& kbGUID)
{
    strKbGUID = kbGUID;
    data.GetInt64(_T("obj_size"), nObjectSize);
    data.GetInt(_T("eof"), bEOF);
    data.GetInt64(_T("part_size"), nPartSize);
    data.GetString(_T("part_md5"), strPartMD5);
    if (!data.GetStream("data", arrayData))
    {
        TOLOG(_T("Fault error, data is null!"));
        return false;
    }

    return true;
}
Example #13
0
BOOL WIZDOCUMENTATTACHMENTDATA::LoadFromXmlRpc(CWizXmlRpcStructValue& data)
{
    data.GetStr("attachment_guid", strGUID);
    data.GetStr("attachment_document_guid", strDocumentGUID);
    data.GetStr("attachment_name", strName);
    data.GetStr("attachment_url", strURL);
    data.GetStr("attachment_description", strDescription);
    data.GetTime("dt_info_modified", tInfoModified);
    data.GetStr("info_md5", strInfoMD5);
    data.GetTime("dt_data_modified", tDataModified);
    data.GetStr("data_md5", strDataMD5);
    data.GetInt64("version", nVersion);

    return !strGUID.isEmpty() && !strDocumentGUID.isEmpty();
}
Example #14
0
bool WIZDELETEDGUIDDATA::LoadFromXmlRpc(CWizXmlRpcStructValue& data)
{
    CString strType;

    // this field maybe "nil"
    data.GetTime(_T("dt_deleted"), tDeleted);

    bool bRet = data.GetStr(_T("deleted_guid"), strGUID)
        && data.GetStr(_T("guid_type"), strType)
        && data.GetInt64(_T("version"), nVersion);

    eType = WIZOBJECTDATA::TypeStringToObjectType(strType);

    return bRet;
}
BOOL CWizXmlRpcServerBase::Call(const QString& strMethodName, std::map<QString, QString>& mapRet, CWizXmlRpcValue* pParam1, CWizXmlRpcValue* pParam2 /*= NULL*/, CWizXmlRpcValue* pParam3 /*= NULL*/, CWizXmlRpcValue* pParam4 /*= NULL*/)
{
    CWizXmlRpcResult ret;
    if (!Call(strMethodName, ret, pParam1, pParam2, pParam3, pParam4))
        return FALSE;
    //
    CWizXmlRpcStructValue* pValue = ret.GetResultValue<CWizXmlRpcStructValue>();
    if (!pValue)
    {
        TOLOG1(_T("The return value of XmpRpc method %1 is not a struct!"), strMethodName);
        return FALSE;
    }
    //
    return pValue->ToStringMap(mapRet);
}
Example #16
0
BOOL WIZDOCUMENTATTACHMENTDATA::LoadFromXmlRpc(CWizXmlRpcStructValue& data, const QString& kbGUID)
{
    strKbGUID = kbGUID;
    data.GetStr(_T("attachment_guid"), strGUID);
    data.GetStr(_T("attachment_document_guid"), strDocumentGUID);
    data.GetStr(_T("attachment_name"), strName);
    data.GetStr(_T("attachment_url"), strURL);
    data.GetStr(_T("attachment_description"), strDescription);
    data.GetTime(_T("dt_info_modified"), tInfoModified);
    data.GetStr(_T("info_md5"), strInfoMD5);
    data.GetTime(_T("dt_data_modified"), tDataModified);
    data.GetStr(_T("data_md5"), strDataMD5);
    data.GetInt64(_T("version"), nVersion);

    return !strGUID.IsEmpty() && !strDocumentGUID.IsEmpty();
}
Example #17
0
BOOL WIZDOCUMENTDATABASE::LoadFromXmlRpc(CWizXmlRpcStructValue& data, const QString& kbGUID)
{
    strKbGUID = kbGUID;
    data.GetStr(_T("document_guid"), strGUID);
    data.GetStr(_T("document_title"), strTitle);
    data.GetStr(_T("document_category"), strLocation);

    data.GetTime(_T("dt_info_modified"), tInfoModified);
    data.GetStr(_T("info_md5"), strInfoMD5);
    data.GetTime(_T("dt_data_modified"), tDataModified);
    data.GetStr(_T("data_md5"), strDataMD5);
    data.GetTime(_T("dt_param_modified"), tParamModified);
    data.GetStr(_T("param_md5"), strParamMD5);
    data.GetInt64(_T("version"), nVersion);

    return !strGUID.IsEmpty();
}
Example #18
0
bool WIZDOCUMENTDATABASE::LoadFromXmlRpc(CWizXmlRpcStructValue& data)
{
    data.GetString("data_md5", strDataMD5);
    data.GetString("document_category", strLocation);
    data.GetString("document_guid", strGUID);
    data.GetString("document_title", strTitle);

    data.GetTime("dt_info_modified", tInfoModified);
    data.GetTime("dt_data_modified", tDataModified);
    data.GetTime("dt_param_modified", tParamModified);

    data.GetString("info_md5", strInfoMD5);
    data.GetString("param_md5", strParamMD5);

    data.GetInt64("version", nVersion);

    return !strGUID.isEmpty();
}
Example #19
0
BOOL WIZTAGDATA::LoadFromXmlRpc(CWizXmlRpcStructValue& data)
{
    return data.GetStr(_T("tag_guid"), strGUID)
        && data.GetStr(_T("tag_group_guid"), strParentGUID)
        && data.GetStr(_T("tag_name"), strName)
        && data.GetStr(_T("tag_description"), strDescription)
        && data.GetTime(_T("dt_info_modified"), tModified)
        && data.GetInt64(_T("version"), nVersion);
}
Example #20
0
BOOL WIZSTYLEDATA::LoadFromXmlRpc(CWizXmlRpcStructValue& data)
{
    data.GetStr(_T("style_description"), strDescription);

    return data.GetStr(_T("style_guid"), strGUID)
        && data.GetStr(_T("style_name"), strName)
        && data.GetColor(_T("style_textcolor"), crTextColor)
        && data.GetColor(_T("style_backcolor"), crBackColor)
        && data.GetBool(_T("style_text_bold"), bTextBold)
        && data.GetInt(_T("style_flagindex"), nFlagIndex)
        && data.GetTime(_T("dt_info_modified"), tModified)
        && data.GetInt64(_T("version"), nVersion);
}
Example #21
0
BOOL WIZTAGDATA::SaveToXmlRpc(CWizXmlRpcStructValue& data) const
{
    data.AddString(_T("tag_guid"), strGUID);
    data.AddString(_T("tag_group_guid"), strParentGUID);
    data.AddString(_T("tag_name"), strName);
    data.AddString(_T("tag_description"), strDescription);
    data.AddTime(_T("dt_info_modified"), tModified);
    data.AddInt64(_T("version"), nVersion);;

    return TRUE;
}
Example #22
0
BOOL WIZSTYLEDATA::SaveToXmlRpc(CWizXmlRpcStructValue& data) const
{
    data.AddString(_T("style_description"), strDescription);;

    data.AddString(_T("style_guid"), strGUID);
    data.AddString(_T("style_name"), strName);
    data.AddColor(_T("style_textcolor"), crTextColor);
    data.AddColor(_T("style_backcolor"), crBackColor);
    data.AddBool(_T("style_text_bold"), bTextBold);
    data.AddInt(_T("style_flagindex"), nFlagIndex);
    data.AddTime(_T("dt_info_modified"), tModified);
    data.AddInt64(_T("version"), nVersion);;

    return TRUE;
}
Example #23
0
bool CWizApiBase::callAttachmentPostData(const WIZDOCUMENTATTACHMENTDATAEX& data)
{
    m_currentAttachment = data;

    int nParts = data.nObjectPart;
    Q_ASSERT(0 != nParts);

    QString info = data.strName;
    Q_EMIT processLog(tr("upload attachment info: ") + info);

    CWizApiTokenParam param(*this);

    CWizXmlRpcStructValue* pAttachmentStruct = new CWizXmlRpcStructValue();
    param.AddStruct(_T("attachment"), pAttachmentStruct);

    bool bInfo = (nParts & WIZKM_XMKRPC_ATTACHMENT_PART_INFO) ? true : false;
    bool bData = (nParts & WIZKM_XMKRPC_ATTACHMENT_PART_DATA) ? true : false;

    pAttachmentStruct->AddString(_T("attachment_guid"), data.strGUID);
    pAttachmentStruct->AddBool(_T("attachment_info"), bInfo ? true : false);
    pAttachmentStruct->AddBool(_T("attachment_data"), bData ? true : false);

    bool bDataInfoAdded = false;

    const WIZDOCUMENTATTACHMENTDATAEX& infodata = data;

    if (bInfo)
    {
        pAttachmentStruct->AddString(_T("attachment_document_guid"), infodata.strDocumentGUID);
        pAttachmentStruct->AddString(_T("attachment_name"), infodata.strName);
        pAttachmentStruct->AddString(_T("attachment_url"), infodata.strURL);
        pAttachmentStruct->AddString(_T("attachment_description"), infodata.strDescription);
        pAttachmentStruct->AddTime(_T("dt_info_modified"), infodata.tInfoModified);
        pAttachmentStruct->AddString(_T("info_md5"), infodata.strInfoMD5);
        pAttachmentStruct->AddTime(_T("dt_data_modified"), infodata.tDataModified);
        pAttachmentStruct->AddString(_T("data_md5"), infodata.strDataMD5);

        bDataInfoAdded = true;
    }

    if (bData)
    {
        if (!bDataInfoAdded)
        {
            pAttachmentStruct->AddTime(_T("dt_data_modified"), infodata.tDataModified);
            pAttachmentStruct->AddString(_T("data_md5"), infodata.strDataMD5);
            bDataInfoAdded = true;
        }
        pAttachmentStruct->AddString(_T("attachment_zip_md5"), WizMd5StringNoSpaceJava(infodata.arrayData));
    }

    return callXmlRpc(SyncMethod_PostAttachmentData, &param);
}
Example #24
0
CString CWizXmlRpcFaultValue::GetFaultString() const
{
	CString str;
	m_val.GetString(_T("faultString"), str);
	return str;
}
Example #25
0
bool CWizApiBase::callDocumentPostData(const WIZDOCUMENTDATAEX& data)
{
    m_currentDocument = data;

    int nParts = m_currentDocument.nObjectPart;
    Q_ASSERT(0 != nParts);
    bool bInfo = (nParts & WIZKM_XMKRPC_DOCUMENT_PART_INFO) ? true : false;
    bool bParam = (nParts & WIZKM_XMKRPC_DOCUMENT_PART_PARAM) ? true : false;
    bool bData = (nParts & WIZKM_XMKRPC_DOCUMENT_PART_DATA) ? true : false;

    QString info = data.strTitle;
    Q_EMIT processLog(tr("upload document info:") + info);

    CWizApiTokenParam param(*this);

    CWizXmlRpcStructValue* pDocumentStruct = new CWizXmlRpcStructValue();
    param.AddStruct(_T("document"), pDocumentStruct);

    pDocumentStruct->AddString(_T("document_guid"), data.strGUID);
    pDocumentStruct->AddBool(_T("document_info"), bInfo ? true : false);
    pDocumentStruct->AddBool(_T("document_data"), bData ? true : false);
    pDocumentStruct->AddBool(_T("document_param"), bParam ? true : false);

    bool bParamInfoAdded = false;
    bool bDataInfoAdded = false;

    const WIZDOCUMENTDATAEX& infodata = data; //m_currentDocument;

    if (bInfo)
    {
        pDocumentStruct->AddString(_T("document_title"), infodata.strTitle);
        pDocumentStruct->AddString(_T("document_category"), infodata.strLocation);
        pDocumentStruct->AddString(_T("document_filename"), infodata.strName);
        pDocumentStruct->AddString(_T("document_seo"), infodata.strSEO);
        pDocumentStruct->AddString(_T("document_url"), infodata.strURL);
        pDocumentStruct->AddString(_T("document_author"), infodata.strAuthor);
        pDocumentStruct->AddString(_T("document_keywords"), infodata.strKeywords);
        pDocumentStruct->AddString(_T("document_type"), infodata.strType);
        pDocumentStruct->AddString(_T("document_owner"), infodata.strOwner);
        pDocumentStruct->AddString(_T("document_filetype"), infodata.strFileType);
        pDocumentStruct->AddString(_T("document_styleguid"), infodata.strStyleGUID);
        pDocumentStruct->AddTime(_T("dt_created"), infodata.tCreated);
        pDocumentStruct->AddTime(_T("dt_modified"), infodata.tModified);
        pDocumentStruct->AddTime(_T("dt_accessed"), infodata.tAccessed);
        pDocumentStruct->AddInt(_T("document_iconindex"), infodata.nIconIndex);
        pDocumentStruct->AddInt(_T("document_protected"), infodata.nProtected);
        pDocumentStruct->AddInt(_T("document_readcount"), infodata.nReadCount);
        pDocumentStruct->AddInt(_T("document_attachment_count"), infodata.nAttachmentCount);
        pDocumentStruct->AddTime(_T("dt_info_modified"), infodata.tInfoModified);
        pDocumentStruct->AddString(_T("info_md5"), infodata.strInfoMD5);
        pDocumentStruct->AddTime(_T("dt_data_modified"), infodata.tDataModified);
        pDocumentStruct->AddString(_T("data_md5"), infodata.strDataMD5);
        pDocumentStruct->AddTime(_T("dt_param_modified"), infodata.tParamModified);
        pDocumentStruct->AddString(_T("param_md5"), infodata.strParamMD5);
        pDocumentStruct->AddString(_T("system_tags"), infodata.strSystemTags);
        pDocumentStruct->AddInt(_T("document_share"), infodata.nShareFlags);

        //m_db->GetDocumentTags(infodata.strGUID, infodata.arrayTagGUID);
        pDocumentStruct->AddStringArray(_T("document_tags"), infodata.arrayTagGUID);

        bParamInfoAdded = true;
        bDataInfoAdded = true;
    }

    if (bParam)
    {
        //m_db->GetDocumentParams(infodata.strGUID, infodata.arrayParam);

        if (!bParamInfoAdded)
        {
            pDocumentStruct->AddTime(_T("dt_param_modified"), infodata.tParamModified);
            pDocumentStruct->AddString(_T("param_md5"), infodata.strParamMD5);
            bParamInfoAdded = true;
        }

        pDocumentStruct->AddArray(_T("document_params"), infodata.arrayParam);
    }

    if (bData)
    {
        //if (!m_db->LoadDocumentData(m_currentDocument.strGUID, m_currentDocument.arrayData))
        //{
        //    //skip this document
        //    QString info2 = data.strTitle;
        //    Q_EMIT processErrorLog(tr("Can not load document data: ") + info2);
        //    onUploadObjectDataCompleted(data);
        //    return false;
        //}

        if (!bDataInfoAdded)
        {
            pDocumentStruct->AddTime(_T("dt_data_modified"), infodata.tDataModified);
            pDocumentStruct->AddString(_T("data_md5"), infodata.strDataMD5);
            bDataInfoAdded = true;
        }

        pDocumentStruct->AddString(_T("document_zip_md5"), WizMd5StringNoSpaceJava(infodata.arrayData));
    }

    return callXmlRpc(SyncMethod_PostDocumentData, &param);
}
Example #26
0
int CWizXmlRpcFaultValue::GetFaultCode() const
{
	int nCode = 0;
	m_val.GetInt(_T("faultCode"), nCode);
	return nCode;
}
Example #27
0
BOOL CWizXmlRpcFaultValue::Read(CWizXMLNode& nodeValue)
{
	return m_val.Read(nodeValue);
}
Example #28
0
 CWizKMAttachmentPostDataParam(int nApiVersion, const QString& strToken, const QString& strBookGUID, const QString& strAttachmentGUID, UINT nParts, const WIZDOCUMENTATTACHMENTDATA& infodata, const QString& strObjMd5)
     : CWizKMAttachmentGetDataParam(nApiVersion, strToken, strBookGUID, strAttachmentGUID, nParts)
 {
     CWizXmlRpcStructValue* pAttachmentStruct = new CWizXmlRpcStructValue();
     AddStruct(_T("attachment"), pAttachmentStruct);
     //
     pAttachmentStruct->AddString(_T("attachment_guid"), strAttachmentGUID);
     pAttachmentStruct->AddBool(_T("attachment_info"), (nParts & WIZKM_XMKRPC_ATTACHMENT_PART_INFO) ? TRUE : FALSE);
     pAttachmentStruct->AddBool(_T("attachment_data"), (nParts & WIZKM_XMKRPC_ATTACHMENT_PART_DATA) ? TRUE : FALSE);
     //
     BOOL bInfo = (nParts & WIZKM_XMKRPC_ATTACHMENT_PART_INFO) ? TRUE : FALSE;
     BOOL bData = (nParts & WIZKM_XMKRPC_ATTACHMENT_PART_DATA) ? TRUE : FALSE;
     //
     BOOL bDataInfoAdded = FALSE;
     //
     if (bInfo)
     {
         pAttachmentStruct->AddString(_T("attachment_document_guid"), infodata.strDocumentGUID);
         pAttachmentStruct->AddString(_T("attachment_name"), infodata.strName);
         pAttachmentStruct->AddString(_T("attachment_url"), infodata.strURL);
         pAttachmentStruct->AddString(_T("attachment_description"), infodata.strDescription);
         pAttachmentStruct->AddTime(_T("dt_info_modified"), infodata.tInfoModified);
         pAttachmentStruct->AddString(_T("info_md5"), infodata.strInfoMD5);
         pAttachmentStruct->AddTime(_T("dt_data_modified"), infodata.tDataModified);
         pAttachmentStruct->AddString(_T("data_md5"), infodata.strDataMD5);
         //
         bDataInfoAdded = TRUE;
     }
     if (bData)
     {
         if (!bDataInfoAdded)
         {
             pAttachmentStruct->AddTime(_T("dt_data_modified"), infodata.tDataModified);
             pAttachmentStruct->AddString(_T("data_md5"), infodata.strDataMD5);
             bDataInfoAdded = TRUE;
         }
         pAttachmentStruct->AddString(_T("attachment_zip_md5"), strObjMd5);
     }
 }
Example #29
0
 CWizKMDocumentPostDataParam(int nApiVersion, const QString& strToken, const QString& strBookGUID, const QString& strDocumentGUID, UINT nParts, const WIZDOCUMENTDATA& infodata, const CWizStdStringArray& tags, const std::deque<WIZDOCUMENTPARAMDATA>& params, const QString& strObjMd5)
     : CWizKMDocumentGetDataParam(nApiVersion, strToken, strBookGUID, strDocumentGUID, nParts)
 {
     CWizXmlRpcStructValue* pDocumentStruct = new CWizXmlRpcStructValue();
     AddStruct(_T("document"), pDocumentStruct);
     //
     pDocumentStruct->AddString(_T("document_guid"), strDocumentGUID);
     pDocumentStruct->AddBool(_T("document_info"), (nParts & WIZKM_XMKRPC_DOCUMENT_PART_INFO) ? TRUE : FALSE);
     pDocumentStruct->AddBool(_T("document_data"), (nParts & WIZKM_XMKRPC_DOCUMENT_PART_DATA) ? TRUE : FALSE);
     pDocumentStruct->AddBool(_T("document_param"), (nParts & WIZKM_XMKRPC_DOCUMENT_PART_PARAM) ? TRUE : FALSE);
     //
     BOOL bInfo = (nParts & WIZKM_XMKRPC_DOCUMENT_PART_INFO) ? TRUE : FALSE;
     BOOL bData = (nParts & WIZKM_XMKRPC_DOCUMENT_PART_DATA) ? TRUE : FALSE;
     BOOL bParam = (nParts & WIZKM_XMKRPC_DOCUMENT_PART_PARAM) ? TRUE : FALSE;
     //
     BOOL bParamInfoAdded = FALSE;
     BOOL bDataInfoAdded = FALSE;
     //
     if (bInfo)
     {
         pDocumentStruct->AddString(_T("document_title"), infodata.strTitle);
         pDocumentStruct->AddString(_T("document_category"), infodata.strLocation);
         pDocumentStruct->AddString(_T("document_filename"), infodata.strName);
         pDocumentStruct->AddString(_T("document_seo"), infodata.strSEO);
         pDocumentStruct->AddString(_T("document_url"), infodata.strURL);
         pDocumentStruct->AddString(_T("document_author"), infodata.strAuthor);
         pDocumentStruct->AddString(_T("document_keywords"), infodata.strKeywords);
         pDocumentStruct->AddString(_T("document_type"), infodata.strType);
         pDocumentStruct->AddString(_T("document_owner"), infodata.strOwner);
         pDocumentStruct->AddString(_T("document_filetype"), infodata.strFileType);
         pDocumentStruct->AddString(_T("document_styleguid"), infodata.strStyleGUID);
         pDocumentStruct->AddTime(_T("dt_created"), infodata.tCreated);
         pDocumentStruct->AddTime(_T("dt_modified"), infodata.tModified);
         pDocumentStruct->AddTime(_T("dt_accessed"), infodata.tAccessed);
         pDocumentStruct->AddInt(_T("document_iconindex"), infodata.nIconIndex);
         pDocumentStruct->AddInt(_T("document_protected"), infodata.nProtected);
         pDocumentStruct->AddInt(_T("document_readcount"), infodata.nReadCount);
         pDocumentStruct->AddInt(_T("document_attachment_count"), infodata.nAttachmentCount);
         pDocumentStruct->AddTime(_T("dt_info_modified"), infodata.tInfoModified);
         pDocumentStruct->AddString(_T("info_md5"), infodata.strInfoMD5);
         pDocumentStruct->AddTime(_T("dt_data_modified"), infodata.tDataModified);
         pDocumentStruct->AddString(_T("data_md5"), infodata.strDataMD5);
         pDocumentStruct->AddTime(_T("dt_param_modified"), infodata.tParamModified);
         pDocumentStruct->AddString(_T("param_md5"), infodata.strParamMD5);
         //
         bParamInfoAdded = TRUE;
         bDataInfoAdded = TRUE;
         //
         pDocumentStruct->AddStringArray(_T("document_tags"), tags);
     }
     if (bParam)
     {
         if (!bParamInfoAdded)
         {
             pDocumentStruct->AddTime(_T("dt_param_modified"), infodata.tParamModified);
             pDocumentStruct->AddString(_T("param_md5"), infodata.strParamMD5);
             bParamInfoAdded = TRUE;
         }
         //
         std::deque<WIZDOCUMENTPARAMDATA> arrParams;
         arrParams.assign(params.begin(), params.end());
         pDocumentStruct->AddArray(_T("document_params"), arrParams);
     }
     if (bData)
     {
         if (!bDataInfoAdded)
         {
             pDocumentStruct->AddTime(_T("dt_data_modified"), infodata.tDataModified);
             pDocumentStruct->AddString(_T("data_md5"), infodata.strDataMD5);
             bDataInfoAdded = TRUE;
         }
         //
         pDocumentStruct->AddString(_T("document_zip_md5"), strObjMd5);
     }
 }
Example #30
0
 BOOL LoadFromXmlRpc(CWizXmlRpcStructValue& data)
 {
     BOOL bInfo = FALSE;
     BOOL bData = FALSE;
     BOOL bParam = FALSE;
     data.GetBool(_T("document_info"), bInfo);
     data.GetBool(_T("document_data"), bData);
     data.GetBool(_T("document_param"), bParam);
     data.GetInt64(_T("version"), nVersion);
     //
     nParts = 0;
     nParts |= bInfo ? WIZKM_XMKRPC_DOCUMENT_PART_INFO : 0;
     nParts |= bData ? WIZKM_XMKRPC_DOCUMENT_PART_DATA : 0;
     nParts |= bParam ? WIZKM_XMKRPC_DOCUMENT_PART_PARAM : 0;
     //
     data.GetStr(_T("document_guid"), strGUID);
     //
     if (bInfo)
     {
         data.GetStr(_T("document_title"), strTitle);
         data.GetStr(_T("document_category"), strLocation);
         data.GetStr(_T("document_filename"), strName);
         data.GetStr(_T("document_seo"), strSEO);
         data.GetStr(_T("document_url"), strURL);
         data.GetStr(_T("document_author"), strAuthor);
         data.GetStr(_T("document_keywords"), strKeywords);
         data.GetStr(_T("document_type"), strType);
         data.GetStr(_T("document_owner"), strOwner);
         data.GetStr(_T("document_filetype"), strFileType);
         data.GetStr(_T("document_styleguid"), strStyleGUID);
         data.GetTime(_T("dt_created"), tCreated);
         data.GetTime(_T("dt_modified"), tModified);
         data.GetTime(_T("dt_accessed"), tAccessed);
         data.GetInt(_T("document_iconindex"), nIconIndex);
         data.GetInt(_T("document_protected"), nProtected);
         //data.GetInt(_T("document_readcount"), nReadCount);
         data.GetInt(_T("document_attachment_count"), nAttachmentCount);
         data.GetTime(_T("dt_info_modified"), tInfoModified);
         data.GetStr(_T("info_md5"), strInfoMD5);
         data.GetTime(_T("dt_data_modified"), tDataModified);
         data.GetStr(_T("data_md5"), strDataMD5);
         data.GetTime(_T("dt_param_modified"), tParamModified);
         data.GetStr(_T("param_md5"), strParamMD5);
         //
         data.GetStringArray(_T("document_tags"), arrayTagGUID);
     }
     //
     if (bData)
     {
         data.GetInt(_T("document_zip_size"), nDataSize);
         if (nApiVersion < 2)
         {
             if (!data.GetStream(_T("document_zip_data"), arrayData))
             {
                 TOLOG(_T("Failed to get note data!"));
                 return FALSE;
             }
         }
     }
     //
     if (bParam)
     {
         std::deque<WIZDOCUMENTPARAMDATA> params;
         if (!data.GetArray(_T("document_params"), params))
         {
             TOLOG(_T("Failed to get note param!"));
             return FALSE;
         }
         arrayParam.assign(params.begin(), params.end());
     }
     //
     return !strGUID.isEmpty();
 }