use of com.evolveum.midpoint.studio.impl.EnvironmentService in project midpoint-studio by Evolveum.
the class ExpanderTest method testMid7781Variants.
private void testMid7781Variants(String keyToExpand) throws IOException {
Project project = getProject();
EnvironmentService es = EnvironmentService.getInstance(project);
Expander expander = new Expander(es.getSelected(), null, project);
PsiFile psiFile = myFixture.configureByFile("mid-7781/functionalLibraries/lib.xml");
VirtualFile file = psiFile.getVirtualFile();
myFixture.configureByFile("mid-7781/include/email/sample.html");
String expected = FileUtils.readFileToString(new File("./src/test/testData/expander/mid-7781/include/email/sample.html"), StandardCharsets.UTF_8);
String value = expander.expand(keyToExpand, file);
assertEquals(expected, value);
}
use of com.evolveum.midpoint.studio.impl.EnvironmentService in project midpoint-studio by Evolveum.
the class MidPointToolWindowFactory method buildEncryptedProperties.
private Content buildEncryptedProperties(Project project) {
JPanel root = new JPanel(new BorderLayout());
EnvironmentService environmentManager = EnvironmentService.getInstance(project);
EncryptedPropertiesPanel propertiesPanel = new EncryptedPropertiesPanel(project, environmentManager);
root.add(propertiesPanel, BorderLayout.CENTER);
ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar("EncryptedPropertiesActions", new DefaultActionGroup(propertiesPanel.createConsoleActions()), false);
toolbar.setTargetComponent(root);
root.add(toolbar.getComponent(), BorderLayout.WEST);
return ContentFactory.SERVICE.getInstance().createContent(root, "Encrypted Properties", false);
}
use of com.evolveum.midpoint.studio.impl.EnvironmentService in project midpoint-studio by Evolveum.
the class SetModuleLoggingGroupAction method update.
@Override
public void update(@NotNull AnActionEvent evt) {
super.update(evt);
if (evt.getProject() == null) {
return;
}
boolean hasFacet = MidPointUtils.hasMidPointFacet(evt.getProject());
if (!hasFacet) {
evt.getPresentation().setVisible(false);
return;
}
EnvironmentService em = EnvironmentService.getInstance(evt.getProject());
evt.getPresentation().setEnabled(em.getSelected() != null);
}
use of com.evolveum.midpoint.studio.impl.EnvironmentService in project midpoint-studio by Evolveum.
the class BrowseToolPanel method searchPerformed.
private void searchPerformed(AnActionEvent evt, ProgressIndicator indicator) {
LOG.debug("Clearing table");
// clear result table
updateTableModel(null);
// load data
EnvironmentService em = EnvironmentService.getInstance(evt.getProject());
Environment env = em.getSelected();
indicator.setText("Searching objects in environment: " + env.getName());
SearchResultList result = null;
try {
LOG.debug("Setting up midpoint client");
MidPointClient client = new MidPointClient(evt.getProject(), env);
ObjectTypes type = objectType.getSelected();
ObjectQuery query = buildQuery(client);
LOG.debug("Starting search");
result = client.list(type.getClassDefinition(), query, rawSearch);
} catch (Exception ex) {
handleGenericException(env, "Couldn't search objects", ex);
}
LOG.debug("Updating table");
// update result table
updateTableModel(result);
}
use of com.evolveum.midpoint.studio.impl.EnvironmentService in project midpoint-studio by Evolveum.
the class BrowseToolPanel method processPerformed.
private void processPerformed(AnActionEvent evt) {
String query = this.query.getText();
ComboQueryType.Type queryType = this.queryType.getSelected();
ObjectTypes type = this.objectType.getSelected();
List<ObjectType> selected = getResultsModel().getSelectedObjects(results);
if (ComboQueryType.Type.QUERY_XML != queryType && StringUtils.isNotEmpty(query)) {
// translate query
EnvironmentService em = EnvironmentService.getInstance(evt.getProject());
Environment env = em.getSelected();
try {
LOG.debug("Setting up midpoint client");
MidPointClient client = new MidPointClient(evt.getProject(), env);
LOG.debug("Translating object query");
ObjectQuery objectQuery = buildQuery(client);
ObjectPaging paging = objectQuery.getPaging();
if (paging != null) {
// cleanup ordering, not necessary for bulk processing
paging.setOrdering(new ObjectOrdering[0]);
}
PrismContext ctx = client.getPrismContext();
QueryConverter converter = ctx.getQueryConverter();
QueryType q = converter.createQueryType(objectQuery);
RunnableUtils.PluginClassCallable<String> callable = new RunnableUtils.PluginClassCallable<>() {
@Override
public String callWithPluginClassLoader() throws Exception {
return ctx.serializerFor(PrismContext.LANG_XML).serializeRealValue(q);
}
};
query = callable.call();
} catch (Exception ex) {
handleGenericException(env, "Couldn't serialize query", ex);
}
}
ProcessResultsDialog dialog = new ProcessResultsDialog(processResultsOptions, query, type, selected);
dialog.show();
if (dialog.isOK() || dialog.isGenerate()) {
processResultsOptions = dialog.buildOptions();
performGenerate(evt, selected, processResultsOptions, !dialog.isGenerate());
}
}
Aggregations