use of org.talend.core.model.properties.HL7ConnectionItem in project tdi-studio-se by Talend.
the class TalendDndHelper method filterNeededComponents.
public static List<IComponent> filterNeededComponents(Item item, RepositoryNode seletetedNode, ERepositoryObjectType type) {
EDatabaseComponentName name = EDatabaseComponentName.getCorrespondingComponentName(item, type);
List<IComponent> neededComponents = new ArrayList<IComponent>();
if (name == null) {
return neededComponents;
}
String productNameWanted = filterProductNameWanted(name, item);
boolean hl7Related = false;
boolean hl7Output = false;
if (item instanceof HL7ConnectionItem) {
hl7Related = true;
EList list = ((HL7Connection) ((HL7ConnectionItem) item).getConnection()).getRoot();
if (list != null && list.size() > 0) {
hl7Output = true;
}
}
// for mdm
MdmConceptType mdmType = null;
if (item instanceof MDMConnectionItem) {
MDMConnectionItem mdmItem = (MDMConnectionItem) item;
if (seletetedNode != null && seletetedNode.getObject() instanceof MetadataTableRepositoryObject) {
MetadataTableRepositoryObject object = (MetadataTableRepositoryObject) seletetedNode.getObject();
if (mdmItem.getConnection() instanceof MDMConnection) {
MDMConnection connection = (MDMConnection) mdmItem.getConnection();
for (Object obj : connection.getSchemas()) {
if (obj instanceof Concept && object.getLabel().equals(((Concept) obj).getLabel())) {
mdmType = ((Concept) obj).getConceptType();
}
}
}
}
}
Set<IComponent> components = ComponentsFactoryProvider.getInstance().getComponents();
EmfComponent emfComponent = null;
for (IComponent component : components) {
if (component instanceof EmfComponent) {
emfComponent = (EmfComponent) component;
String componentProductname = emfComponent.getRepositoryType();
boolean value = true;
if (type == ERepositoryObjectType.METADATA_CON_TABLE) {
if (emfComponent.getName().toUpperCase().endsWith(MAP)) {
value = false;
}
}
if (hl7Output && !component.getName().equals("tHL7Output")) {
//$NON-NLS-1$
value = false;
} else if (hl7Related && !hl7Output && !component.getName().equals("tHL7Input")) {
//$NON-NLS-N$ bug15632
value = false;
}
boolean flag = filterComponent(component, name, type);
if (((componentProductname != null && productNameWanted.endsWith(componentProductname)) && value) || flag) {
Pattern pattern = Pattern.compile("^.*oracle.*$", Pattern.CASE_INSENSITIVE);
if (pattern.matcher(name.getDBType()).matches() && (emfComponent.getName().equals("tAmazonOracleInput") || emfComponent.getName().equals("tAmazonOracleOutput"))) {
continue;
}
if (item instanceof MDMConnectionItem) {
if (MdmConceptType.INPUT.equals(mdmType) && emfComponent.getName().endsWith(INPUT)) {
neededComponents.add(emfComponent);
} else if (MdmConceptType.OUTPUT.equals(mdmType) && emfComponent.getName().endsWith(OUTPUT)) {
neededComponents.add(emfComponent);
} else if (MdmConceptType.RECEIVE.equals(mdmType) && emfComponent.getName().endsWith(RECEIVE)) {
neededComponents.add(emfComponent);
}
} else {
neededComponents.add(emfComponent);
}
}
}
}
return sortFilteredComponnents(item, seletetedNode, type, neededComponents);
}
use of org.talend.core.model.properties.HL7ConnectionItem in project tdi-studio-se by Talend.
the class ValidationRulesUtil method filterNeededComponents.
public static List<IComponent> filterNeededComponents(Item item, ERepositoryObjectType type) {
EDatabaseComponentName name = EDatabaseComponentName.getCorrespondingComponentName(item, type);
String productNameWanted = filterProductNameWanted(name, item);
boolean hl7Related = false;
boolean hl7Output = false;
if (item instanceof HL7ConnectionItem) {
hl7Related = true;
EList list = ((HL7Connection) ((HL7ConnectionItem) item).getConnection()).getRoot();
if (list != null && list.size() > 0) {
hl7Output = true;
}
}
Set<IComponent> components = ComponentsFactoryProvider.getInstance().getComponents();
List<IComponent> neededComponents = new ArrayList<IComponent>();
EmfComponent emfComponent = null;
for (IComponent component : components) {
if (component instanceof EmfComponent) {
emfComponent = (EmfComponent) component;
String componentProductname = emfComponent.getRepositoryType();
boolean value = true;
if (type == ERepositoryObjectType.METADATA_CON_TABLE) {
if (emfComponent.getName().toUpperCase().endsWith(MAP)) {
value = false;
}
}
if (hl7Output && !component.getName().equals("tHL7Output")) {
//$NON-NLS-1$
value = false;
} else if (hl7Related && !hl7Output && !component.getName().equals("tHL7Input")) {
// bug15632
value = false;
}
boolean flag = filterComponent(component, name, type);
if (((componentProductname != null && productNameWanted.endsWith(componentProductname)) && value) || flag) {
neededComponents.add(emfComponent);
}
}
}
return sortFilteredComponnents(item, type, neededComponents);
}
use of org.talend.core.model.properties.HL7ConnectionItem in project tdi-studio-se by Talend.
the class HL7RepositoryComponentDndFilter method valid.
@Override
public boolean valid(Item item, ERepositoryObjectType type, RepositoryNode seletetedNode, IComponent component, String repositoryType) {
if (!(item instanceof HL7ConnectionItem) || component == null || repositoryType == null) {
return false;
}
boolean hl7Related = false;
boolean hl7Output = false;
if (item instanceof HL7ConnectionItem) {
hl7Related = true;
EList list = ((HL7Connection) ((HL7ConnectionItem) item).getConnection()).getRoot();
if (list != null && list.size() > 0) {
hl7Output = true;
}
}
String componentProductname = component.getRepositoryType();
boolean filter = true;
if (hl7Output && !component.getName().equals(HL7_OUTPUT)) {
filter = false;
} else if (hl7Related && !hl7Output && !component.getName().equals(HL7_INPUT)) {
// bug15632
filter = false;
}
if (componentProductname != null && repositoryType.endsWith(componentProductname) && filter && validSub(item, type, seletetedNode, component, repositoryType)) {
return true;
}
return false;
}
use of org.talend.core.model.properties.HL7ConnectionItem in project tdi-studio-se by Talend.
the class ComponentChooseDialog method getChangeMetadataCommand.
/**
* DOC bqian Comment method "getChangeMetadataCommand".
*
* @param selectedNode
* @param node
* @param list
* @param connectionItem
*/
private void getChangeMetadataCommand(CompoundCommand cc, RepositoryNode selectedNode, Node node, ConnectionItem connectionItem) {
if (selectedNode.getProperties(EProperties.CONTENT_TYPE) == ERepositoryObjectType.METADATA_CON_COLUMN) {
RepositoryNode columnParentNode = selectedNode.getParent().getParent();
if (columnParentNode != null) {
selectedNode = columnParentNode;
}
}
if (selectedNode.getProperties(EProperties.CONTENT_TYPE) == ERepositoryObjectType.METADATA_CON_TABLE || selectedNode.getProperties(EProperties.CONTENT_TYPE) == ERepositoryObjectType.METADATA_SAP_FUNCTION || selectedNode.getProperties(EProperties.CONTENT_TYPE) == ERepositoryObjectType.METADATA_SALESFORCE_MODULE) {
String etlSchema = null;
if (connectionItem.getConnection() instanceof DatabaseConnection) {
DatabaseConnection connection = (DatabaseConnection) connectionItem.getConnection();
if (connection instanceof DatabaseConnection) {
etlSchema = connection.getUiSchema();
}
if (!"".equals(etlSchema)) {
//$NON-NLS-1$
//$NON-NLS-1$
IElementParameter e = node.getElementParameter("ELT_SCHEMA_NAME");
if (e != null) {
if (connection.isContextMode() && ContextParameterUtils.isContainContextParam(etlSchema)) {
e.setValue(etlSchema);
} else {
e.setValue(TalendTextUtils.addQuotes(etlSchema));
}
}
// node.getElementParameter("ELT_SCHEMA_NAME").setValue("\"" + etlSchema + "\"");
}
}
IRepositoryViewObject object = selectedNode.getObject();
MetadataTable table = null;
if (object instanceof MetadataTableRepositoryObject) {
table = ((MetadataTableRepositoryObject) object).getTable();
} else if (object instanceof SalesforceModuleRepositoryObject) {
table = ((SalesforceModuleRepositoryObject) object).getDefaultTable();
IRepositoryViewObject obj = null;
if (selectedNode.getChildren() != null) {
for (IRepositoryNode repositoryNode : selectedNode.getChildren()) {
obj = repositoryNode.getObject();
if (obj instanceof MetadataTableRepositoryObject) {
table = ((MetadataTableRepositoryObject) obj).getTable();
break;
}
}
}
}
// for SAP
if (PluginChecker.isSAPWizardPluginLoaded() && connectionItem instanceof SAPConnectionItem) {
getSAPCommand(cc, object, connectionItem, table, node);
return;
}
if (table != null) {
//$NON-NLS-1$
String value = connectionItem.getProperty().getId() + " - " + table.getLabel();
IElementParameter schemaParam = node.getElementParameterFromField(EParameterFieldType.SCHEMA_TYPE);
if (schemaParam == null) {
schemaParam = node.getElementParameterFromField(EParameterFieldType.SCHEMA_REFERENCE);
}
IElementParameter queryParam = node.getElementParameterFromField(EParameterFieldType.QUERYSTORE_TYPE);
if (queryParam != null) {
queryParam = queryParam.getChildParameters().get(EParameterName.QUERYSTORE_TYPE.getName());
if (queryParam != null) {
queryParam.setValue(EmfComponent.BUILTIN);
}
}
// }
if (PluginChecker.isHL7PluginLoaded() && connectionItem instanceof HL7ConnectionItem) {
Command hl7Cmd = new RepositoryChangeMetadataForHL7Command(node, IEbcdicConstant.TABLE_SCHEMAS, table.getLabel(), ConvertionHelper.convert(table));
cc.add(hl7Cmd);
return;
}
if (schemaParam == null) {
return;
}
if (node.isELTComponent()) {
//$NON-NLS-1$
node.setPropertyValue(EParameterName.LABEL.getName(), "__ELT_TABLE_NAME__");
}
schemaParam.getChildParameters().get(EParameterName.SCHEMA_TYPE.getName()).setValue(EmfComponent.REPOSITORY);
RepositoryChangeMetadataCommand command2 = new RepositoryChangeMetadataCommand(node, //$NON-NLS-1$
schemaParam.getName() + ":" + EParameterName.REPOSITORY_SCHEMA_TYPE.getName(), value, ConvertionHelper.convert(table), null, connectionItem.getConnection());
cc.add(command2);
return;
}
}
}
Aggregations