use of org.talend.cwm.compare.exception.ReloadCompareException in project tdq-studio-se by Talend.
the class AbstractComparisonLevel method createTempConnectionFile.
/**
* DOC rli Comment method "createTempConnectionFile".
*
* @throws ReloadCompareException
*/
protected IFile createTempConnectionFile() throws ReloadCompareException {
IFile tempConnectionFile = DQStructureComparer.getTempRefreshFile();
// MOD mzhao ,Extract method getRefreshedDataProvider to class
// DQStructureComparer for common use.
TypedReturnCode<Connection> returnProvider = DQStructureComparer.getRefreshedDataProvider(oldDataProvider);
if (!returnProvider.isOk()) {
throw new ReloadCompareException(returnProvider.getMessage());
}
tempReloadProvider = upperCaseConnection(returnProvider.getObject());
tempReloadProvider.setComponent(oldDataProvider.getComponent());
// MOD mzhao bug:9012 2009-09-08
ElementWriterFactory.getInstance().createDataProviderWriter().create(tempReloadProvider, tempConnectionFile.getFullPath(), false);
tempReloadProvider.setComponent(null);
oldDataProvider.getComponent();
return tempConnectionFile;
}
use of org.talend.cwm.compare.exception.ReloadCompareException in project tdq-studio-se by Talend.
the class AbstractComparisonLevel method createCopyedProvider.
@SuppressWarnings("deprecation")
protected void createCopyedProvider() throws ReloadCompareException {
IFile selectedFile = WorkspaceUtils.getModelElementResource(oldDataProvider);
IFile createNeedReloadElementsFile = DQStructureComparer.getNeedReloadElementsFile();
IFile copyedFile = DQStructureComparer.copyedToDestinationFile(selectedFile, createNeedReloadElementsFile);
TypedReturnCode<Connection> returnValue = DqRepositoryViewService.readFromFile(copyedFile);
if (returnValue.isOk()) {
copyedDataProvider = returnValue.getObject();
} else {
DQStructureComparer.deleteFile(createNeedReloadElementsFile);
throw new ReloadCompareException(returnValue.getMessage());
}
}
use of org.talend.cwm.compare.exception.ReloadCompareException 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 org.talend.cwm.compare.exception.ReloadCompareException 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 org.talend.cwm.compare.exception.ReloadCompareException in project tdq-studio-se by Talend.
the class RenameComparedElementAction method getRightResource.
private Resource getRightResource(ColumnSet selectedColumnSet) throws ReloadCompareException {
Connection tempReloadProvider = createTempConnectionFile();
Package matchedPackage = DQStructureComparer.findMatchedPackage((Package) originCompareElement, tempReloadProvider);
IFolderNode columnSetFolderNode = FolderNodeHelper.getFolderNode(matchedPackage, selectedColumnSet);
columnSetFolderNode.loadChildren();
ColumnSet findMatchedColumnSet = DQStructureComparer.findMatchedColumnSet(selectedColumnSet, tempReloadProvider);
List<TdColumn> columns = null;
try {
columns = DqRepositoryViewService.getColumns(tempReloadProvider, findMatchedColumnSet, null, true);
} catch (Exception e1) {
throw new ReloadCompareException(e1);
}
URI uri = tempReloadProvider.eResource().getURI();
Resource rightResource = null;
rightResource = EMFSharedResources.getInstance().getResource(uri, true);
if (rightResource == null) {
// $NON-NLS-1$
throw new ReloadCompareException("NoFactoryFoundForURI" + uri.toFileString());
}
rightResource.getContents().clear();
for (TdColumn column : columns) {
DQStructureComparer.clearSubNode(column);
rightResource.getContents().add(column);
}
EMFSharedResources.getInstance().saveResource(rightResource);
return rightResource;
}
Aggregations