Search in sources :

Example 21 with ValidationResultMutable

use of org.talend.daikon.properties.ValidationResultMutable in project components by Talend.

the class GoogleDriveValidator method validateCreateProperties.

public ValidationResult validateCreateProperties(GoogleDriveCreateProperties properties) {
    ValidationResultMutable vr = new ValidationResultMutable(Result.OK);
    if (StringUtils.isEmpty(properties.parentFolder.getValue())) {
        vr.setStatus(Result.ERROR);
        vr.setMessage(messages.getMessage("error.validation.parentfolder.empty"));
        return vr;
    }
    if (StringUtils.isEmpty(properties.newFolder.getValue())) {
        vr.setStatus(Result.ERROR);
        vr.setMessage(messages.getMessage("error.validation.newfolder.empty"));
        return vr;
    }
    return vr;
}
Also used : ValidationResultMutable(org.talend.daikon.properties.ValidationResultMutable)

Example 22 with ValidationResultMutable

use of org.talend.daikon.properties.ValidationResultMutable in project components by Talend.

the class GoogleDriveConnectionProperties method validateTestConnection.

public ValidationResult validateTestConnection() throws Exception {
    try (SandboxedInstance sandboxedInstance = getSandboxedInstance(SOURCE_OR_SINK_CLASS, true)) {
        GoogleDriveProvideRuntime sos = (GoogleDriveProvideRuntime) sandboxedInstance.getInstance();
        sos.initialize(null, this);
        try {
            ValidationResultMutable vr = new ValidationResultMutable(sos.validateConnection(this));
            if (Result.OK.equals(vr.getStatus())) {
                getForm(FORM_WIZARD).setAllowFinish(true);
            } else {
                getForm(FORM_WIZARD).setAllowFinish(false);
            }
            return vr;
        } catch (Exception e) {
            LOG.error("[validateTestConnection] {}.", e.getMessage());
            return new ValidationResultMutable(Result.ERROR, e.getMessage());
        }
    }
}
Also used : GoogleDriveComponentDefinition.getSandboxedInstance(org.talend.components.google.drive.GoogleDriveComponentDefinition.getSandboxedInstance) SandboxedInstance(org.talend.daikon.sandbox.SandboxedInstance) GoogleDriveProvideRuntime(org.talend.components.google.drive.GoogleDriveProvideRuntime) ValidationResultMutable(org.talend.daikon.properties.ValidationResultMutable)

Example 23 with ValidationResultMutable

use of org.talend.daikon.properties.ValidationResultMutable in project components by Talend.

the class NetSuiteConnectionProperties method validateTestConnection.

public ValidationResult validateTestConnection() throws Exception {
    ValidationResult vr = withRuntime(this, new Function<NetSuiteRuntime, ValidationResult>() {

        @Override
        public ValidationResult apply(NetSuiteRuntime runtimeService) {
            return runtimeService.validateConnection(NetSuiteConnectionProperties.this);
        }
    });
    ValidationResultMutable vrm = new ValidationResultMutable(vr);
    if (vrm.getStatus() == ValidationResult.Result.OK) {
        vrm.setMessage(getI18nMessage("message.connectionSuccessful"));
        getForm(FORM_WIZARD).setAllowForward(true);
    } else {
        getForm(FORM_WIZARD).setAllowForward(false);
    }
    return vrm;
}
Also used : NetSuiteRuntime(org.talend.components.netsuite.NetSuiteRuntime) ValidationResultMutable(org.talend.daikon.properties.ValidationResultMutable) ValidationResult(org.talend.daikon.properties.ValidationResult)

Example 24 with ValidationResultMutable

use of org.talend.daikon.properties.ValidationResultMutable in project components by Talend.

the class MarkLogicSourceOrSink method initialize.

@Override
public ValidationResult initialize(RuntimeContainer container, ComponentProperties properties) {
    ValidationResultMutable vr = new ValidationResultMutable();
    if (properties instanceof MarkLogicProvideConnectionProperties) {
        this.ioProperties = (MarkLogicProvideConnectionProperties) properties;
    } else {
        vr.setStatus(ValidationResult.Result.ERROR);
        vr.setMessage(MESSAGES.getMessage("error.wrongProperties"));
    }
    return vr;
}
Also used : MarkLogicProvideConnectionProperties(org.talend.components.marklogic.MarkLogicProvideConnectionProperties) ValidationResultMutable(org.talend.daikon.properties.ValidationResultMutable)

Example 25 with ValidationResultMutable

use of org.talend.daikon.properties.ValidationResultMutable in project components by Talend.

the class SnowflakeTableProperties method afterTableName.

public ValidationResult afterTableName() throws Exception {
    ValidationResultMutable vr = new ValidationResultMutable();
    try {
        main.schema.setValue(SnowflakeSourceOrSink.getSchema(null, connection, tableName.getValue()));
        tableName.setPossibleValues(Collections.emptyList());
    } catch (Exception ex) {
        vr.setMessage(ex.getMessage());
        vr.setStatus(ValidationResult.Result.ERROR);
    }
    return vr;
}
Also used : ValidationResultMutable(org.talend.daikon.properties.ValidationResultMutable)

Aggregations

ValidationResultMutable (org.talend.daikon.properties.ValidationResultMutable)41 IOException (java.io.IOException)11 SandboxedInstance (org.talend.daikon.sandbox.SandboxedInstance)8 ValidationResult (org.talend.daikon.properties.ValidationResult)7 SQLException (java.sql.SQLException)5 Schema (org.apache.avro.Schema)5 MarketoComponentDefinition.getSandboxedInstance (org.talend.components.marketo.MarketoComponentDefinition.getSandboxedInstance)3 MarketoSourceOrSinkRuntime (org.talend.components.marketo.runtime.MarketoSourceOrSinkRuntime)3 SalesforceDefinition.getSandboxedInstance (org.talend.components.salesforce.SalesforceDefinition.getSandboxedInstance)3 SalesforceRuntimeSourceOrSink (org.talend.components.salesforce.common.SalesforceRuntimeSourceOrSink)3 User (com.google.api.services.drive.model.User)2 File (java.io.File)2 GeneralSecurityException (java.security.GeneralSecurityException)2 Connection (java.sql.Connection)2 MarketoSourceOrSinkSchemaProvider (org.talend.components.marketo.runtime.MarketoSourceOrSinkSchemaProvider)2 TMarketoInputProperties (org.talend.components.marketo.tmarketoinput.TMarketoInputProperties)2 LeadSelector (org.talend.components.marketo.tmarketoinput.TMarketoInputProperties.LeadSelector)2 SalesforceSchemaHelper (org.talend.components.salesforce.schema.SalesforceSchemaHelper)2 NamedThing (org.talend.daikon.NamedThing)2 TalendRuntimeException (org.talend.daikon.exception.TalendRuntimeException)2