use of org.talend.core.database.EDatabaseTypeName 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.database.EDatabaseTypeName in project tdi-studio-se by Talend.
the class AbstractXMLConfigPage method loadAttrsInfo.
protected void loadAttrsInfo() {
attrsAvailableValuesMap = new HashMap<String, String[]>();
String[] valuesArray = null;
// CTYPE
EConnectionType[] eConnectionTypes = EConnectionType.values();
valuesArray = new String[eConnectionTypes.length];
for (int i = 0; i < eConnectionTypes.length; i++) {
valuesArray[i] = eConnectionTypes[i].getName();
}
//$NON-NLS-1$
attrsAvailableValuesMap.put("CTYPE", valuesArray);
// FIELD
EParameterFieldType[] eParameterFieldType = EParameterFieldType.values();
valuesArray = new String[eParameterFieldType.length];
for (int i = 0; i < eParameterFieldType.length; i++) {
valuesArray[i] = eParameterFieldType[i].getName();
}
//$NON-NLS-1$
attrsAvailableValuesMap.put("FIELD", valuesArray);
// PLATFORM
//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
attrsAvailableValuesMap.put("PLATEFORM", new String[] { "ALL", "WINDOWS", "LINUX" });
// COMPATIBILITY
//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
attrsAvailableValuesMap.put("COMPATIBILITY", new String[] { "ALL", "WINDOWS", "LINUX" });
// STATUS
//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
attrsAvailableValuesMap.put("STATUS", new String[] { "ALPHA", "BETA", "RELEASE" });
// LINE_STYLE
//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
attrsAvailableValuesMap.put("LINE_STYLE", new String[] { "1", "2", "3", "4" });
// NB_LINES
//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
attrsAvailableValuesMap.put("NB_LINES", new String[] { "1", "2", "3", "4", "5" });
// MAX_INPUT MIN_INPUT MAX_OUTPUT MIN_OUTPUT
//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
valuesArray = new String[] { "0", "1", "2", "3", "4", "5" };
//$NON-NLS-1$
attrsAvailableValuesMap.put("MAX_INPUT", valuesArray);
//$NON-NLS-1$
attrsAvailableValuesMap.put("MIN_INPUT", valuesArray);
//$NON-NLS-1$
attrsAvailableValuesMap.put("MAX_OUTPUT", valuesArray);
//$NON-NLS-1$
attrsAvailableValuesMap.put("MIN_OUTPUT", valuesArray);
// PROPERTY_TYPE
List<String> valuesList = new ArrayList<String>();
//$NON-NLS-1$
valuesList.add("DELIMITED");
//$NON-NLS-1$
valuesList.add("POSITIONAL");
//$NON-NLS-1$
valuesList.add("REGEX");
//$NON-NLS-1$
valuesList.add("XML");
//$NON-NLS-1$
valuesList.add("LDAP");
//$NON-NLS-1$
valuesList.add("WSDL");
//$NON-NLS-1$
valuesList.add("GENERIC");
//$NON-NLS-1$
valuesList.add("DATABASE");
for (EDatabaseTypeName eDatabaseTypeName : EDatabaseTypeName.values()) {
//$NON-NLS-1$
valuesList.add("DATABASE:" + eDatabaseTypeName.getProduct());
}
//$NON-NLS-1$
attrsAvailableValuesMap.put("REPOSITORY_VALUE", valuesList.toArray(new String[0]));
// attributes with boolean value
String[] booleanAttrNameArray = { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
"SHOW", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
"REQUIRED", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
"READONLY", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
"BASED_ON_SCHEMA", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
"KEY", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
"NULLABLE", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
"CUSTOM", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
"BUILTIN", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
"STARTABLE", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
"SCHEMA_AUTO_PROPAGATE", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
"DATA_AUTO_PROPAGATE", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
"HAS_CONDITIONAL_OUTPUTS", "IS_MULTIPLYING_OUTPUTS", "VISIBLE", "TSTATCATCHER_STATS", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
"USE_MERGE" };
//$NON-NLS-1$ //$NON-NLS-2$
String[] booleanArray = { "true", "false" };
for (String attrName : booleanAttrNameArray) {
attrsAvailableValuesMap.put(attrName, booleanArray);
}
// init maps for TooTipsText
attrsToolTipsMap = new HashMap<String, String>();
//$NON-NLS-1$ //$NON-NLS-2$
attrsToolTipsMap.put("MAX_INPUT", Messages.getString("AbstractXMLConfigPage.MAXINPUTTip"));
//$NON-NLS-1$ //$NON-NLS-2$
attrsToolTipsMap.put("MIN_INPUT", Messages.getString("AbstractXMLConfigPage.MININPUTTip"));
//$NON-NLS-1$ //$NON-NLS-2$
attrsToolTipsMap.put("MAX_OUTPUT", Messages.getString("AbstractXMLConfigPage.MAXOUTPUTTip"));
//$NON-NLS-1$ //$NON-NLS-2$
attrsToolTipsMap.put("MIN_OUTPUT", Messages.getString("AbstractXMLConfigPage.MINOUTPUTTip"));
//$NON-NLS-1$
attrsToolTipsMap.put(//$NON-NLS-1$
"LINE_STYLE", //$NON-NLS-1$
Messages.getString("AbstractXMLConfigPage.LINESTYLETip"));
//$NON-NLS-1$ //$NON-NLS-2$
attrsToolTipsMap.put("LENGTH", Messages.getString("AbstractXMLConfigPage.IntValue"));
//$NON-NLS-1$ //$NON-NLS-2$
attrsToolTipsMap.put("PRECISION", Messages.getString("AbstractXMLConfigPage.IntValue"));
//$NON-NLS-1$ //$NON-NLS-2$
attrsToolTipsMap.put("NB_LINES", Messages.getString("AbstractXMLConfigPage.NBLINESTip"));
//$NON-NLS-1$ //$NON-NLS-2$
attrsToolTipsMap.put("NUM_ROW", Messages.getString("AbstractXMLConfigPage.NUMROWTip"));
//$NON-NLS-1$ //$NON-NLS-2$
attrsToolTipsMap.put("VERSION", Messages.getString("AbstractXMLConfigPage.VERSIONTip"));
//$NON-NLS-1$ //$NON-NLS-2$
attrsToolTipsMap.put("REPOSITORY_VALUE", Messages.getString("AbstractXMLConfigPage.REPOSITORYVALUETip"));
//$NON-NLS-1$ //$NON-NLS-2$
attrsToolTipsMap.put("EXTENSION", Messages.getString("AbstractXMLConfigPage.EXTENSIONTip"));
//$NON-NLS-1$ //$NON-NLS-2$
attrsToolTipsMap.put("CTYPE", Messages.getString("AbstractXMLConfigPage.CTYPETip"));
//$NON-NLS-1$ //$NON-NLS-2$
attrsToolTipsMap.put("TYPE", Messages.getString("AbstractXMLConfigPage.TYPETip"));
//$NON-NLS-1$ //$NON-NLS-2$
attrsToolTipsMap.put("COLOR", Messages.getString("AbstractXMLConfigPage.COLORTip"));
for (String attrName : booleanAttrNameArray) {
//$NON-NLS-1$
attrsToolTipsMap.put(attrName, Messages.getString("AbstractXMLConfigPage.BooleanTip"));
}
}
use of org.talend.core.database.EDatabaseTypeName in project tdq-studio-se by Talend.
the class ConnectionUtils method isGeneralJdbc.
/**
* if the Connection's type is General JDBC return true.
*
* @param conn a database connection
* @return
*/
public static boolean isGeneralJdbc(Connection conn) {
boolean jdbc = false;
if (conn instanceof DatabaseConnection) {
DatabaseConnection dbConn = (DatabaseConnection) conn;
EDatabaseTypeName databaseType = EDatabaseTypeName.getTypeFromDbType(dbConn.getDatabaseType());
if (EDatabaseTypeName.GENERAL_JDBC.equals(databaseType)) {
jdbc = true;
}
}
return jdbc;
}
use of org.talend.core.database.EDatabaseTypeName in project tdq-studio-se by Talend.
the class DBSybaseCatalogRepNode method fillSchemaToCatalog.
/**
* fill schemas on the catalog
*
* @return if fill action is success
*/
private boolean fillSchemaToCatalog(Item databaseItem) {
DatabaseConnection connection = (DatabaseConnection) ((DatabaseConnectionItem) databaseItem).getConnection();
TypedReturnCode<Connection> rcConn = MetadataConnectionUtils.createConnection(connection);
if (!rcConn.isOk()) {
log.error(rcConn.getMessage());
return false;
}
java.sql.Connection sqlConnection = rcConn.getObject();
try {
DatabaseMetaData dbJDBCMetadata = ExtractMetaDataUtils.getInstance().getDatabaseMetaData(sqlConnection, connection, false);
EDatabaseTypeName currentEDatabaseType = EDatabaseTypeName.getTypeFromDbType(connection.getDatabaseType());
List<Schema> schemaList = null;
if (currentEDatabaseType != null) {
schemaList = MetadataFillFactory.getDBInstance(currentEDatabaseType).fillSchemaToCatalog(connection, dbJDBCMetadata, this.getCatalog(), null);
}
if (schemaList != null && schemaList.size() > 0) {
CatalogHelper.addSchemas(schemaList, this.getCatalog());
}
} finally {
if (sqlConnection != null) {
ConnectionUtils.closeConnection(sqlConnection);
}
}
return true;
}
use of org.talend.core.database.EDatabaseTypeName in project tdq-studio-se by Talend.
the class ConnectionUtilsTest method testIsGeneralJdbc.
/**
* Test method for
* {@link org.talend.cwm.db.connection.ConnectionUtils#isGeneralJdbc(org.talend.core.model.metadata.builder.connection.Connection)}
* .
*/
@Test
public void testIsGeneralJdbc() {
DatabaseConnection createDatabaseConnection = ConnectionFactoryImpl.eINSTANCE.createDatabaseConnection();
EDatabaseTypeName generalJdbcType = EDatabaseTypeName.GENERAL_JDBC;
createDatabaseConnection.setDatabaseType(generalJdbcType.getDisplayName());
Assert.assertTrue("Current DatabaseType of connection should be " + EDatabaseTypeName.GENERAL_JDBC.getDisplayName(), // $NON-NLS-1$
ConnectionUtils.isGeneralJdbc(createDatabaseConnection));
}
Aggregations