use of orgomg.cwm.resource.relational.ColumnSet in project tdq-studio-se by Talend.
the class AbstractComparisonLevel method upperCase.
private void upperCase(EObject eObject) {
Package pckg = SwitchHelpers.PACKAGE_SWITCH.doSwitch(eObject);
ColumnSet columnSet = SwitchHelpers.COLUMN_SET_SWITCH.doSwitch(eObject);
TdColumn column = SwitchHelpers.COLUMN_SWITCH.doSwitch(eObject);
if (column != null) {
// $NON-NLS-1$
column.setName(column.getName() == null ? "" : column.getName().toUpperCase());
// $NON-NLS-1$
column.setLabel(column.getLabel() == null ? "" : column.getLabel().toUpperCase());
column.getSqlDataType().setName(// $NON-NLS-1$
column.getSqlDataType().getName() == null ? "" : column.getSqlDataType().getName().toUpperCase());
// $NON-NLS-1$
column.setContentType(column.getContentType() == null ? "" : column.getContentType().toUpperCase());
// $NON-NLS-1$
column.setSourceType(column.getSourceType() == null ? "" : column.getSourceType().toUpperCase());
} else if (pckg != null) {
// $NON-NLS-1$
pckg.setName(pckg.getName() == null ? "" : pckg.getName().toUpperCase());
} else if (columnSet != null) {
// $NON-NLS-1$
columnSet.setName(columnSet.getName() == null ? "" : columnSet.getName().toUpperCase());
}
}
use of orgomg.cwm.resource.relational.ColumnSet 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 orgomg.cwm.resource.relational.ColumnSet 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 orgomg.cwm.resource.relational.ColumnSet 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 orgomg.cwm.resource.relational.ColumnSet in project tdq-studio-se by Talend.
the class UpdateRelationalSwitch method caseForeignKey.
@Override
public Boolean caseForeignKey(ForeignKey object) {
ColumnSet columnSet = (ColumnSet) object.eContainer();
if (columnSet == null) {
return Boolean.FALSE;
}
ForeignKey rightColumn = null;
if (rightElement instanceof ForeignKey) {
rightColumn = (ForeignKey) rightElement;
} else {
return Boolean.FALSE;
}
object.setName(rightColumn.getName());
object.getFeature().clear();
List<StructuralFeature> refColumns = new ArrayList<StructuralFeature>();
for (StructuralFeature newColumn : rightColumn.getFeature()) {
for (Feature column : columnSet.getFeature()) {
if (column.getName().equalsIgnoreCase(newColumn.getName())) {
refColumns.add((StructuralFeature) column);
break;
}
}
}
object.getFeature().addAll(refColumns);
return Boolean.TRUE;
}
Aggregations