use of com.evolveum.midpoint.studio.impl.MidPointSettings in project midpoint-studio by Evolveum.
the class FileUtils method createFile.
public static <O extends ObjectType> VirtualFile createFile(Project project, Environment env, Class<O> objectType, String oid, String objectName, boolean overwrite) throws IOException {
Map<String, String> params = new HashMap<>();
// environment short name
params.put("s", env.getShortName());
// environment name
params.put("e", env.getName());
MidPointService mm = MidPointService.getInstance(project);
MidPointSettings settings = mm.getSettings();
return createFile(project, params, objectType, oid, objectName, settings.getDowloadFilePattern(), null, overwrite);
}
use of com.evolveum.midpoint.studio.impl.MidPointSettings in project midpoint-studio by Evolveum.
the class DownloadSelectedTypesTask method doRun.
@Override
protected void doRun(ProgressIndicator indicator) {
super.doRun(indicator);
MidPointSettings settings = midPointService.getSettings();
if (settings.getTypesToDownloadLimit() == 0 && settings.getDownloadTypesInclude().isEmpty() && settings.getDownloadTypesExclude().isEmpty()) {
// probably
MidPointSettings defaults = MidPointSettings.createDefaultSettings();
settings.setDownloadTypesInclude(defaults.getDownloadTypesInclude());
settings.setDownloadTypesExclude(defaults.getDownloadTypesExclude());
settings.setTypesToDownloadLimit(defaults.getTypesToDownloadLimit());
midPointService.settingsUpdated();
}
if (settings.getTypesToDownloadLimit() <= 0) {
MidPointUtils.publishNotification(getProject(), NOTIFICATION_KEY, "Download Selected Types", "Download limit set to zero. Done.", NotificationType.WARNING);
return;
}
Environment environment = getEnvironment();
PrismContext ctx = ServiceFactory.DEFAULT_PRISM_CONTEXT;
QueryFactory qf = ctx.queryFactory();
ObjectPaging paging = qf.createPaging(0, settings.getTypesToDownloadLimit(), ctx.path(ObjectType.F_NAME), OrderDirection.ASCENDING);
ObjectQuery query = qf.createQuery(null, paging);
List<ObjectTypes> typesToDownload = determineTypesToDownload(settings);
for (ObjectTypes type : typesToDownload) {
try {
DownloadTask dt = new DownloadTask(event, null, type, query, false, false, true);
dt.setEnvironment(environment);
dt.setOpenAfterDownload(false);
dt.download(indicator);
} catch (Exception ex) {
midPointService.printToConsole(environment, getClass(), "Couldn't download objects of type '" + type.getValue() + "'. Reason: " + ex.getMessage());
}
}
}
use of com.evolveum.midpoint.studio.impl.MidPointSettings in project midpoint-studio by Evolveum.
the class MidPointSettingsPanel method getSettings.
public MidPointSettings getSettings() {
MidPointSettings settings = MidPointSettings.createDefaultSettings();
// we don't want to replace projectId with random id
settings.setProjectId(this.settings.getProjectId());
settings.setDowloadFilePattern(downloadPattern.getText());
settings.setGeneratedFilePattern(generatedPattern.getText());
settings.setPrintRestCommunicationToConsole(logRestCommunication.isSelected());
if (StringUtils.isNumeric(restClientTimeout.getText())) {
settings.setRestResponseTimeout(Integer.parseInt(restClientTimeout.getText()));
}
ObjectTypesConverter converter = new ObjectTypesConverter();
settings.setDownloadTypesInclude(converter.fromString(typesIncluded.getText()));
settings.setDownloadTypesExclude(converter.fromString(typesExcluded.getText()));
settings.setTypesToDownloadLimit(Integer.parseInt(typesDownloadLimit.getText()));
return settings;
}
use of com.evolveum.midpoint.studio.impl.MidPointSettings in project midpoint-studio by Evolveum.
the class DocumentationAction method actionPerformed.
@Override
public void actionPerformed(@NotNull AnActionEvent evt) {
MidPointService mm = MidPointService.getInstance(evt.getProject());
MidPointSettings settings = mm.getSettings();
DocGeneratorOptions opts = settings.getDocGeneratorOptions();
if (opts == null) {
opts = DocGeneratorOptions.createDefaultOptions(evt.getProject());
}
DocumentationDialog dialog = new DocumentationDialog(evt.getProject(), opts);
if (!dialog.showAndGet()) {
return;
}
opts = dialog.getOptions();
settings.setDocGeneratorOptions(opts);
mm.settingsUpdated();
GenerateOptions options = DocGeneratorOptions.buildGenerateOptions(opts);
File exportOutput = opts.getExportOutput();
File adocOutput = new File(exportOutput.getParent(), exportOutput.getName() + ".adoc");
options.setAdocOutput(adocOutput);
this.options = options;
super.actionPerformed(evt);
}
use of com.evolveum.midpoint.studio.impl.MidPointSettings in project midpoint-studio by Evolveum.
the class FileUtils method createScratchFile.
public static VirtualFile createScratchFile(Project project, Environment env, String fileNamePrefix) throws IOException {
Map<String, String> params = new HashMap<>();
// environment short name
params.put("s", env.getShortName());
// environment name
params.put("e", env.getName());
MidPointService mm = MidPointService.getInstance(project);
MidPointSettings settings = mm.getSettings();
return createFile(project, params, null, null, null, settings.getGeneratedFilePattern(), fileNamePrefix, false);
}
Aggregations