use of orgomg.cwm.resource.relational.ColumnSet in project tdq-studio-se by Talend.
the class TableViewComparisonLevel method findDataProvider.
@Override
protected Connection findDataProvider() {
Connection provider = null;
if (selectedObj instanceof DBColumnFolderRepNode) {
DBColumnFolderRepNode columnFolderRepNode = (DBColumnFolderRepNode) selectedObj;
ColumnSet columnSet = columnFolderRepNode.getColumnSet();
if (columnSet != null) {
Package parentCatalogOrSchema = ColumnSetHelper.getParentCatalogOrSchema(columnSet);
provider = ConnectionHelper.getTdDataProvider(parentCatalogOrSchema);
}
} else if (selectedObj instanceof RepositoryNode) {
Item connItem = ((RepositoryNode) selectedObj).getObject().getProperty().getItem();
provider = ((ConnectionItem) connItem).getConnection();
} else {
ColumnSet columnSet = (ColumnSet) selectedObj;
Package parentCatalogOrSchema = ColumnSetHelper.getParentCatalogOrSchema(columnSet);
provider = ConnectionHelper.getTdDataProvider(parentCatalogOrSchema);
}
return provider;
}
use of orgomg.cwm.resource.relational.ColumnSet in project tdq-studio-se by Talend.
the class TableViewComparisonLevel method getRightResource.
@Override
protected Resource getRightResource() throws ReloadCompareException {
ColumnSet selectedColumnSet = null;
if (selectedObj instanceof RepositoryNode) {
selectedColumnSet = (ColumnSet) RepositoryNodeHelper.getMetadataElement((RepositoryNode) selectedObj);
} else if (selectedObj instanceof DBColumnFolderRepNode) {
DBColumnFolderRepNode columnFolderRepNode = (DBColumnFolderRepNode) selectedObj;
selectedColumnSet = columnFolderRepNode.getColumnSet();
} else {
selectedColumnSet = (ColumnSet) selectedObj;
}
ColumnSet findMatchedColumnSet = DQStructureComparer.findMatchedColumnSet(selectedColumnSet, tempReloadProvider);
List<TdColumn> columns = null;
try {
// MOD scorreia 2009-01-29 clear content of findMatchedColumnSet
ColumnSetHelper.setColumns(findMatchedColumnSet, EMPTY_COLUMN_LIST);
columns = DqRepositoryViewService.getColumns(tempReloadProvider, findMatchedColumnSet, true);
} catch (Exception e1) {
throw new ReloadCompareException(e1);
}
// MOD scorreia 2009-01-29 columns are stored in the table
// ColumnSetHelper.addColumns(findMatchedColumnSet, columns);
URI uri = tempReloadProvider.eResource().getURI();
Resource rightResource = null;
rightResource = EMFSharedResources.getInstance().getResource(uri, true);
if (rightResource == null) {
// $NON-NLS-1$
throw new ReloadCompareException(DefaultMessagesImpl.getString("TableViewComparisonLevel.NoFactoryFoundForURI", uri));
}
rightResource.getContents().clear();
for (TdColumn column : columns) {
DQStructureComparer.clearSubNode(column);
rightResource.getContents().add(column);
}
EMFSharedResources.getInstance().saveResource(rightResource);
return upperCaseResource(rightResource);
}
use of orgomg.cwm.resource.relational.ColumnSet in project tdq-studio-se by Talend.
the class TableViewComparisonLevel method getSavedReloadObject.
@Override
protected EObject getSavedReloadObject() throws ReloadCompareException {
ColumnSet selectedColumnSet = getCurrentColumnSet();
ColumnSet toReloadcolumnSet = DQStructureComparer.findMatchedColumnSet(selectedColumnSet, tempReloadProvider);
// ADD TDQ-11146 msjian: to save the TaggedValues before clear
if (PluginChecker.isTDQLoaded()) {
tmpConceptName = TaggedValueHelper.getValueString(TaggedValueHelper.CONCEPT_NAME, toReloadcolumnSet);
EList<Feature> feature = toReloadcolumnSet.getFeature();
tmpTaggedValuesMap = new HashMap<String, String[]>();
for (Feature fea : feature) {
String[] values = new String[] { StringUtils.EMPTY, StringUtils.EMPTY };
values[0] = TaggedValueHelper.getValueString(TaggedValueHelper.SEMANTIC_NAME, fea);
values[1] = TaggedValueHelper.getValueString(TaggedValueHelper.CONTENT_TYPE, fea);
if (StringUtils.isNotBlank(values[0]) || StringUtils.isNotBlank(values[1])) {
tmpTaggedValuesMap.put(fea.getName(), values);
}
}
}
// TDQ-11146~
// MOD scorreia 2009-01-29 clear content of findMatchedColumnSet
ColumnSetHelper.setColumns(toReloadcolumnSet, EMPTY_COLUMN_LIST);
toReloadcolumnSet.getOwnedElement().clear();
try {
DqRepositoryViewService.getColumns(tempReloadProvider, toReloadcolumnSet, true);
// MOD mzhao 2009-11-12 save to resoure after reload.
util.saveResource(toReloadcolumnSet.eResource());
} catch (Exception e1) {
throw new ReloadCompareException(e1);
}
// ColumnSetHelper.setColumns(toReloadcolumnSet, columns);
return toReloadcolumnSet;
}
use of orgomg.cwm.resource.relational.ColumnSet in project tdq-studio-se by Talend.
the class TableViewComparisonLevel method getCurrentColumnSet.
/**
* DOC msjian Comment method "getCurrentColumnSet".
*
* @return
*/
private ColumnSet getCurrentColumnSet() {
ColumnSet columnSet = null;
if (selectedObj instanceof DBColumnFolderRepNode) {
DBColumnFolderRepNode columnFolderRepNode = (DBColumnFolderRepNode) selectedObj;
columnSet = columnFolderRepNode.getColumnSet();
} else if (selectedObj instanceof ColumnSet) {
columnSet = (ColumnSet) selectedObj;
}
return columnSet;
}
use of orgomg.cwm.resource.relational.ColumnSet in project tdq-studio-se by Talend.
the class RenameComparedElementAction method getLeftResource.
// private void getDiffElements(DiffElement diffEle, List<DiffElement> diffElementList) {
// if (diffEle instanceof DiffGroup) {
// for (DiffElement subDiffEle : ((DiffGroup) diffEle).getSubDiffElements()) {
// getDiffElements(subDiffEle, diffElementList);
// }
// } else {
// diffElementList.add(diffEle);
// }
// }
private Resource getLeftResource() throws ReloadCompareException {
ColumnSet selectedColumnSet = (ColumnSet) theSelectedElement;
Connection copyedDataProvider = createCopyedProvider();
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 leftResource;
}
Aggregations