Search in sources :

Example 1 with DeveloperAdministration

use of com.mercedesbenz.sechub.developertools.admin.DeveloperAdministration in project sechub by mercedes-benz.

the class GetProjectMockConfigurationAction method execute.

@Override
protected void execute(ActionEvent e) {
    Optional<String> projectId = getUserInput("Please enter projectId to fetch mock configuration", InputCacheIdentifier.PROJECT_ID);
    if (!projectId.isPresent()) {
        return;
    }
    DeveloperAdministration administration = getContext().getAdministration();
    String url = administration.getUrlBuilder().buildGetProjectMockConfiguration(asSecHubId(projectId.get()));
    String json = administration.getRestHelper().getJSON(url);
    getContext().getOutputUI().output(JSONDeveloperHelper.INSTANCE.beatuifyJSON(json));
}
Also used : DeveloperAdministration(com.mercedesbenz.sechub.developertools.admin.DeveloperAdministration)

Example 2 with DeveloperAdministration

use of com.mercedesbenz.sechub.developertools.admin.DeveloperAdministration in project sechub by mercedes-benz.

the class ChangeProjectAccessLevelAction method execute.

@Override
public void execute(ActionEvent e) {
    Optional<String> optProjectId = getUserInput("Please enter project ID/name", InputCacheIdentifier.PROJECT_ID);
    if (!optProjectId.isPresent()) {
        return;
    }
    String projectId = optProjectId.get().toLowerCase().trim();
    DeveloperAdministration administration = getContext().getAdministration();
    ProjectAccessLevel currentAccessLevel = fetchCurrentProjectAccessLevel(projectId, administration);
    ChangeProjectAccessLevelDialogUI dialogUI = new ChangeProjectAccessLevelDialogUI(getContext(), projectId, currentAccessLevel);
    dialogUI.showDialog();
    if (!dialogUI.isOkPressed()) {
        return;
    }
    ProjectAccessLevel wantedAccessLevel = dialogUI.getSelectedValue();
    if (!confirm("Do you really want to change the project access level for project:" + projectId + " to " + wantedAccessLevel + " ?")) {
        return;
    }
    administration.changeProjectAccessLevel(projectId, wantedAccessLevel);
}
Also used : DeveloperAdministration(com.mercedesbenz.sechub.developertools.admin.DeveloperAdministration) ProjectAccessLevel(com.mercedesbenz.sechub.sharedkernel.project.ProjectAccessLevel)

Example 3 with DeveloperAdministration

use of com.mercedesbenz.sechub.developertools.admin.DeveloperAdministration in project sechub by mercedes-benz.

the class LoadJSONAdapterDialogAction method execute.

@Override
protected void execute(ActionEvent e) throws Exception {
    DeveloperAdministration adm = getDialogUI().getContext().getAdministration();
    String url = adm.getUrlBuilder().buildGetMapping(getMappingUI().getMappingId());
    String json = adm.getRestHelper().getJSON(url);
    getMappingUI().setJSON(json);
}
Also used : DeveloperAdministration(com.mercedesbenz.sechub.developertools.admin.DeveloperAdministration)

Example 4 with DeveloperAdministration

use of com.mercedesbenz.sechub.developertools.admin.DeveloperAdministration in project sechub by mercedes-benz.

the class SaveJSONAdapterDialogAction method execute.

@Override
protected void execute(ActionEvent e) throws Exception {
    DeveloperAdministration adm = getDialogUI().getContext().getAdministration();
    String url = adm.getUrlBuilder().buildUpdateMapping(getMappingUI().getMappingId());
    String json = getMappingUI().getJSON();
    // just check json correct
    MappingData data = MappingData.fromString(json);
    int size = data.getEntries().size();
    boolean confirmed = getDialogUI().getContext().getDialogUI().confirm("Do you really want to upload?\n\n" + size + " entries will be set!");
    if (!confirmed) {
        getDialogUI().getContext().getOutputUI().output(getClass().getSimpleName() + ":Canceled by user");
        return;
    }
    adm.getRestHelper().putJSON(url, json);
    getDialogUI().getContext().getOutputUI().output("Updated mapping:" + getMappingUI().getMappingId());
}
Also used : DeveloperAdministration(com.mercedesbenz.sechub.developertools.admin.DeveloperAdministration) MappingData(com.mercedesbenz.sechub.sharedkernel.mapping.MappingData)

Example 5 with DeveloperAdministration

use of com.mercedesbenz.sechub.developertools.admin.DeveloperAdministration in project sechub by mercedes-benz.

the class DeveloperAdministrationUI method start.

private void start(String[] args) {
    administration = new DeveloperAdministration(this, this, this);
    useNimbusLookAndFeel();
    String env = ConfigurationSetup.SECHUB_ADMIN_ENVIRONMENT.getStringValueOrFail();
    frame = new JFrame(env + " - SecHub");
    ImageIcon imageIcon = new ImageIcon(DeveloperAdministrationUI.class.getClassLoader().getResource("sechub-logo.png"));
    Image image = imageIcon.getImage();
    frame.setIconImage(image);
    Container contentPane = frame.getContentPane();
    credentialUI = new CredentialUI(this);
    outputPanelUI = new OutputUI();
    commandPanelUI = new CommandUI(this);
    glassPaneUI = new GlassPaneUI(this, frame);
    dialogUI = new DialogUI(frame);
    pdsConfigurationUI = new PDSConfigurationUI(this);
    contentPane.add(outputPanelUI.getPanel(), BorderLayout.CENTER);
    JPanel northPanel = new JPanel(new BorderLayout());
    contentPane.add(northPanel, BorderLayout.NORTH);
    contentPane.add(commandPanelUI.getPanel(), BorderLayout.SOUTH);
    northPanel.add(credentialUI.getPanel(), BorderLayout.NORTH);
    northPanel.add(commandPanelUI.getToolBar(), BorderLayout.SOUTH);
    frame.setJMenuBar(commandPanelUI.getMenuBar());
    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    // centered...
    frame.setLocationRelativeTo(null);
    frame.setSize(1024, 768);
    frame.setVisible(true);
}
Also used : ImageIcon(javax.swing.ImageIcon) JPanel(javax.swing.JPanel) Image(java.awt.Image) Container(java.awt.Container) BorderLayout(java.awt.BorderLayout) JFrame(javax.swing.JFrame) DeveloperAdministration(com.mercedesbenz.sechub.developertools.admin.DeveloperAdministration)

Aggregations

DeveloperAdministration (com.mercedesbenz.sechub.developertools.admin.DeveloperAdministration)8 TestExecutionProfile (com.mercedesbenz.sechub.test.executionprofile.TestExecutionProfile)2 MappingData (com.mercedesbenz.sechub.sharedkernel.mapping.MappingData)1 ProjectAccessLevel (com.mercedesbenz.sechub.sharedkernel.project.ProjectAccessLevel)1 TestExecutionProfileList (com.mercedesbenz.sechub.test.executionprofile.TestExecutionProfileList)1 TestExecutionProfileListEntry (com.mercedesbenz.sechub.test.executionprofile.TestExecutionProfileListEntry)1 TestExecutorConfig (com.mercedesbenz.sechub.test.executorconfig.TestExecutorConfig)1 BorderLayout (java.awt.BorderLayout)1 Container (java.awt.Container)1 Image (java.awt.Image)1 ImageIcon (javax.swing.ImageIcon)1 JFrame (javax.swing.JFrame)1 JPanel (javax.swing.JPanel)1