Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
Hope every one doing well,I trying to generates list of module list like salesforceinput components using talend component kit starter.But i am facing null point exception error because getter() methods are giving null values.Is any way to get parameters directly in this method which are passing through a talend configuration tab.
@Suggestions("loadModules")
public static SuggestionValues loadModules(@Option("datastore") VtigercrmComponentsDataStore datastore )
{
WSClient client= new WSClient(datastore.getUsername());
boolean result = client.doLogin(datastore.getUsername(),datastore.getAccessKey());
ArrayList<Item> a2=new ArrayList<>();
if(result == false) {
System.out.println("Login failed!");
System.out.println(client.lastError());
}
else {
Map types = client.doListTypes();
Iterator iterator = types.keySet().iterator();
while(iterator.hasNext()) {
Object key = iterator.next();
Map moduleInfo = (Map) types.get(key);
String s1= moduleInfo.get("name").toString();
a2.add(new Item(s1,s1));
System.out.println("result "+s1);
}
}
return new SuggestionValues(false,a2);
}
thanks,
venkat.
Hello,
I think your not setting the parameters value of your suggestable annotation.
Here is how suggestions works :
class MyConfigClass {
private VtigercrmComponentsDataStore datastore;
// you need to set the params here that point to your datastore config
@Suggestable(value = "loadModules", parameters = { "datastore" })
private String module;
}
@Service
class MyService {
@Suggestions("loadModules")
public static SuggestionValues loadModules(@Option VtigercrmComponentsDataStore datastore) {
// your logic here ...
}
}
Hi Anas,
thanks reply for my post,exactly correct what you saying,I have set the parameters values as like your post.
now its working.But its not showing error message when I will enter wrong credentials,its showing blank text pop up message.I need to show show exception message and also I am facing one more problem.Do you know how to create schema creation?? If you have code ,help me out.I am new in custom component creation.
thanks,
venkat
Hello,
I suggest you to check this component example. it's a real component used at Talend and developed by the Component kit framework. You can checkout the project from https://github.com/Talend/connectors-se/tree/master/jdbc
For credentials verification you can use the healtch check action. Here is an example that you can rely on.
check this service and it's binding with the Datastore class configuration
https://github.com/Talend/connectors-se/blob/master/jdbc/src/main/java/org/talend/components/jdbc/se...
https://github.com/Talend/connectors-se/blob/master/jdbc/src/main/java/org/talend/components/jdbc/da...
The schema is automatically filled from the guess schema button available on Input component for example
Hi
thanks for reply ,I have written like in my service class,any thing we need to write in dataset or other classes.still I am not able to get columns names and type for module.its showing log error when i am clicking on guess schema button.According to your code which one you have shared me,they not used any @DiscoverSchema annotation.please send me any code for create schema for module with using parameters.Please check my code.
thanks,
venkat.
@DiscoverSchema("module_fields")
public Schema guessSchema(@Option("dataset") final VtigercrmComponentsDataSet dataset ,final RecordBuilderFactory factory)
{
final Schema.Entry.Builder entryBuilder = factory.newEntryBuilder();
final Schema.Builder schemaBuilder = factory.newSchemaBuilder(org.talend.sdk.component.api.record.Schema.Type.RECORD);
Schema.Type type = Schema.Type.STRING;
return (Schema) schemaBuilder.withEntry(entryBuilder.withName("name").withType(type).withNullable(true).build());
}
}