use of com.evolveum.midpoint.studio.impl.Environment in project midpoint-studio by Evolveum.
the class OperationResultDialog method saveResult.
private void saveResult(final Project project, ProgressIndicator indicator, final VirtualFileWrapper fileWrapper, OperationResult result) {
MidPointService mm = MidPointService.getInstance(project);
EnvironmentService em = EnvironmentService.getInstance(project);
Environment environment = em.getSelected();
RunnableUtils.runWriteActionAndWait(() -> {
File file = fileWrapper.getFile();
try {
if (file.exists()) {
file.delete();
}
file.createNewFile();
} catch (IOException ex) {
mm.printToConsole(environment, OperationResultDialog.class, "Couldn't create file " + file.getPath() + " for operation result", ex);
}
VirtualFile vFile = fileWrapper.getVirtualFile();
try (BufferedWriter out = new BufferedWriter(new OutputStreamWriter(vFile.getOutputStream(this), vFile.getCharset()))) {
MidPointClient client = new MidPointClient(project, environment);
PrismContext ctx = client.getPrismContext();
PrismSerializer<String> serializer = ctx.serializerFor(PrismContext.LANG_XML);
String xml = serializer.serializeAnyData(result.createOperationResultType(), SchemaConstantsGenerated.C_OPERATION_RESULT);
IOUtils.write(xml, out);
} catch (IOException | SchemaException ex) {
mm.printToConsole(environment, OperationResultDialog.class, "Couldn't create file " + file.getPath() + " for operation result", ex);
}
});
}
use of com.evolveum.midpoint.studio.impl.Environment in project midpoint-studio by Evolveum.
the class EncryptedPropertyEditorDialog method fillInFields.
private void fillInFields() {
List<Environment> list = new ArrayList<>();
list.add(null);
list.addAll(environments);
ComboBoxModel model = new ListComboBoxModel(list);
environment.setModel(model);
key.setText(property.getKey());
if (property.getEnvironment() != null) {
Environment env = null;
for (Environment e : environments) {
if (Objects.equals(e.getId(), property.getEnvironment())) {
env = e;
}
}
environment.setSelectedItem(env);
}
password.setText(property.getValue());
description.setText(property.getDescription());
}
use of com.evolveum.midpoint.studio.impl.Environment in project midpoint-studio by Evolveum.
the class EnvironmentEditorDialog method populateBean.
private void populateBean() {
selectable.setSelected(selected.isSelected());
Environment environment = selectable.getObject();
populateEnvironment(environment);
}
use of com.evolveum.midpoint.studio.impl.Environment in project midpoint-studio by Evolveum.
the class EnvironmentEditorDialog method executeTestConnection.
private void executeTestConnection(Project project, JLabel testConnection) {
Environment env = new Environment();
populateEnvironment(env);
try {
MidPointClient client = new MidPointClient(project, env, settings);
TestConnectionResult result = client.testConnection();
if (result.success()) {
updateInAwtThread(ConsoleViewContentType.NORMAL_OUTPUT_KEY.getDefaultAttributes().getForegroundColor(), "Version: " + result.version() + ", revision: " + result.revision());
} else {
String msg = result.exception() != null ? result.exception().getMessage() : null;
updateInAwtThread(ConsoleViewContentType.LOG_ERROR_OUTPUT_KEY.getDefaultAttributes().getForegroundColor(), msg);
}
} catch (Exception ex) {
LOG.error("Couldn't test connection", ex);
updateInAwtThread(ConsoleViewContentType.LOG_ERROR_OUTPUT_KEY.getDefaultAttributes().getForegroundColor(), ex.getMessage());
}
}
use of com.evolveum.midpoint.studio.impl.Environment in project midpoint-studio by Evolveum.
the class EnvironmentsPanel method initData.
private void initData() {
List<Selectable<Environment>> selectables = new ArrayList<>();
Environment selected = environmentSettings.getSelected();
environmentSettings.getEnvironments().forEach(e -> {
Selectable s = new Selectable(new Environment(e));
if (selected != null) {
s.setSelected(Objects.equals(e.getId(), selected.getId()));
}
selectables.add(s);
});
setData(selectables);
}
Aggregations