Search in sources :

Example 6 with OperationReport

use of org.codice.ddf.admin.configurator.OperationReport in project admin-console-beta by connexta.

the class ServiceCommons method updateService.

public static ReportImpl updateService(PidField servicePid, Map<String, Object> newConfig, ConfiguratorFactory configuratorFactory) {
    ReportImpl report = new ReportImpl();
    report.addMessages(serviceConfigurationExists(servicePid, configuratorFactory));
    if (report.containsErrorMsgs()) {
        return report;
    }
    String pid = servicePid.getValue();
    Configurator configurator = configuratorFactory.getConfigurator();
    configurator.updateConfigFile(pid, newConfig, true);
    OperationReport operationReport = configurator.commit("Updated config with pid [{}] and new service properties [{}]", pid, newConfig.toString());
    if (operationReport.containsFailedResults()) {
        return report.addResultMessage(failedUpdateError());
    }
    return report;
}
Also used : Configurator(org.codice.ddf.admin.configurator.Configurator) OperationReport(org.codice.ddf.admin.configurator.OperationReport) ReportImpl(org.codice.ddf.admin.common.report.ReportImpl)

Aggregations

Configurator (org.codice.ddf.admin.configurator.Configurator)6 OperationReport (org.codice.ddf.admin.configurator.OperationReport)6 PolicyManagerServiceProperties (org.codice.ddf.admin.security.common.services.PolicyManagerServiceProperties)2 Path (java.nio.file.Path)1 BooleanField (org.codice.ddf.admin.common.fields.base.scalar.BooleanField)1 ReportImpl (org.codice.ddf.admin.common.report.ReportImpl)1 ErrorMessage (org.codice.ddf.admin.common.report.message.ErrorMessage)1