Search in sources :

Example 26 with NamedThing

use of org.talend.daikon.NamedThing 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);
}
Also used : MarketoComponentDefinition.getSandboxedInstance(org.talend.components.marketo.MarketoComponentDefinition.getSandboxedInstance) SandboxedInstance(org.talend.daikon.sandbox.SandboxedInstance) MarketoSourceOrSinkRuntime(org.talend.components.marketo.runtime.MarketoSourceOrSinkRuntime) NamedThing(org.talend.daikon.NamedThing)

Example 27 with NamedThing

use of org.talend.daikon.NamedThing in project components by Talend.

the class DefaultMetaDataSource method getSearchableTypes.

/**
 * {@inheritDoc}
 */
@Override
public Collection<NamedThing> getSearchableTypes() {
    List<NamedThing> searchableTypes = new ArrayList<>(256);
    Collection<RecordTypeInfo> recordTypes = getRecordTypes();
    for (RecordTypeInfo recordTypeInfo : recordTypes) {
        RecordTypeDesc recordTypeDesc = recordTypeInfo.getRecordType();
        if (recordTypeDesc.getSearchRecordType() != null) {
            SearchRecordTypeDesc searchRecordType = clientService.getBasicMetaData().getSearchRecordType(recordTypeDesc);
            if (searchRecordType != null) {
                searchableTypes.add(new SimpleNamedThing(recordTypeInfo.getName(), recordTypeInfo.getDisplayName()));
            }
        }
    }
    return searchableTypes;
}
Also used : SearchRecordTypeDesc(org.talend.components.netsuite.client.model.SearchRecordTypeDesc) CustomRecordTypeInfo(org.talend.components.netsuite.client.model.CustomRecordTypeInfo) RecordTypeInfo(org.talend.components.netsuite.client.model.RecordTypeInfo) SearchRecordTypeDesc(org.talend.components.netsuite.client.model.SearchRecordTypeDesc) RecordTypeDesc(org.talend.components.netsuite.client.model.RecordTypeDesc) SimpleNamedThing(org.talend.daikon.SimpleNamedThing) ArrayList(java.util.ArrayList) NamedThing(org.talend.daikon.NamedThing) SimpleNamedThing(org.talend.daikon.SimpleNamedThing)

Example 28 with NamedThing

use of org.talend.daikon.NamedThing in project components by Talend.

the class AbstractTopLevelDefinitionTest method testGetTitle.

@Test
public void testGetTitle() {
    // check getTitle with proper i18n
    NamedThing i18nDefinition = getMockI18nDef();
    when(i18nDefinition.getI18nMessage("definition.foo.title")).thenReturn("ZeTitle");
    assertEquals("ZeTitle", i18nDefinition.getTitle());
    // check getTitle with no i18n but one available for displayname
    i18nDefinition = getMockI18nDef();
    when(i18nDefinition.getI18nMessage("definition.foo.displayName")).thenReturn("ZedisplayName");
    assertEquals("ZedisplayName", i18nDefinition.getTitle());
    // check getTitle with no i18n and no i18n for display name
    i18nDefinition = getMockI18nDef();
    assertEquals("definition.foo.title", i18nDefinition.getTitle());
}
Also used : NamedThing(org.talend.daikon.NamedThing) Test(org.junit.Test)

Example 29 with NamedThing

use of org.talend.daikon.NamedThing in project components by Talend.

the class PropertiesTester method resolveProperty.

private Property resolveProperty() {
    if (argIndex >= args.length) {
        System.out.println("Please specify the property name (which can be qualified)");
        throw new IllegalArgumentException();
    }
    String prop = args[argIndex++];
    NamedThing se = testProps.getProperty(prop);
    if (se == null) {
        System.out.println("Property: " + prop + " not found");
        throw new IllegalArgumentException();
    }
    if (!(se instanceof Property)) {
        System.out.println("Property: " + prop + " must be a leaf property");
        throw new IllegalArgumentException();
    }
    Property p = (Property) se;
    return p;
}
Also used : NamedThing(org.talend.daikon.NamedThing) Property(org.talend.daikon.properties.property.Property)

Example 30 with NamedThing

use of org.talend.daikon.NamedThing in project components by Talend.

the class AzureStorageSourceOrSink method getSchemaNames.

@Override
public List<NamedThing> getSchemaNames(RuntimeContainer container) throws IOException {
    List<NamedThing> result = new ArrayList<>();
    try {
        CloudStorageAccount storageAccount = getAzureConnection(container).getCloudStorageAccount();
        CloudBlobClient client = storageAccount.createCloudBlobClient();
        for (CloudBlobContainer c : client.listContainers()) {
            result.add(new SimpleNamedThing(c.getName(), c.getName()));
        }
    } catch (InvalidKeyException | URISyntaxException e) {
        throw new ComponentException(e);
    }
    return result;
}
Also used : CloudBlobClient(com.microsoft.azure.storage.blob.CloudBlobClient) SimpleNamedThing(org.talend.daikon.SimpleNamedThing) ArrayList(java.util.ArrayList) CloudStorageAccount(com.microsoft.azure.storage.CloudStorageAccount) ComponentException(org.talend.components.api.exception.ComponentException) CloudBlobContainer(com.microsoft.azure.storage.blob.CloudBlobContainer) URISyntaxException(java.net.URISyntaxException) NamedThing(org.talend.daikon.NamedThing) SimpleNamedThing(org.talend.daikon.SimpleNamedThing) InvalidKeyException(java.security.InvalidKeyException)

Aggregations

NamedThing (org.talend.daikon.NamedThing)71 SimpleNamedThing (org.talend.daikon.SimpleNamedThing)34 ArrayList (java.util.ArrayList)33 Test (org.junit.Test)21 Property (org.talend.daikon.properties.property.Property)17 ComponentProperties (org.talend.components.api.properties.ComponentProperties)15 ComponentException (org.talend.components.api.exception.ComponentException)14 Schema (org.apache.avro.Schema)11 SandboxedInstance (org.talend.daikon.sandbox.SandboxedInstance)9 ValidationResult (org.talend.daikon.properties.ValidationResult)8 Form (org.talend.daikon.properties.presentation.Form)8 List (java.util.List)7 IOException (java.io.IOException)6 PresentationItem (org.talend.daikon.properties.PresentationItem)6 Properties (org.talend.daikon.properties.Properties)6 ComponentWizard (org.talend.components.api.wizard.ComponentWizard)5 GenericElementParameter (org.talend.designer.core.generic.model.GenericElementParameter)5 PropertyPathConnector (org.talend.components.api.component.PropertyPathConnector)4 ComponentWizardDefinition (org.talend.components.api.wizard.ComponentWizardDefinition)4 SearchRecordTypeDesc (org.talend.components.netsuite.client.model.SearchRecordTypeDesc)4