use of org.talend.core.model.properties.DatabaseConnectionItem in project tdi-studio-se by Talend.
the class DbTableController method getExistConnection.
/**
* DOC zli Comment method "getExistConnection".
*
* @return
*/
private DatabaseConnection getExistConnection() {
String implicitRepositoryId = getImplicitRepositoryId();
String statsLogPrositoryId = getStatsLogRepositoryId();
if (implicitRepositoryId != null || statsLogPrositoryId != null) {
// jobsetting view load the exist db info from current selected category
String repId = null;
if (EComponentCategory.EXTRA.equals(section)) {
repId = implicitRepositoryId;
} else if (EComponentCategory.STATSANDLOGS.equals(section)) {
repId = statsLogPrositoryId;
}
if (repId != null) {
IProxyRepositoryFactory proxyRepositoryFactory = DesignerPlugin.getDefault().getRepositoryService().getProxyRepositoryFactory();
try {
IRepositoryViewObject lastVersion = proxyRepositoryFactory.getLastVersion(repId);
if (lastVersion != null) {
Item item = lastVersion.getProperty().getItem();
if (item instanceof DatabaseConnectionItem) {
DatabaseConnection connection = (DatabaseConnection) ((DatabaseConnectionItem) item).getConnection();
return connection;
}
}
} catch (PersistenceException e) {
ExceptionHandler.process(e);
}
}
}
return null;
}
use of org.talend.core.model.properties.DatabaseConnectionItem in project tdi-studio-se by Talend.
the class UpdateNodeParameterCommand method updateProperty.
@SuppressWarnings("unchecked")
private void updateProperty() {
Object updateObject = result.getUpdateObject();
if (updateObject == null) {
return;
}
if (updateObject instanceof Node) {
// opened job
Node node = (Node) updateObject;
boolean update = false;
// added by wzhang for bug 9302
boolean isXsdPath = false;
Object parameter = result.getParameter();
IElementParameter curPropertyParam = null;
//$NON-NLS-1$
String parentParamName = "PROPERTY";
ConnectionItem connectionItem = null;
if (parameter instanceof ConnectionItem) {
if (parameter instanceof XmlFileConnectionItem) {
String filePath = ((XmlFileConnection) ((XmlFileConnectionItem) parameter).getConnection()).getXmlFilePath();
if (filePath != null) {
if (XmlUtil.isXSDFile(filePath)) {
isXsdPath = true;
}
}
}
connectionItem = (ConnectionItem) result.getParameter();
for (IElementParameter param : node.getElementParameters()) {
if (param.getFieldType() == EParameterFieldType.PROPERTY_TYPE && param.getChildParameters().get(EParameterName.REPOSITORY_PROPERTY_TYPE.getName()).getValue().equals(connectionItem.getProperty().getId())) {
curPropertyParam = param;
parentParamName = curPropertyParam.getName();
if (connectionItem != null) {
ConnectionContextHelper.addContextForNodeParameter(node, connectionItem, false);
}
break;
}
}
}
if (result.getResultType() == EUpdateResult.UPDATE) {
// upgrade from repository
if (result.isChecked() && connectionItem != null) {
List<? extends IElementParameter> elemParameters = new ArrayList<>(node.getElementParameters());
for (IElementParameter param : elemParameters) {
String repositoryValue = param.getRepositoryValue();
if (param.getRepositoryValue() == null || (curPropertyParam != null && param.getRepositoryProperty() != null && !param.getRepositoryProperty().equals(curPropertyParam.getName()))) {
continue;
}
if (param.getFieldType() == EParameterFieldType.PROPERTY_TYPE) {
continue;
}
if ((repositoryValue != null) && (param.isShow(node.getElementParameters()) || node.getComponentProperties() != null || (node instanceof INode && ((INode) node).getComponent().getName().equals("tAdvancedFileOutputXML")) || (node instanceof INode && ((INode) node).getComponent().getName().equals("tESBProviderRequest")))) {
//$NON-NLS-1$
if (param.getName().equals(EParameterName.PROPERTY_TYPE.getName()) || param.getFieldType() == EParameterFieldType.MEMO_SQL) {
continue;
}
if (param.getFieldType().equals(EParameterFieldType.FILE) && isXsdPath) {
continue;
}
IMetadataTable table = null;
if (!node.getMetadataList().isEmpty()) {
table = node.getMetadataList().get(0);
}
Object objectValue = RepositoryToComponentProperty.getValue(connectionItem.getConnection(), repositoryValue, table);
if (objectValue == null || "".equals(objectValue)) {
if (GlobalServiceRegister.getDefault().isServiceRegistered(IESBService.class)) {
IESBService service = (IESBService) GlobalServiceRegister.getDefault().getService(IESBService.class);
if (service != null) {
String propertyValue = (String) node.getPropertyValue(EParameterName.REPOSITORY_PROPERTY_TYPE.getName());
if (node.getComponent().getName().startsWith("tESB")) {
if (propertyValue.contains(" - ")) {
propertyValue = propertyValue.split(" - ")[0];
}
}
IRepositoryViewObject lastVersion = UpdateRepositoryUtils.getRepositoryObjectById(propertyValue);
if (lastVersion != null) {
Item item = lastVersion.getProperty().getItem();
if (item != null) {
Object objectValueFromESB = service.getValue(item, repositoryValue, node);
if (objectValueFromESB != null) {
objectValue = objectValueFromESB;
}
}
}
}
}
}
if (param.getName().equals(EParameterName.CDC_TYPE_MODE.getName())) {
//
String propertyValue = (String) node.getPropertyValue(EParameterName.REPOSITORY_PROPERTY_TYPE.getName());
Item item = null;
IRepositoryViewObject lastVersion = UpdateRepositoryUtils.getRepositoryObjectById(propertyValue);
if (lastVersion != null) {
item = lastVersion.getProperty().getItem();
}
if (item != null && PluginChecker.isCDCPluginLoaded()) {
ICDCProviderService service = (ICDCProviderService) GlobalServiceRegister.getDefault().getService(ICDCProviderService.class);
if (service != null) {
try {
List<IRepositoryViewObject> all;
all = CorePlugin.getDefault().getProxyRepositoryFactory().getAll(ERepositoryObjectType.METADATA_CONNECTIONS);
for (IRepositoryViewObject obj : all) {
Item tempItem = obj.getProperty().getItem();
if (tempItem instanceof DatabaseConnectionItem) {
String cdcLinkId = service.getCDCConnectionLinkId((DatabaseConnectionItem) tempItem);
if (cdcLinkId != null && item.getProperty().getId().equals(cdcLinkId)) {
objectValue = RepositoryToComponentProperty.getValue(((DatabaseConnectionItem) tempItem).getConnection(), repositoryValue, node.getMetadataList().get(0));
}
}
}
} catch (PersistenceException e) {
ExceptionHandler.process(e);
}
}
}
}
if (GlobalServiceRegister.getDefault().isServiceRegistered(IJsonFileService.class)) {
IJsonFileService jsonService = (IJsonFileService) GlobalServiceRegister.getDefault().getService(IJsonFileService.class);
boolean paramChanged = jsonService.changeFilePathFromRepository(connectionItem.getConnection(), param, node, objectValue);
if (paramChanged) {
continue;
}
}
if (objectValue != null) {
if (param.getFieldType().equals(EParameterFieldType.CLOSED_LIST) && repositoryValue.equals(UpdatesConstants.TYPE)) {
boolean found = false;
String[] items = param.getListRepositoryItems();
for (int i = 0; (i < items.length) && (!found); i++) {
if (objectValue.equals(items[i])) {
found = true;
node.setPropertyValue(param.getName(), param.getListItemsValue()[i]);
}
}
} else {
// update tFileInputExcel job
if (param.getFieldType().equals(EParameterFieldType.TABLE)) {
String name = param.getName();
if (name.equals("ROOT") || name.equals("LOOP") || name.equals("GROUP") && objectValue instanceof List) {
param.setValue(objectValue);
} else if (param.getName().equals("SHEETLIST") && objectValue instanceof List) {
List<Map<String, Object>> paramMaps = (List<Map<String, Object>>) param.getValue();
if (paramMaps == null) {
paramMaps = new ArrayList<Map<String, Object>>();
node.setPropertyValue(param.getName(), paramMaps);
} else {
// hywang add for 9537
List<Map<String, Object>> objectValueList = (List<Map<String, Object>>) objectValue;
if (paramMaps.size() < objectValueList.size()) {
paramMaps.clear();
for (int i = 0; i < objectValueList.size(); i++) {
Map<String, Object> map = objectValueList.get(i);
paramMaps.add(map);
}
} else {
String value = null;
List<String> repNames = new ArrayList<String>();
for (int i = 0; i < objectValueList.size(); i++) {
repNames.add(objectValueList.get(i).get("SHEETNAME").toString());
}
for (int j = 0; j < paramMaps.size(); j++) {
Map<String, Object> map = paramMaps.get(j);
value = map.get("SHEETNAME").toString();
if (!repNames.contains(value)) {
paramMaps.remove(j);
}
}
}
}
} else if ((name.equals("HADOOP_ADVANCED_PROPERTIES") || name.equals("ADVANCED_PROPERTIES") || name.equals("HBASE_PARAMETERS") || name.equals("SAP_PROPERTIES") && objectValue instanceof List)) {
List<HashMap<String, Object>> oldValue = (List<HashMap<String, Object>>) param.getValue();
for (HashMap<String, Object> map : oldValue) {
if (map.get("BUILDIN") != null && !map.get("BUILDIN").equals("") && Boolean.valueOf(String.valueOf(map.get("BUILDIN")))) {
((List<HashMap<String, Object>>) objectValue).add(map);
}
}
param.setValue(objectValue);
} else // it in jobs
if (param.getName().equals("DRIVER_JAR") && objectValue instanceof List) {
param.setValue(objectValue);
}
} else {
node.setPropertyValue(param.getName(), objectValue);
}
}
} else if (param.getFieldType().equals(EParameterFieldType.TABLE) && UpdatesConstants.XML_MAPPING.equals(repositoryValue)) {
RepositoryToComponentProperty.getTableXMLMappingValue(connectionItem.getConnection(), (List<Map<String, Object>>) param.getValue(), node);
} else if (param.getFieldType().equals(EParameterFieldType.TABLE) && param.getName().equals("PARAMS")) {
objectValue = RepositoryToComponentProperty.getValue(connectionItem.getConnection(), "PARAMS", node.getMetadataList().get(0));
List<Map<String, Object>> paramMaps = (List<Map<String, Object>>) param.getValue();
if (paramMaps == null) {
paramMaps = new ArrayList<Map<String, Object>>();
} else {
paramMaps.clear();
}
if (objectValue != null) {
List<String> objectValueList = (List<String>) objectValue;
for (int i = 0; i < objectValueList.size(); i++) {
Map<String, Object> map = new HashedMap();
map.put("VALUE", TalendTextUtils.addQuotes(objectValueList.get(i)));
paramMaps.add(map);
}
}
} else if (node.getComponentProperties() != null && objectValue == null) {
// for new framework, still save the null value in component
node.setPropertyValue(param.getName(), objectValue);
}
if (!("tMDMReceive".equals(node.getComponent().getName()) && "XPATH_PREFIX".equals(//$NON-NLS-1$ //$NON-NLS-2$
param.getRepositoryValue()))) {
param.setRepositoryValueUsed(true);
param.setReadOnly(true);
update = true;
}
}
}
} else {
// Added TDQ-11688 20170309 yyin
ITDQPatternService service = null;
if (GlobalServiceRegister.getDefault().isServiceRegistered(ITDQPatternService.class)) {
service = (ITDQPatternService) GlobalServiceRegister.getDefault().getService(ITDQPatternService.class);
}
if (service != null && (service.isSinglePatternNode(node) || service.isMultiPatternNode(node)) && parameter != null && parameter instanceof IElementParameter) {
IElementParameter elementParameter = node.getElementParameter(((IElementParameter) parameter).getName());
if (elementParameter != null && !elementParameter.getValue().equals(((IElementParameter) parameter).getValue())) {
elementParameter.setValue(((IElementParameter) parameter).getValue());
}
update = true;
Object regexValue = null;
Object parameterValue = ((IElementParameter) parameter).getValue();
if ("PATTERN_REGEX".equals(((IElementParameter) parameter).getName())) {
regexValue = parameterValue;
} else if ("SCHEMA_PATTERN_CHECK".equals(((IElementParameter) parameter).getName())) {
List<Map<String, String>> multiPatternList = ((List<Map<String, String>>) parameterValue);
for (Map<String, String> patternMap : multiPatternList) {
regexValue = patternMap.get("PATTERN_REGEX");
if (regexValue == null) {
patternMap.put("PATTERN_PROPERTY", EmfComponent.BUILTIN);
}
}
}
if (regexValue == null || regexValue.toString().isEmpty()) {
update = false;
}
}
}
}
if (!update) {
// bult-in
String propertyName = parentParamName + ":" + EParameterName.PROPERTY_TYPE.getName();
if (this.result.getParameter() instanceof IElementParameter) {
IElementParameter parentParam = ((IElementParameter) this.result.getParameter()).getParentParameter();
if (parentParam != null) {
parentParamName = parentParam.getName();
propertyName = parentParam.getName() + ":" + parentParam.getChildParameters().get(EParameterName.PROPERTY_TYPE.getName()).getName();
}
}
node.setPropertyValue(propertyName, EmfComponent.BUILTIN);
for (IElementParameter param : node.getElementParameters()) {
if (param.getRepositoryValue() == null || param.getRepositoryProperty() != null && !param.getRepositoryProperty().equals(parentParamName)) {
continue;
}
if (param.getFieldType() == EParameterFieldType.PROPERTY_TYPE) {
continue;
}
if (param.isShow(node.getElementParameters())) {
if (param.getName().equals(EParameterName.PROPERTY_TYPE.getName()) || param.getFieldType() == EParameterFieldType.MEMO_SQL) {
continue;
}
param.setRepositoryValueUsed(false);
param.setReadOnly(false);
}
}
}
}
}
use of org.talend.core.model.properties.DatabaseConnectionItem in project tdi-studio-se by Talend.
the class AbstractJobSettingsPage method updateProjectSetting.
public void updateProjectSetting() {
String[] split = getRepositoryPropertyName().split(":");
String parentParamName = split[0];
Element elementParams = elem;
IElementParameter elementParameter = elementParams.getElementParameter(parentParamName);
if (elementParameter != null && elementParameter.isShow(elem.getElementParameters()) && elementParameter.getChildParameters() != null) {
if (elementParameter.getChildParameters().get("PROPERTY_TYPE") != null && !EmfComponent.BUILTIN.equals(elementParameter.getChildParameters().get("PROPERTY_TYPE").getValue())) {
DatabaseConnection connection = null;
String id = (String) elementParameter.getChildParameters().get("REPOSITORY_PROPERTY_TYPE").getValue();
IRepositoryViewObject lastVersion = UpdateRepositoryUtils.getRepositoryObjectById(id);
if (lastVersion != null && lastVersion.getProperty() != null) {
Item item = lastVersion.getProperty().getItem();
if (item instanceof DatabaseConnectionItem) {
DatabaseConnectionItem dbItem = (DatabaseConnectionItem) item;
connection = (DatabaseConnection) dbItem.getConnection();
}
}
if (connection != null) {
boolean sameValues = true;
for (IElementParameter param : elementParams.getElementParameters()) {
String repositoryValue = param.getRepositoryValue();
if (param.isShow(elementParams.getElementParameters()) && repositoryValue != null && !param.getName().equals("PROPERTY_TYPE")) {
Object repValue = RepositoryToComponentProperty.getValue(connection, repositoryValue, null);
if (repValue == null) {
continue;
}
if (repositoryValue.equals(UpdatesConstants.TYPE)) {
// datebase type
boolean found = false;
String[] list = param.getListRepositoryItems();
for (int i = 0; (i < list.length) && (!found); i++) {
if (repValue.equals(list[i])) {
found = true;
}
}
if (!found) {
sameValues = false;
break;
}
} else {
// check the value
if (!param.getValue().equals(repValue)) {
sameValues = false;
break;
}
}
}
}
if (!sameValues) {
boolean ok = MessageDialog.openQuestion(getShell(), getDisplayName(), "Connection has been changed , do you want to change value from repository ?");
if (ok) {
ChangeValuesFromRepository changeValuesFromRepository = new ChangeValuesFromRepository(elem, connection, getRepositoryPropertyName(), id);
changeValuesFromRepository.execute();
isConnectionChanged = true;
}
}
} else {
MessageDialog.openInformation(getShell(), getDisplayName(), "Connection has been deleted ,change to build in automaticlly");
ChangeValuesFromRepository changeValuesFromRepository1 = new ChangeValuesFromRepository(elem, null, getPropertyTypeName(), EmfComponent.BUILTIN);
changeValuesFromRepository1.execute();
isConnectionChanged = true;
}
}
}
}
use of org.talend.core.model.properties.DatabaseConnectionItem in project tdi-studio-se by Talend.
the class FillParametersForDatabaseConnectionMigrationTask method execute.
@Override
public ExecutionResult execute(Item item) {
if (item instanceof DatabaseConnectionItem) {
DatabaseConnectionItem dbItem = (DatabaseConnectionItem) item;
Connection connection = dbItem.getConnection();
DatabaseConnection dbconn = (DatabaseConnection) connection;
EList<orgomg.cwm.objectmodel.core.Package> pkgs = dbconn.getDataPackage();
// get all tdtables and set sqldatatype
fillParametersForColumns(pkgs);
dbconn.setName(dbItem.getProperty().getLabel());
try {
factory.save(dbItem, true);
return ExecutionResult.SUCCESS_WITH_ALERT;
} catch (PersistenceException e) {
ExceptionHandler.process(e);
return ExecutionResult.FAILURE;
}
}
return ExecutionResult.SUCCESS_NO_ALERT;
}
use of org.talend.core.model.properties.DatabaseConnectionItem in project tdi-studio-se by Talend.
the class QueryGuessCommand method generateNewQuery.
private String generateNewQuery() {
// used for generating new Query.
ExtractMetaDataUtils extractMeta = ExtractMetaDataUtils.getInstance();
if (realDBType != null) {
dbType = realDBType;
}
//
if (node != null && node instanceof INode) {
process = ((INode) node).getProcess();
}
if (this.realTableId != null && this.dbNameAndDbTypeMap.containsKey(this.realTableId)) {
dbType = this.dbNameAndDbTypeMap.get(this.realTableId);
}
if (dbType == null || dbType.equals("")) {
//$NON-NLS-1$
IElementParameter ptParam = node.getElementParameterFromField(EParameterFieldType.PROPERTY_TYPE);
if (ptParam != null && ptParam.getRepositoryValue() != null) {
if (ptParam.getRepositoryValue().endsWith(EDatabaseTypeName.GENERAL_JDBC.getProduct())) {
dbType = EDatabaseTypeName.GENERAL_JDBC.getDisplayName();
}
}
}
boolean isJdbc = false;
INode connectionNode = null;
IElementParameter existConnection = node.getElementParameter("USE_EXISTING_CONNECTION");
boolean useExistConnection = (existConnection == null ? false : (Boolean) existConnection.getValue());
if (useExistConnection) {
IElementParameter connector = node.getElementParameter("CONNECTION");
if (connector != null) {
String connectorValue = connector.getValue().toString();
List<? extends INode> graphicalNodes = process.getGeneratingNodes();
for (INode node : graphicalNodes) {
if (node.getUniqueName().equals(connectorValue)) {
connectionNode = node;
break;
}
}
}
}
// hywang add for bug 7575
if (dbType != null && dbType.equals(EDatabaseTypeName.GENERAL_JDBC.getDisplayName())) {
isJdbc = true;
String driverClassName = node.getElementParameter("DRIVER_CLASS").getValue().toString();
if (connectionNode != null) {
driverClassName = connectionNode.getElementParameter("DRIVER_CLASS").getValue().toString();
}
driverClassName = TalendTextUtils.removeQuotes(driverClassName);
//
if (driverClassName != null && !"".equals(driverClassName)) {
boolean isContextModeDriverClass = ContextParameterUtils.containContextVariables(driverClassName);
if (isContextModeDriverClass) {
driverClassName = JavaProcessUtil.getContextOriginalValue(process, driverClassName);
}
}
// specil handle Sybase Database's driverClassName
if (driverClassName != null && !"".equals(driverClassName)) {
if (driverClassName.equals("com.sybase.jdbc3.jdbc.SybDataSource")) {
driverClassName = EDatabase4DriverClassName.SYBASEASE.getDriverClass();
}
}
// DRIVER_JAR:
String driverJarName = node.getElementParameter("DRIVER_JAR").getValue().toString();
if (connectionNode != null) {
driverJarName = connectionNode.getElementParameter("DRIVER_JAR").getValue().toString();
}
if (driverJarName != null && driverJarName.startsWith("[") && driverJarName.endsWith("]")) {
driverJarName = driverJarName.substring(1, driverJarName.length() - 1);
if (driverJarName != null && driverJarName.startsWith("{") && driverJarName.endsWith("}")) {
driverJarName = driverJarName.substring(1, driverJarName.length() - 1);
}
}
if (driverJarName != null && !"".equals(driverJarName)) {
boolean isContextMode = ContextParameterUtils.containContextVariables(driverJarName);
if (isContextMode) {
driverJarName = JavaProcessUtil.getContextOriginalValue(process, driverJarName);
}
dbType = extractMeta.getDbTypeByClassNameAndDriverJar(driverClassName, driverJarName);
} else {
dbType = extractMeta.getDbTypeByClassName(driverClassName);
}
DatabaseConnection dbConn = null;
if (dbType == null) {
// handle context mode
if (conn != null) {
if (conn instanceof DatabaseConnection) {
dbConn = (DatabaseConnection) conn;
}
driverClassName = DatabaseConnectionParameterUtil.getTrueParamValue(dbConn, driverClassName);
dbType = extractMeta.getDbTypeByClassName(driverClassName);
}
}
if (dbType == null) {
// if we can not get the DB Type from the existing driver list, just set back the type to ORACLE
// since it's one DB unknown from Talend.
// it might not work directly for all DB, but it will generate a standard query.
dbType = EDatabaseTypeName.ORACLE_OCI.getDisplayName();
}
// data view, conn=null
// need add code here for dbtype(oracle)
}
if (dbNameAndSchemaMap != null) {
schema = this.dbNameAndSchemaMap.get(this.realTableId);
}
String propertyType = (String) node.getPropertyValue(EParameterName.PROPERTY_TYPE.getName());
boolean isTeradata = false;
if (dbType != null) {
isTeradata = dbType.equalsIgnoreCase(EDatabaseTypeName.TERADATA.getDisplayName());
}
if (propertyType != null && !propertyType.equals(EmfComponent.REPOSITORY)) {
List<? extends IElementParameter> elementParameters = this.node.getElementParameters();
if (useExistConnection) {
elementParameters = connectionNode.getElementParameters();
}
for (IElementParameter param : elementParameters) {
if (param.getRepositoryValue() != null) {
if (//$NON-NLS-1$
(!isTeradata && param.getRepositoryValue().equals("SCHEMA")) || (isTeradata && param.getRepositoryValue().equals("SID"))) {
// check if dbtype is //$NON-NLS-1$
// Teradata, always keep the
// query style like
// "dbname.tablename.columnname" on build-in mode
schema = (String) param.getValue();
//$NON-NLS-1$ //$NON-NLS-2$
schema = schema.replace("\"", "");
//$NON-NLS-1$ //$NON-NLS-2$
schema = schema.replace("\'", "");
break;
}
}
}
} else if (schema == null) {
IElementParameter param = node.getElementParameter(EParameterName.REPOSITORY_PROPERTY_TYPE.getName());
if (param != null) {
try {
IRepositoryViewObject object = DesignerPlugin.getDefault().getRepositoryService().getProxyRepositoryFactory().getLastVersion((String) param.getValue());
if (object != null) {
Item item = object.getProperty().getItem();
if (item != null && item instanceof DatabaseConnectionItem) {
if (isTeradata) {
schema = (String) RepositoryToComponentProperty.getValue(((DatabaseConnectionItem) item).getConnection(), "SID", //$NON-NLS-1$
null);
} else {
schema = (String) RepositoryToComponentProperty.getValue(((DatabaseConnectionItem) item).getConnection(), "SCHEMA", //$NON-NLS-1$
null);
}
schema = TalendTextUtils.removeQuotes(schema);
}
}
} catch (PersistenceException e) {
//
}
}
}
// if (conn instanceof DatabaseConnection && conn.isContextMode()) {
// schema = DatabaseConnectionParameterUtil.getContextTrueValue((DatabaseConnection) conn, schema);
// }
String newQuery = null;
realTableName = QueryUtil.getTableName(node, newOutputMetadataTable, schema, dbType, realTableName);
if (realTableName.startsWith(TalendTextUtils.QUOTATION_MARK) && realTableName.endsWith(TalendTextUtils.QUOTATION_MARK) && realTableName.length() > 2) {
realTableName = realTableName.substring(1, realTableName.length() - 1);
}
if (conn != null && (isJdbc || dbType.equals(EDatabaseTypeName.JAVADB_EMBEDED.getDisplayName()) || (StringUtils.isEmpty(schema) && (EDatabaseTypeName.ORACLE_CUSTOM.equals(EDatabaseTypeName.getTypeFromDbType(dbType)) || EDatabaseTypeName.ORACLEFORSID.equals(EDatabaseTypeName.getTypeFromDbType(dbType)) || EDatabaseTypeName.ORACLESN.equals(EDatabaseTypeName.getTypeFromDbType(dbType)) || EDatabaseTypeName.ORACLE_OCI.equals(EDatabaseTypeName.getTypeFromDbType(dbType)))))) {
schema = getDefaultSchema(realTableName);
}
newQuery = QueryUtil.generateNewQuery(node, newOutputMetadataTable, isJdbc, dbType, schema, realTableName);
// Added yyin TDQ-5616: if there are where clause, append it to the query
if (whereClause != null) {
// the where clause is inputted by the user, so no need to modify it.
//$NON-NLS-1$
newQuery = newQuery.substring(0, newQuery.length() - 1) + whereClause + "\"";
}
return TalendTextUtils.addSQLQuotes(newQuery);
}
Aggregations