Search in sources :

Example 6 with EnvironmentService

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);
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) Project(com.intellij.openapi.project.Project) Expander(com.evolveum.midpoint.studio.impl.Expander) EnvironmentService(com.evolveum.midpoint.studio.impl.EnvironmentService) PsiFile(com.intellij.psi.PsiFile) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File) PsiFile(com.intellij.psi.PsiFile)

Example 7 with EnvironmentService

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);
}
Also used : EnvironmentService(com.evolveum.midpoint.studio.impl.EnvironmentService) ActionToolbar(com.intellij.openapi.actionSystem.ActionToolbar) DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup)

Example 8 with EnvironmentService

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);
}
Also used : EnvironmentService(com.evolveum.midpoint.studio.impl.EnvironmentService)

Example 9 with EnvironmentService

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);
}
Also used : SearchResultList(com.evolveum.midpoint.schema.SearchResultList) MidPointClient(com.evolveum.midpoint.studio.impl.MidPointClient) Environment(com.evolveum.midpoint.studio.impl.Environment) EnvironmentService(com.evolveum.midpoint.studio.impl.EnvironmentService) ComboObjectTypes(com.evolveum.midpoint.studio.action.browse.ComboObjectTypes) ObjectTypes(com.evolveum.midpoint.schema.constants.ObjectTypes) SchemaException(com.evolveum.midpoint.util.exception.SchemaException) IOException(java.io.IOException)

Example 10 with EnvironmentService

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());
    }
}
Also used : PrismContext(com.evolveum.midpoint.prism.PrismContext) ComboObjectTypes(com.evolveum.midpoint.studio.action.browse.ComboObjectTypes) ObjectTypes(com.evolveum.midpoint.schema.constants.ObjectTypes) SchemaException(com.evolveum.midpoint.util.exception.SchemaException) IOException(java.io.IOException) RunnableUtils(com.evolveum.midpoint.studio.util.RunnableUtils) ObjectType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType) MidPointClient(com.evolveum.midpoint.studio.impl.MidPointClient) ComboQueryType(com.evolveum.midpoint.studio.action.browse.ComboQueryType) Environment(com.evolveum.midpoint.studio.impl.Environment) EnvironmentService(com.evolveum.midpoint.studio.impl.EnvironmentService) ComboQueryType(com.evolveum.midpoint.studio.action.browse.ComboQueryType) QueryType(com.evolveum.prism.xml.ns._public.query_3.QueryType)

Aggregations

EnvironmentService (com.evolveum.midpoint.studio.impl.EnvironmentService)19 Environment (com.evolveum.midpoint.studio.impl.Environment)12 Project (com.intellij.openapi.project.Project)6 VirtualFile (com.intellij.openapi.vfs.VirtualFile)5 MidPointClient (com.evolveum.midpoint.studio.impl.MidPointClient)4 MidPointService (com.evolveum.midpoint.studio.impl.MidPointService)3 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)3 File (java.io.File)3 IOException (java.io.IOException)3 PrismContext (com.evolveum.midpoint.prism.PrismContext)2 ObjectTypes (com.evolveum.midpoint.schema.constants.ObjectTypes)2 ComboObjectTypes (com.evolveum.midpoint.studio.action.browse.ComboObjectTypes)2 Expander (com.evolveum.midpoint.studio.impl.Expander)2 RunnableUtils (com.evolveum.midpoint.studio.util.RunnableUtils)2 PsiFile (com.intellij.psi.PsiFile)2 NotNull (org.jetbrains.annotations.NotNull)2 PrismPropertyDefinition (com.evolveum.midpoint.prism.PrismPropertyDefinition)1 SearchResultList (com.evolveum.midpoint.schema.SearchResultList)1 ComboQueryType (com.evolveum.midpoint.studio.action.browse.ComboQueryType)1 EncryptionService (com.evolveum.midpoint.studio.impl.EncryptionService)1