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;
}
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;
}
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;
}
Aggregations