| 195 | } |
| 196 | |
| 197 | int RemoteBCL::checkForComponentUpdates() { |
| 198 | m_componentsWithUpdates.clear(); |
| 199 | |
| 200 | for (const BCLComponent& component : LocalBCL::instance().components()) { |
| 201 | // can't start another request until last one is done |
| 202 | if (m_httpResponse && !m_httpResponse->is_done()) { |
| 203 | return 0; |
| 204 | } |
| 205 | |
| 206 | m_lastSearch.clear(); |
| 207 | |
| 208 | auto client = getClient(remoteUrl(), m_timeOutSeconds); |
| 209 | web::uri_builder builder(to_string_t("/api/search/")); |
| 210 | |
| 211 | builder.append_path(to_string_t("*.xml")); |
| 212 | |
| 213 | builder.append_query(to_string_t("fq[]"), to_string_t("ss_uuid:" + component.uid())); |
| 214 | |
| 215 | builder.append_query(to_string_t("api_version"), to_string_t(m_apiVersion)); |
| 216 | |
| 217 | // LOG(Debug, m_remoteUrl << builder.to_string()); |
| 218 | |
| 219 | m_httpResponse = client.request(web::http::methods::GET, builder.to_string()) |
| 220 | .then([](web::http::http_response resp) { return resp.extract_utf8string(); }) |
| 221 | .then([this](const std::string& xml) { |
| 222 | auto remoteQueryResponse = processReply(xml); |
| 223 | |
| 224 | if (remoteQueryResponse) { |
| 225 | m_lastSearch = processSearchResponse(*remoteQueryResponse); |
| 226 | } |
| 227 | }); |
| 228 | |
| 229 | std::vector<BCLSearchResult> result = waitForSearch(); |
| 230 | if (!result.empty() && result[0].versionId() != component.versionId()) { |
| 231 | m_componentsWithUpdates.push_back(result[0]); |
| 232 | } |
| 233 | } |
| 234 | |
| 235 | return m_componentsWithUpdates.size(); |
| 236 | } |
| 237 | |
| 238 | int RemoteBCL::checkForMeasureUpdates() { |
| 239 | m_measuresWithUpdates.clear(); |