use of org.talend.components.api.exception.ComponentException 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.components.api.exception.ComponentException in project components by Talend.
the class NetSuiteDatasetRuntimeImpl method getSearchInfo.
@Override
public SearchInfo getSearchInfo(String typeName) {
try {
final SearchRecordTypeDesc searchInfo = metaDataSource.getSearchRecordType(typeName);
final TypeDesc searchRecordInfo = metaDataSource.getBasicMetaData().getTypeInfo(searchInfo.getSearchBasicClass());
List<FieldDesc> fieldDescList = searchRecordInfo.getFields();
List<SearchFieldInfo> fields = new ArrayList<>(fieldDescList.size());
for (FieldDesc fieldDesc : fieldDescList) {
SearchFieldInfo field = new SearchFieldInfo(fieldDesc.getName(), fieldDesc.getValueType());
fields.add(field);
}
// Sort by display name in alphabetical order
Collections.sort(fields, new Comparator<SearchFieldInfo>() {
@Override
public int compare(SearchFieldInfo o1, SearchFieldInfo o2) {
return o1.getName().compareTo(o2.getName());
}
});
return new SearchInfo(searchRecordInfo.getTypeName(), fields);
} catch (NetSuiteException e) {
throw new ComponentException(e);
}
}
use of org.talend.components.api.exception.ComponentException in project components by Talend.
the class NetSuiteDatasetRuntimeImpl method getSchemaForUpdate.
@Override
public Schema getSchemaForUpdate(String typeName) {
try {
final RecordTypeInfo recordTypeInfo = metaDataSource.getRecordType(typeName);
final TypeDesc typeDesc = metaDataSource.getTypeInfo(typeName);
List<FieldDesc> fieldDescList = new ArrayList<>(typeDesc.getFields());
// Sort in alphabetical order
Collections.sort(fieldDescList, FieldDescComparator.INSTANCE);
Schema schema = inferSchemaForType(typeDesc.getTypeName(), fieldDescList);
augmentSchemaWithCustomMetaData(metaDataSource, schema, recordTypeInfo, typeDesc.getFields());
return schema;
} catch (NetSuiteException e) {
throw new ComponentException(e);
}
}
use of org.talend.components.api.exception.ComponentException in project components by Talend.
the class FieldSelectorDefinition method getRuntimeInfo.
@Override
public RuntimeInfo getRuntimeInfo(ExecutionEngine engine, ComponentProperties properties, ConnectorTopology connectorTopology) {
assertEngineCompatibility(engine);
assertConnectorTopologyCompatibility(connectorTopology);
try {
return new JarRuntimeInfo(new URL("mvn:org.talend.components/processing-runtime"), DependenciesReader.computeDependenciesFilePath(ProcessingFamilyDefinition.MAVEN_GROUP_ID, ProcessingFamilyDefinition.MAVEN_ARTIFACT_ID), "org.talend.components.processing.runtime.fieldselector.FieldSelectorRuntime");
} catch (MalformedURLException e) {
throw new ComponentException(e);
}
}
use of org.talend.components.api.exception.ComponentException in project components by Talend.
the class AggregateDefinition method getRuntimeInfo.
@Override
public RuntimeInfo getRuntimeInfo(ExecutionEngine engine, ComponentProperties properties, ConnectorTopology connectorTopology) {
assertEngineCompatibility(engine);
assertConnectorTopologyCompatibility(connectorTopology);
try {
return new JarRuntimeInfo(new URL("mvn:org.talend.components/processing-runtime"), DependenciesReader.computeDependenciesFilePath(ProcessingFamilyDefinition.MAVEN_GROUP_ID, ProcessingFamilyDefinition.MAVEN_ARTIFACT_ID), "org.talend.components.processing.runtime.aggregate.AggregateRuntime");
} catch (MalformedURLException e) {
throw new ComponentException(e);
}
}
Aggregations