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;
}
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());
}
}
}
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;
}
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;
}
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;
}
Aggregations