| 328 | |
| 329 | |
| 330 | bool WorkflowMachine::ClearOverride(const string& activity) |
| 331 | { |
| 332 | rapidjson::Document request(rapidjson::kObjectType); |
| 333 | rapidjson::Document::AllocatorType& allocator = request.GetAllocator(); |
| 334 | request.AddMember("command", "override", allocator); |
| 335 | request.AddMember("action", "clear", allocator); |
| 336 | request.AddMember("activity", activity, allocator); |
| 337 | rapidjson::StringBuffer buffer; |
| 338 | rapidjson::Writer<rapidjson::StringBuffer> writer(buffer); |
| 339 | request.Accept(writer); |
| 340 | |
| 341 | string jsonResult; |
| 342 | if (m_function) |
| 343 | jsonResult = BNPostWorkflowRequestForFunction(m_function->GetObject(), buffer.GetString()); |
| 344 | else |
| 345 | jsonResult = BNPostWorkflowRequestForBinaryView(m_view->GetObject(), buffer.GetString()); |
| 346 | |
| 347 | rapidjson::Document response(rapidjson::kObjectType); |
| 348 | response.Parse(jsonResult.c_str()); |
| 349 | if (response.HasMember("commandStatus") && response["commandStatus"].HasMember("accepted")) |
| 350 | return response["commandStatus"]["accepted"].GetBool(); |
| 351 | |
| 352 | return false; |
| 353 | } |
| 354 | |
| 355 | |
| 356 | Workflow::Workflow(const string& name) |