Search in sources :

Example 1 with ValidationResultMutable

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

the class SnowflakeConnectionProperties method validateTestConnection.

public ValidationResult validateTestConnection() throws Exception {
    ValidationResultMutable vr = new ValidationResultMutable(SnowflakeSourceOrSink.validateConnection(this));
    if (vr.getStatus() == ValidationResult.Result.OK) {
        vr.setMessage(i18nMessages.getMessage("messages.connectionSuccessful"));
        getForm(FORM_WIZARD).setAllowForward(true);
    } else {
        getForm(FORM_WIZARD).setAllowForward(false);
    }
    return vr;
}
Also used : ValidationResultMutable(org.talend.daikon.properties.ValidationResultMutable)

Example 2 with ValidationResultMutable

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

the class TMarketoBulkExecProperties method validateBulkImportTo.

public ValidationResult validateBulkImportTo() {
    ValidationResultMutable vr = new ValidationResultMutable().setStatus(Result.OK);
    if (isApiSOAP()) {
        vr.setStatus(Result.ERROR);
        vr.setMessage(messages.getMessage("error.validation.soap.bulkexec"));
        return vr;
    }
    return vr;
}
Also used : ValidationResultMutable(org.talend.daikon.properties.ValidationResultMutable)

Example 3 with ValidationResultMutable

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

the class TMarketoInputProperties method validateFetchCustomObjectSchema.

public ValidationResult validateFetchCustomObjectSchema() {
    ValidationResultMutable vr = new ValidationResultMutable();
    try (SandboxedInstance sandboxedInstance = getSandboxedInstance(RUNTIME_SOURCEORSINK_CLASS, USE_CURRENT_JVM_PROPS)) {
        MarketoSourceOrSinkRuntime sos = (MarketoSourceOrSinkRuntime) sandboxedInstance.getInstance();
        sos.initialize(null, this);
        ValidationResult vConn = sos.validateConnection(this);
        if (!Result.OK.equals(vConn.getStatus())) {
            return vConn;
        }
        try {
            Schema schema = ((MarketoSourceOrSinkSchemaProvider) sos).getSchemaForCustomObject(customObjectName.getValue());
            if (schema == null) {
                vr.setStatus(ValidationResult.Result.ERROR).setMessage(messages.getMessage("error.validation.customobjects.fetchcustomobjectschema", customObjectName.getValue(), "NULL"));
                return vr;
            }
            schemaInput.schema.setValue(schema);
            vr.setStatus(ValidationResult.Result.OK);
        } catch (RuntimeException | IOException e) {
            vr.setStatus(ValidationResult.Result.ERROR).setMessage(messages.getMessage("error.validation.customobjects.fetchcustomobjectschema", customObjectName.getValue(), e.getMessage()));
        }
    }
    return vr;
}
Also used : MarketoComponentDefinition.getSandboxedInstance(org.talend.components.marketo.MarketoComponentDefinition.getSandboxedInstance) SandboxedInstance(org.talend.daikon.sandbox.SandboxedInstance) MarketoSourceOrSinkRuntime(org.talend.components.marketo.runtime.MarketoSourceOrSinkRuntime) Schema(org.apache.avro.Schema) ValidationResultMutable(org.talend.daikon.properties.ValidationResultMutable) MarketoSourceOrSinkSchemaProvider(org.talend.components.marketo.runtime.MarketoSourceOrSinkSchemaProvider) IOException(java.io.IOException) ValidationResult(org.talend.daikon.properties.ValidationResult)

Example 4 with ValidationResultMutable

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

the class TMarketoInputProperties method validateInputOperation.

public ValidationResult validateInputOperation() {
    if (isApiSOAP()) {
        switch(inputOperation.getValue()) {
            case getLead:
            case getMultipleLeads:
            case getLeadActivity:
            case getLeadChanges:
                return ValidationResult.OK;
            case CustomObject:
                ValidationResultMutable vr = new ValidationResultMutable();
                vr.setStatus(Result.ERROR);
                vr.setMessage(messages.getMessage("error.validation.customobjects.nosoap"));
                return vr;
        }
    }
    return ValidationResult.OK;
}
Also used : ValidationResultMutable(org.talend.daikon.properties.ValidationResultMutable)

Example 5 with ValidationResultMutable

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

the class TMarketoInputProperties method validateFetchCompoundKey.

public ValidationResult validateFetchCompoundKey() {
    ValidationResultMutable vr = new ValidationResultMutable();
    try (SandboxedInstance sandboxedInstance = getSandboxedInstance(RUNTIME_SOURCEORSINK_CLASS, USE_CURRENT_JVM_PROPS)) {
        MarketoSourceOrSinkRuntime sos = (MarketoSourceOrSinkRuntime) sandboxedInstance.getInstance();
        sos.initialize(null, this);
        ValidationResult vConn = sos.validateConnection(this);
        if (!Result.OK.equals(vConn.getStatus())) {
            return vConn;
        }
        try {
            List<String> keys = ((MarketoSourceOrSinkSchemaProvider) sos).getCompoundKeyFields(customObjectName.getValue());
            if (keys == null) {
                vr.setStatus(ValidationResult.Result.ERROR).setMessage(messages.getMessage("error.validation.customobjects.fetchcompoundkey", customObjectName.getValue(), "NULL"));
                return vr;
            }
            compoundKey.keyName.setValue(keys);
            compoundKey.keyValue.setValue(Arrays.asList(new String[keys.size()]));
            vr.setStatus(ValidationResult.Result.OK);
        } catch (RuntimeException | IOException e) {
            vr.setStatus(ValidationResult.Result.ERROR).setMessage(messages.getMessage("error.validation.customobjects.fetchcompoundkey", customObjectName.getValue(), e.getMessage()));
        }
    }
    return vr;
}
Also used : MarketoComponentDefinition.getSandboxedInstance(org.talend.components.marketo.MarketoComponentDefinition.getSandboxedInstance) SandboxedInstance(org.talend.daikon.sandbox.SandboxedInstance) MarketoSourceOrSinkRuntime(org.talend.components.marketo.runtime.MarketoSourceOrSinkRuntime) ValidationResultMutable(org.talend.daikon.properties.ValidationResultMutable) MarketoSourceOrSinkSchemaProvider(org.talend.components.marketo.runtime.MarketoSourceOrSinkSchemaProvider) PropertyFactory.newString(org.talend.daikon.properties.property.PropertyFactory.newString) IOException(java.io.IOException) ValidationResult(org.talend.daikon.properties.ValidationResult)

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