Search in sources :

Example 1 with ErrorMessage

use of org.codice.ddf.admin.common.report.message.ErrorMessage in project admin-console-beta by connexta.

the class InstallEmbeddedLdap method performFunction.

@Override
public BooleanField performFunction() {
    // TODO: tbatie - 4/4/17 - This should return back the setup config
    Configurator configurator = configuratorFactory.getConfigurator();
    switch(useCase.getValue()) {
        case LOGIN:
            configurator.startFeature(EMBEDDED_LDAP_FEATURE);
            configurator.startFeature(LDAP_LOGIN_FEATURE);
            configurator.startFeature(DEFAULT_EMBEDDED_LDAP_LOGIN_CONFIG_FEATURE);
            break;
        case ATTRIBUTE_STORE:
            configurator.startFeature(EMBEDDED_LDAP_FEATURE);
            configurator.startFeature(LDAP_CLAIMS_HANDLER_FEATURE);
            configurator.startFeature(DEFAULT_EMBEDDED_LDAP_CLAIMS_HANDLER_CONFIG_FEATURE);
            break;
        case LOGIN_AND_ATTRIBUTE_STORE:
            configurator.startFeature(EMBEDDED_LDAP_FEATURE);
            configurator.startFeature(LDAP_LOGIN_FEATURE);
            configurator.startFeature(LDAP_CLAIMS_HANDLER_FEATURE);
            configurator.startFeature(ALL_DEFAULT_EMBEDDED_LDAP_CONFIG_FEATURE);
            break;
        default:
            LOGGER.debug("Unrecognized LDAP use case \"{}\". No commits will be made. ", useCase.getValue());
            // TODO: tbatie - 4/4/17 - change this to specify the arg that was unknown
            addResultMessage(new ErrorMessage("FAILED_PERSIST"));
            return new BooleanField(false);
    }
    OperationReport report = configurator.commit();
    if (report.containsFailedResults()) {
        addResultMessage(new ErrorMessage("CANNOT_INSTALL"));
        return new BooleanField(false);
    }
    return new BooleanField(true);
}
Also used : BooleanField(org.codice.ddf.admin.common.fields.base.scalar.BooleanField) Configurator(org.codice.ddf.admin.configurator.Configurator) OperationReport(org.codice.ddf.admin.configurator.OperationReport) ErrorMessage(org.codice.ddf.admin.common.report.message.ErrorMessage)

Aggregations

BooleanField (org.codice.ddf.admin.common.fields.base.scalar.BooleanField)1 ErrorMessage (org.codice.ddf.admin.common.report.message.ErrorMessage)1 Configurator (org.codice.ddf.admin.configurator.Configurator)1 OperationReport (org.codice.ddf.admin.configurator.OperationReport)1