use of org.talend.components.marketo.runtime.MarketoSourceOrSinkRuntime in project components by Talend.
the class TMarketoConnectionProperties method validateTestConnection.
public ValidationResult validateTestConnection() {
try (SandboxedInstance sandboxedInstance = getSandboxedInstance(RUNTIME_SOURCEORSINK_CLASS, USE_CURRENT_JVM_PROPS)) {
MarketoSourceOrSinkRuntime sos = (MarketoSourceOrSinkRuntime) sandboxedInstance.getInstance();
sos.initialize(null, this);
ValidationResult vr = sos.validateConnection(this);
if (vr.getStatus() == ValidationResult.Result.OK) {
getForm(FORM_WIZARD).setAllowForward(true);
getForm(FORM_WIZARD).setAllowFinish(true);
} else {
getForm(FORM_WIZARD).setAllowForward(false);
}
return vr;
}
}
use of org.talend.components.marketo.runtime.MarketoSourceOrSinkRuntime 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;
}
use of org.talend.components.marketo.runtime.MarketoSourceOrSinkRuntime 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;
}
use of org.talend.components.marketo.runtime.MarketoSourceOrSinkRuntime in project components by Talend.
the class MarketoCustomObjectsSchemasProperties method beforeFormPresentCustomObjects.
public void beforeFormPresentCustomObjects() throws IOException {
List<NamedThing> customObjectsNames;
try (SandboxedInstance sandboxedInstance = getSandboxedInstance(RUNTIME_SOURCEORSINK_CLASS, USE_CURRENT_JVM_PROPS)) {
MarketoSourceOrSinkRuntime sos = (MarketoSourceOrSinkRuntime) sandboxedInstance.getInstance();
sos.initialize(null, this);
customObjectsNames = sos.getSchemaNames(null);
}
selectedCustomObjectsNames.setPossibleValues(customObjectsNames);
getForm(FORM_CUSTOMOBJECTS).setAllowBack(true);
getForm(FORM_CUSTOMOBJECTS).setAllowFinish(true);
}
use of org.talend.components.marketo.runtime.MarketoSourceOrSinkRuntime in project components by Talend.
the class TMarketoConnectionProperties method afterFormFinishWizard.
public ValidationResult afterFormFinishWizard(Repository<Properties> repo) {
try (SandboxedInstance sandboxedInstance = getSandboxedInstance(RUNTIME_SOURCEORSINK_CLASS, USE_CURRENT_JVM_PROPS)) {
MarketoSourceOrSinkRuntime sos = (MarketoSourceOrSinkRuntime) sandboxedInstance.getInstance();
sos.initialize(null, this);
ValidationResult vr = sos.validateConnection(this);
if (vr.getStatus() != ValidationResult.Result.OK) {
return vr;
}
try {
repo.storeProperties(this, this.name.getValue(), repositoryLocation, null);
return ValidationResult.OK;
} catch (Exception e) {
return new ValidationResult(Result.ERROR, e.getMessage());
}
}
}
Aggregations