use of org.talend.daikon.NamedThing in project components by Talend.
the class MarketoCustomObjectsSchemasProperties method afterFormFinishCustomObjects.
public ValidationResult afterFormFinishCustomObjects(Repository<Properties> repo) throws Exception {
try (SandboxedInstance sandboxedInstance = getSandboxedInstance(RUNTIME_SOURCEORSINK_CLASS, USE_CURRENT_JVM_PROPS)) {
MarketoSourceOrSinkRuntime sos = (MarketoSourceOrSinkRuntime) sandboxedInstance.getInstance();
sos.initialize(null, this);
try {
String repoLoc = repo.storeProperties(connection, connection.name.getValue(), repositoryLocation, null);
String storeId;
for (NamedThing nl : selectedCustomObjectsNames.getValue()) {
String customObjectId = nl.getName();
storeId = nl.getName().replaceAll("-", "_").replaceAll(" ", "_");
MarketoComponentWizardBaseProperties customObjectProps = new MarketoComponentWizardBaseProperties(customObjectId);
customObjectProps.init();
customObjectProps.connection = connection;
customObjectProps.inputOperation.setValue(InputOperation.CustomObject);
customObjectProps.outputOperation.setValue(OutputOperation.syncCustomObjects);
customObjectProps.customObjectAction.setValue(CustomObjectAction.get);
customObjectProps.customObjectSyncAction.setValue(CustomObjectSyncAction.createOrUpdate);
customObjectProps.schemaInput.schema.setValue(sos.getEndpointSchema(null, customObjectId));
customObjectProps.customObjectName.setValue(nl.getName());
repo.storeProperties(customObjectProps, storeId, repoLoc, "schemaInput.schema");
}
} catch (Exception e) {
ValidationResultMutable vr = new ValidationResultMutable();
vr.setStatus(Result.ERROR);
vr.setMessage(e.getMessage());
return vr;
}
}
return ValidationResult.OK;
}
use of org.talend.daikon.NamedThing in project components by Talend.
the class MarketoSourceOrSinkTestIT method testGetSchemaNames.
@Test
public void testGetSchemaNames() throws Exception {
TMarketoInputProperties props = new TMarketoInputProperties("test");
props.connection.setupProperties();
props.setupProperties();
props.connection.endpoint.setValue(MarketoBaseTestIT.ENDPOINT_REST);
props.connection.clientAccessId.setValue(MarketoBaseTestIT.USERID_REST);
props.connection.secretKey.setValue(MarketoBaseTestIT.SECRETKEY_REST);
MarketoSourceOrSink sos = new MarketoSourceOrSink();
sos.initialize(null, props);
List<NamedThing> cos = sos.getSchemaNames(null);
assertFalse(cos.isEmpty());
}
use of org.talend.daikon.NamedThing in project components by Talend.
the class NetSuiteDatasetRuntimeImpl method getRecordTypes.
@Override
public List<NamedThing> getRecordTypes() {
try {
Collection<RecordTypeInfo> recordTypeList = metaDataSource.getRecordTypes();
List<NamedThing> recordTypes = new ArrayList<>(recordTypeList.size());
for (RecordTypeInfo recordTypeInfo : recordTypeList) {
recordTypes.add(new SimpleNamedThing(recordTypeInfo.getName(), recordTypeInfo.getDisplayName()));
}
// Sort by display name in alphabetical order
Collections.sort(recordTypes, new Comparator<NamedThing>() {
@Override
public int compare(NamedThing o1, NamedThing o2) {
return o1.getDisplayName().compareTo(o2.getDisplayName());
}
});
return recordTypes;
} catch (NetSuiteException e) {
throw new ComponentException(e);
}
}
use of org.talend.daikon.NamedThing in project components by Talend.
the class MetaDataSourceTest method testGetSearchableTypes.
@Test
public void testGetSearchableTypes() {
Collection<NamedThing> searchableTypeNamedThings = metaDataSource.getSearchableTypes();
assertNotNull(searchableTypeNamedThings);
assertFalse(searchableTypeNamedThings.isEmpty());
Set<String> searchableTypeNames = new HashSet<>();
for (NamedThing namedThing : searchableTypeNamedThings) {
assertNotNull(namedThing);
searchableTypeNames.add(namedThing.getName());
}
for (RecordTypeDesc recordTypeDesc : TestRecordTypeEnum.values()) {
if (recordTypeDesc.getSearchRecordType() != null) {
assertTrue(recordTypeDesc.getTypeName(), searchableTypeNames.contains(recordTypeDesc.getTypeName()));
}
}
for (RecordTypeInfo recordTypeInfo : customMetaDataSource.getCustomRecordTypes()) {
assertTrue(recordTypeInfo.getName(), searchableTypeNames.contains(recordTypeInfo.getName()));
}
}
use of org.talend.daikon.NamedThing in project components by Talend.
the class NetSuiteClientServiceIT method testGetSearchableTypes.
@Test
public void testGetSearchableTypes() throws Exception {
NetSuiteClientService<?> connection = webServiceTestFixture.getClientService();
connection.login();
Collection<NamedThing> searches = connection.getMetaDataSource().getSearchableTypes();
for (NamedThing search : searches) {
assertNotNull(search);
assertNotNull(search.getName());
assertNotNull(search.getDisplayName());
SearchRecordTypeDesc searchRecordInfo = connection.getMetaDataSource().getSearchRecordType(search.getName());
assertNotNull("Search record def found: " + search.getName(), searchRecordInfo);
}
}
Aggregations