Search in sources :

Example 1 with RepositoryComponentSetting

use of org.talend.core.repository.RepositoryComponentSetting in project tdi-studio-se by Talend.

the class ETLMapRepositoryComponentDndFilter method valid.

@Override
public boolean valid(Item item, ERepositoryObjectType type, RepositoryNode seletetedNode, IComponent component, String repositoryType) {
    RepositoryComponentSetting setting = RepositoryComponentManager.getSetting(item, type);
    if (setting == null || component == null) {
        return false;
    }
    String originalFamilyName = component.getOriginalFamilyName();
    if (originalFamilyName.startsWith("ELT")) {
        //$NON-NLS-1$
        EDatabaseTypeName[] dbTypes = setting.getDbTypes();
        if (dbTypes != null && dbTypes.length > 0) {
            String product = null;
            List<EDatabaseTypeName> list = Arrays.asList(dbTypes);
            if (list.contains(EDatabaseTypeName.ORACLEFORSID) || list.contains(EDatabaseTypeName.ORACLESN) || list.contains(EDatabaseTypeName.ORACLE_OCI) || list.contains(EDatabaseTypeName.ORACLE_CUSTOM)) {
                product = EDatabaseTypeName.ORACLEFORSID.getProduct();
            } else {
                product = dbTypes[0].getDisplayName();
            }
            // maybe, it's not good like this
            if (product != null && originalFamilyName.toUpperCase().endsWith(product.toUpperCase())) {
                if (type == ERepositoryObjectType.METADATA_CONNECTIONS) {
                    if (component.getName().toUpperCase().endsWith(MAP)) {
                        return true;
                    }
                }
                if (type == ERepositoryObjectType.METADATA_CON_TABLE) {
                    if (!component.getName().toUpperCase().endsWith(MAP)) {
                        return true;
                    }
                }
            }
        }
    }
    return false;
}
Also used : RepositoryComponentSetting(org.talend.core.repository.RepositoryComponentSetting) EDatabaseTypeName(org.talend.core.database.EDatabaseTypeName)

Example 2 with RepositoryComponentSetting

use of org.talend.core.repository.RepositoryComponentSetting in project tdi-studio-se by Talend.

the class JSONDragAndDropHandler method getCorrespondingComponentName.

@Override
public IComponentName getCorrespondingComponentName(Item item, ERepositoryObjectType type) {
    RepositoryComponentSetting setting = null;
    if (item instanceof JSONFileConnectionItem) {
        setting = new RepositoryComponentSetting();
        setting.setName(JSON);
        setting.setRepositoryType(JSON);
        setting.setWithSchema(true);
        setting.setInputComponent(INPUT);
        setting.setOutputComponent(OUTPUT);
        List<Class<Item>> list = new ArrayList<Class<Item>>();
        Class clazz = null;
        try {
            clazz = Class.forName(JSONFileConnectionItem.class.getName());
        } catch (ClassNotFoundException e) {
            ExceptionHandler.process(e);
        }
        list.add(clazz);
        setting.setClasses(list.toArray(new Class[0]));
    }
    return setting;
}
Also used : Item(org.talend.core.model.properties.Item) JSONFileConnectionItem(org.talend.repository.model.json.JSONFileConnectionItem) RepositoryComponentSetting(org.talend.core.repository.RepositoryComponentSetting) ArrayList(java.util.ArrayList) JSONFileConnectionItem(org.talend.repository.model.json.JSONFileConnectionItem)

Example 3 with RepositoryComponentSetting

use of org.talend.core.repository.RepositoryComponentSetting in project tdi-studio-se by Talend.

the class GenericDragAndDropHandler method getCorrespondingComponentName.

@Override
public IComponentName getCorrespondingComponentName(Item item, ERepositoryObjectType type) {
    RepositoryComponentSetting setting = null;
    List<Class<Item>> list = new ArrayList<Class<Item>>();
    if (item instanceof GenericConnectionItem) {
        GenericConnection connection = (GenericConnection) ((GenericConnectionItem) item).getConnection();
        setting = new RepositoryComponentSetting();
        setting.setWithSchema(true);
        String componentMainName = getComponentMainName(connection);
        setting.setInputComponent(getInputComponentName(componentMainName));
        setting.setOutputComponent(getOutputComponentName(componentMainName));
        Class clazz = null;
        try {
            clazz = Class.forName(GenericConnectionItem.class.getName());
        } catch (ClassNotFoundException e) {
            ExceptionHandler.process(e);
        }
        list.add(clazz);
        setting.setClasses(list.toArray(new Class[0]));
    }
    return setting;
}
Also used : GenericConnectionItem(org.talend.repository.generic.model.genericMetadata.GenericConnectionItem) ConnectionItem(org.talend.core.model.properties.ConnectionItem) Item(org.talend.core.model.properties.Item) RepositoryComponentSetting(org.talend.core.repository.RepositoryComponentSetting) ArrayList(java.util.ArrayList) GenericConnection(org.talend.repository.generic.model.genericMetadata.GenericConnection) GenericConnectionItem(org.talend.repository.generic.model.genericMetadata.GenericConnectionItem)

Aggregations

RepositoryComponentSetting (org.talend.core.repository.RepositoryComponentSetting)3 ArrayList (java.util.ArrayList)2 Item (org.talend.core.model.properties.Item)2 EDatabaseTypeName (org.talend.core.database.EDatabaseTypeName)1 ConnectionItem (org.talend.core.model.properties.ConnectionItem)1 GenericConnection (org.talend.repository.generic.model.genericMetadata.GenericConnection)1 GenericConnectionItem (org.talend.repository.generic.model.genericMetadata.GenericConnectionItem)1 JSONFileConnectionItem (org.talend.repository.model.json.JSONFileConnectionItem)1