use of org.talend.cwm.relational.TdColumn in project tdq-studio-se by Talend.
the class TableViewComparisonLevel method getLeftResource.
@Override
protected Resource getLeftResource() throws ReloadCompareException {
ColumnSet selectedColumnSet = null;
if (selectedObj instanceof DBColumnFolderRepNode) {
DBColumnFolderRepNode columnFolderRepNode = (DBColumnFolderRepNode) selectedObj;
selectedColumnSet = columnFolderRepNode.getColumnSet();
} else if (selectedObj instanceof RepositoryNode) {
selectedColumnSet = (ColumnSet) RepositoryNodeHelper.getMetadataElement((RepositoryNode) selectedObj);
} else {
selectedColumnSet = (ColumnSet) selectedObj;
}
ColumnSet findMatchedColumnSet = DQStructureComparer.findMatchedColumnSet(selectedColumnSet, copyedDataProvider);
List<TdColumn> columnList = new ArrayList<TdColumn>();
columnList.addAll(ColumnSetHelper.getColumns(findMatchedColumnSet));
Resource leftResource = copyedDataProvider.eResource();
leftResource.getContents().clear();
for (TdColumn column : columnList) {
DQStructureComparer.clearSubNode(column);
leftResource.getContents().add(column);
}
EMFSharedResources.getInstance().saveResource(leftResource);
return upperCaseResource(leftResource);
}
use of org.talend.cwm.relational.TdColumn in project tdq-studio-se by Talend.
the class RemoveTdRelationalSwitch method casePrimaryKey.
@Override
public Boolean casePrimaryKey(PrimaryKey object) {
ColumnSet columnSet = (ColumnSet) object.eContainer();
if (columnSet == null) {
return Boolean.FALSE;
}
// MOD zshen 2010.06.10 for feature 12842
TdColumn column = null;
if (leftElement instanceof TdColumn) {
column = (TdColumn) leftElement;
} else {
return Boolean.FALSE;
}
if (object.getFeature().size() <= 1) {
columnSet.getOwnedElement().remove(object);
} else {
object.getFeature().remove(column);
}
column.getUniqueKey().remove(object);
return Boolean.TRUE;
}
use of org.talend.cwm.relational.TdColumn in project tdq-studio-se by Talend.
the class RemoveTdRelationalSwitch method caseForeignKey.
@Override
public Boolean caseForeignKey(ForeignKey object) {
ColumnSet columnSet = (ColumnSet) object.eContainer();
if (columnSet == null) {
return Boolean.FALSE;
}
// MOD zshen 2010.06.10 for feature 12842
TdColumn column = null;
if (leftElement instanceof TdColumn) {
column = (TdColumn) leftElement;
} else {
return Boolean.FALSE;
}
if (object.getFeature().size() <= 1) {
columnSet.getOwnedElement().remove(object);
} else {
object.getFeature().remove(column);
}
column.getKeyRelationship().remove(object);
return Boolean.TRUE;
}
use of org.talend.cwm.relational.TdColumn in project tdq-studio-se by Talend.
the class ColumnDependencyExplorer method getDetailedInvalidValuesStatement.
private String getDetailedInvalidValuesStatement() {
// MOD by zshen fixed 12039 to distinguish the same name of column.
String genericSQL = dbmsLanguage.getFDGenericInvalidDetailedValues();
ColumnDependencyIndicator cdIndicator = ((ColumnDependencyIndicator) this.indicator);
TdColumn columnA = cdIndicator.getColumnA();
TdColumn columnB = cdIndicator.getColumnB();
if (columnA.getName().equals(columnB.getName())) {
genericSQL = genericSQL.replaceFirst(GenericSQLHandler.COLUMN_NAMES_A, // $NON-NLS-1$
dbmsLanguage.quote(columnA.getName()) + " AS " + columnA.getName() + // $NON-NLS-1$
"_A");
genericSQL = genericSQL.replaceFirst(GenericSQLHandler.COLUMN_NAMES_B, // $NON-NLS-1$
dbmsLanguage.quote(columnB.getName()) + " AS " + columnA.getName() + // $NON-NLS-1$
"_B");
}
return getStatement(genericSQL);
}
use of org.talend.cwm.relational.TdColumn in project tdq-studio-se by Talend.
the class ColumnDependencyExplorer method getDetailedValidValuesStatement.
private String getDetailedValidValuesStatement() {
// MOD by zshen fixed 12039 to distinguish the same name of column.
String genericSQL = dbmsLanguage.getFDGenericValidDetailedValues();
ColumnDependencyIndicator cdIndicator = ((ColumnDependencyIndicator) this.indicator);
TdColumn columnA = cdIndicator.getColumnA();
TdColumn columnB = cdIndicator.getColumnB();
if (columnA.getName().equals(columnB.getName())) {
genericSQL = genericSQL.replaceFirst(GenericSQLHandler.COLUMN_NAMES_A, // $NON-NLS-1$
dbmsLanguage.quote(columnA.getName()) + " AS " + columnA.getName() + // $NON-NLS-1$
"_A");
genericSQL = genericSQL.replaceFirst(GenericSQLHandler.COLUMN_NAMES_B, // $NON-NLS-1$
dbmsLanguage.quote(columnB.getName()) + " AS " + columnA.getName() + // $NON-NLS-1$
"_B");
}
return getStatement(genericSQL);
}
Aggregations