-
Notifications
You must be signed in to change notification settings - Fork 1
/
Pipelines.cpp
65 lines (51 loc) · 1.69 KB
/
Pipelines.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include "Pipelines.h"
#include "Config.h"
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include "rapidjson/document.h"
#include "rapidjson/writer.h"
#include "rapidjson/stringbuffer.h"
Pipelines::Pipelines(Config *pconfig):CurlProcess(pconfig){
this->m_pPipelines = NULL;
m_pconfig = pconfig;
}
Pipelines::Pipelines(Pipelines& pipelines, Config *pconfig):CurlProcess(pconfig){
this->m_pPipelines = NULL;
m_pconfig = pconfig;
}
bool Pipelines::request(struct soap *soap, const char * study_name){
char routeBuf[m_pconfig->URL_MAX_LEN];
snprintf(routeBuf, sizeof(routeBuf), "%s/studies/%s/pipelines",
m_pconfig->CATIWEB_WEBSERVICE_API.c_str(), study_name);
std::cout << "pipelie route:" << routeBuf << std::endl;
if(!CurlProcess::request(soap, routeBuf))
{
return false;
}
if (m_pconfig->VERBOSE == 1L)
{
std::cout << this->m_resBuf << std::endl;
}
if(!CurlProcess::parse_reponse_by_json())
{
return false;
}
if (this->m_pPipelines==NULL)
{
this->m_pPipelines = soap_new_std__vectorTemplateOfPointerToapi__ArrayOfPipelines(soap, 1);
}else{
this->m_pPipelines->clear();
}
api__ArrayOfPipelines* api__ArrayOfPipelines_ = soap_new_api__ArrayOfPipelines(soap, 1);
this->m_pPipelines->push_back(api__ArrayOfPipelines_);
for(rapidjson::SizeType i = 0; i < m_document.Size(); i++)
{
api__Pipeline * api__Pipeline_ = soap_new_api__Pipeline(soap, 1);
const rapidjson::Value & pipeline_value = m_document[i];
api__Pipeline_->identifier = pipeline_value["identifier"].GetString();
api__Pipeline_->name = pipeline_value["name"].GetString();
(*this->m_pPipelines)[0]->item.push_back(api__Pipeline_);
}
return true;
}