use of org.talend.core.model.components.IComponentsService in project tdi-studio-se by Talend.
the class ComponentChooseDialog method getAppropriateComponent.
private void getAppropriateComponent(Item item, boolean quickCreateInput, boolean quickCreateOutput, TempStore store, ERepositoryObjectType type) {
IComponentName rcSetting = RepositoryComponentManager.getSetting(item, type);
// For handler, need check for esb
if (rcSetting == null) {
for (IDragAndDropServiceHandler handler : DragAndDropManager.getHandlers()) {
rcSetting = handler.getCorrespondingComponentName(item, type);
if (rcSetting != null) {
break;
}
}
if (rcSetting == null) {
return;
}
}
boolean isCurrentProject = true;
String projectName = null;
if (store.seletetedNode.getObject() != null) {
projectName = store.seletetedNode.getObject().getProjectLabel();
isCurrentProject = projectName.equals(ProjectManager.getInstance().getCurrentProject().getLabel());
}
List<IComponent> neededComponents = RepositoryComponentManager.filterNeededComponents(item, store.seletetedNode, type, isCurrentProject, projectName);
for (IDragAndDropServiceHandler handler : DragAndDropManager.getHandlers()) {
List<IComponent> comList = handler.filterNeededComponents(item, store.seletetedNode, type);
if (comList != null) {
for (IComponent handlerComp : comList) {
if (!neededComponents.contains(handlerComp) && !handlerComp.isTechnical()) {
neededComponents.add(handlerComp);
}
}
}
}
// special handle hbase to support tpigLoad
String hbaseName = EDatabaseTypeName.HBASE.getDisplayName().toUpperCase();
if (rcSetting != null && (hbaseName).equals(rcSetting.toString())) {
IComponentsService service = (IComponentsService) GlobalServiceRegister.getDefault().getService(IComponentsService.class);
String componentProductname = null;
Set<IComponent> components = service.getComponentsFactory().getComponents();
for (IComponent component : components) {
componentProductname = component.getRepositoryType();
if (componentProductname != null && componentProductname.contains(hbaseName) && !neededComponents.contains(component) && !component.isTechnical()) {
neededComponents.add(component);
}
}
}
neededComponents = (List<IComponent>) ComponentUtilities.filterVisibleComponents(neededComponents);
// Check if the components in the list neededComponents have the same category that is required by Process.
IComponent component = chooseOneComponent(extractComponents(neededComponents), rcSetting, quickCreateInput, quickCreateOutput);
store.component = component;
store.componentName = rcSetting;
}
use of org.talend.core.model.components.IComponentsService in project tdi-studio-se by Talend.
the class GenericDragAndDropHandler method filterNeededComponents.
@Override
public List<IComponent> filterNeededComponents(Item item, RepositoryNode seletetedNode, ERepositoryObjectType type) {
// TUP-4151
List<IComponent> neededComponents = new ArrayList<>();
if (!(item instanceof GenericConnectionItem)) {
return neededComponents;
}
IComponentsService service = (IComponentsService) GlobalServiceRegister.getDefault().getService(IComponentsService.class);
Set<IComponent> components = service.getComponentsFactory().getComponents();
for (IComponent component : components) {
if (EComponentType.GENERIC.equals(component.getComponentType())) {
if (!neededComponents.contains(component) && isValid(seletetedNode, component)) {
neededComponents.add(component);
}
}
}
return neededComponents;
}
use of org.talend.core.model.components.IComponentsService in project tdi-studio-se by Talend.
the class JSONDragAndDropHandler method filterNeededComponents.
@Override
public List<IComponent> filterNeededComponents(Item item, RepositoryNode seletetedNode, ERepositoryObjectType type) {
List<IComponent> neededComponents = new ArrayList<IComponent>();
if (!(item instanceof JSONFileConnectionItem)) {
return neededComponents;
}
IComponentsService service = (IComponentsService) GlobalServiceRegister.getDefault().getService(IComponentsService.class);
Set<IComponent> components = service.getComponentsFactory().getComponents();
JSONFileConnection connection = (JSONFileConnection) ((JSONFileConnectionItem) item).getConnection();
for (IComponent component : components) {
if (!connection.isInputModel()) {
if (isValid(item, type, seletetedNode, component, "JSONOUTPUT") && !neededComponents.contains(component)) {
neededComponents.add(component);
}
} else {
if (isValid(item, type, seletetedNode, component, JSON) && !neededComponents.contains(component)) {
neededComponents.add(component);
}
}
}
// type);
return neededComponents;
}
Aggregations