use of com.evolveum.midpoint.studio.client.SearchResult in project midpoint-studio by Evolveum.
the class ConnectorXmlSchemaCacheService method refresh.
private void refresh(Environment env) {
LOG.info("Invoking refresh");
RunnableUtils.submitNonBlockingReadAction(() -> {
LOG.info("Refreshing");
cache.clear();
if (env == null) {
LOG.info("Refresh skipped, no environment selected");
return;
}
MidPointClient client = new MidPointClient(project, env, true, true);
SearchResult result = client.search(ConnectorType.class, null, true);
for (MidPointObject object : result.getObjects()) {
try {
PrismObject<?> prismObject = client.parseObject(object.getContent());
ConnectorType connectorType = (ConnectorType) prismObject.asObjectable();
cache.put(connectorType, new CacheValue(connectorType, buildIcfSchema(object), buildConnectorSchema(object)));
} catch (Exception ex) {
if (ex instanceof ProcessCanceledException) {
throw (ProcessCanceledException) ex;
}
LOG.error("Couldn't parse connector object", ex);
}
}
LOG.info("Refresh finished, " + cache.size() + " objects in cache");
}, AppExecutorUtil.getAppExecutorService());
LOG.info("Invoke done");
}
use of com.evolveum.midpoint.studio.client.SearchResult in project midpoint-studio by Evolveum.
the class DownloadTask method downloadByQuery.
private void downloadByQuery() {
List<VirtualFile> files = new ArrayList<>();
try {
SearchResult result = client.search(type.getClassDefinition(), query, raw);
if (result == null || result.getObjects() == null) {
return;
}
LOG.debug("Storing file");
RunnableUtils.runWriteActionAndWait(() -> {
for (MidPointObject obj : result.getObjects()) {
VirtualFile file = saveFile(obj);
if (file != null) {
files.add(file);
}
}
});
LOG.debug("Files saved");
} catch (Exception ex) {
MidPointUtils.publishExceptionNotification(getProject(), getEnvironment(), DownloadTask.class, NOTIFICATION_KEY, "Exception occurred when searching for " + type.getValue(), ex);
}
if (!files.isEmpty() && openAfterDownload) {
ApplicationManager.getApplication().invokeAndWait(() -> MidPointUtils.openFile(getProject(), files.get(0)));
}
}
Aggregations