MCPcopy Create free account
hub / github.com/NatLabRockies/OpenStudio / checkForComponentUpdates

Method checkForComponentUpdates

src/utilities/bcl/RemoteBCL.cpp:197–236  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

195}
196
197int 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
238int RemoteBCL::checkForMeasureUpdates() {
239 m_measuresWithUpdates.clear();

Callers

nothing calls this directly

Calls 9

requestMethod · 0.80
to_stringMethod · 0.80
clearMethod · 0.45
componentsMethod · 0.45
uidMethod · 0.45
emptyMethod · 0.45
versionIdMethod · 0.45
push_backMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected