use of org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject in project tdi-studio-se by Talend.
the class SchemaColumnNodeTester method findParentItemType.
@Override
public ERepositoryObjectType findParentItemType(RepositoryNode repositoryNode) {
final ERepositoryObjectType objectType = repositoryNode.getObjectType();
if (objectType == ERepositoryObjectType.METADATA_CON_COLUMN) {
final IRepositoryViewObject object = repositoryNode.getObject();
if (object != null && object instanceof MetadataColumnRepositoryObject) {
final MetadataColumnRepositoryObject columnObj = (MetadataColumnRepositoryObject) object;
final IRepositoryViewObject itemObj = columnObj.getViewObject();
if (itemObj != null) {
return itemObj.getRepositoryObjectType();
}
}
}
return null;
}
use of org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject in project tdi-studio-se by Talend.
the class MultiTypesProcessor method selectRepositoryNode.
protected boolean selectRepositoryNode(Viewer viewer, RepositoryNode parentNode, RepositoryNode node) {
if (node == null) {
return false;
}
IRepositoryViewObject object = node.getObject();
if (object != null) {
// column
if (object instanceof MetadataColumnRepositoryObject) {
return false;
}
}
// hide the column folder
if (object == null && node.getParent() != null && node.getParent().getObject() != null && node.getParent().getObjectType() == ERepositoryObjectType.METADATA_CON_TABLE) {
return false;
}
// cdc
ICDCProviderService cdcService = null;
if (node.getObjectType() == ERepositoryObjectType.METADATA_CON_CDC) {
return false;
}
if (isCDCConnection(node)) {
return false;
}
if (PluginChecker.isCDCPluginLoaded()) {
cdcService = (ICDCProviderService) GlobalServiceRegister.getDefault().getService(ICDCProviderService.class);
if (cdcService != null && cdcService.isSubscriberTableNode(node)) {
return false;
}
}
return true;
}
use of org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject in project tdi-studio-se by Talend.
the class ComponentChooseDialog method setSAPSpecailValueForCommand.
private void setSAPSpecailValueForCommand(RepositoryNode selectedNode, ChangeValuesFromRepository command) {
// Noted by Marvin Wang on Jun. 29, 2012. The piece of code is used to judge if the selected node is SAP
// Table node, if so, set up the table name to command.
IRepositoryViewObject object = selectedNode.getObject();
if (object instanceof MetadataColumnRepositoryObject) {
object = selectedNode.getParent().getParent().getObject();
}
SAPFunctionUnit unit = null;
if (object != null) {
if (object instanceof MetadataTableRepositoryObject) {
MetadataTableRepositoryObject tableObject = (MetadataTableRepositoryObject) object;
MetadataTable abstractMetadataObject = (MetadataTable) tableObject.getAbstractMetadataObject();
if (abstractMetadataObject != null && abstractMetadataObject.eContainer() instanceof SAPFunctionUnit) {
unit = (SAPFunctionUnit) abstractMetadataObject.eContainer();
command.setSapFunctionLabel(unit.getLabel());
// set table name to functionName/type/tablename;
String currentTableName = //$NON-NLS-1$ //$NON-NLS-2$
unit.getLabel() + "/" + abstractMetadataObject.getTableType() + "/" + abstractMetadataObject.getLabel();
command.setCurrentTableName(currentTableName);
} else if (abstractMetadataObject instanceof SAPTable) {
command.setCurrentTableName(abstractMetadataObject.getLabel());
}
} else if (object instanceof SAPFunctionRepositoryObject) {
SAPFunctionRepositoryObject sapObj = (SAPFunctionRepositoryObject) object;
unit = sapObj.getModelElement();
command.setSapFunctionLabel(unit.getLabel());
} else if (object instanceof SAPIDocRepositoryObject) {
SAPIDocRepositoryObject sapObj = (SAPIDocRepositoryObject) object;
command.setSapIDocLabel(sapObj.getLabel());
}
}
}
use of org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject in project tdi-studio-se by Talend.
the class ExportItemWizardPage method selectRepositoryNode.
protected boolean selectRepositoryNode(Viewer viewer, RepositoryNode node) {
if (node == null) {
return false;
}
IRepositoryViewObject object = node.getObject();
if (object != null) {
// column
if (object instanceof MetadataColumnRepositoryObject) {
return false;
}
if (node.getObjectType() == ERepositoryObjectType.METADATA_CON_TABLE) {
return false;
}
}
// hide the conn folder
if (object == null && node.getParent() != null && node.getParent().getObject() != null && node.getParent().getObjectType() == ERepositoryObjectType.METADATA_CONNECTIONS) {
return false;
}
// hide the generated documentation node, avoid to export .
final ERepositoryObjectType contentType = node.getContentType();
if (object == null && contentType != null && contentType.equals(ERepositoryObjectType.GENERATED)) {
return false;
}
return true;
}
use of org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject in project tdq-studio-se by Talend.
the class RedundancyAnalysisDetailsPage method canSave.
@Override
public ReturnCode canSave() {
// MOD by gdbu 2011-3-21 bug 19179
ReturnCode canModRetCode = super.canSave();
if (!canModRetCode.isOk()) {
return canModRetCode;
}
if (anaColumnCompareViewer.getColumnListA().size() != anaColumnCompareViewer.getColumnListB().size()) {
// $NON-NLS-1$
return new ReturnCode(DefaultMessagesImpl.getString("ColumnsComparisonMasterDetailsPage.columnsSameMessage"), false);
}
List<TdColumn> columnAList = new ArrayList<TdColumn>();
List<TdColumn> columnBList = new ArrayList<TdColumn>();
for (RepositoryNode rd : anaColumnCompareViewer.getColumnListA()) {
columnAList.add((TdColumn) ((MetadataColumnRepositoryObject) rd.getObject()).getTdColumn());
}
for (RepositoryNode rd : anaColumnCompareViewer.getColumnListB()) {
columnBList.add((TdColumn) ((MetadataColumnRepositoryObject) rd.getObject()).getTdColumn());
}
if (anaColumnCompareViewer.getColumnListA().size() > 0) {
if (!ColumnHelper.isFromSameTable(columnAList) || !ColumnHelper.isFromSameTable(columnBList)) {
return new ReturnCode(DefaultMessagesImpl.getString("ColumnsComparisonMasterDetailsPage.notSameElementMessage"), // $NON-NLS-1$
false);
}
for (int i = 0; i < anaColumnCompareViewer.getColumnListA().size(); i++) {
TdColumn columnA = columnAList.get(i);
TdColumn columnB = columnBList.get(i);
ColumnSet ownerA = ColumnHelper.getColumnOwnerAsColumnSet(columnA);
ColumnSet ownerB = ColumnHelper.getColumnOwnerAsColumnSet(columnB);
int typeA = columnA.getSqlDataType().getJavaDataType();
int typeB = columnB.getSqlDataType().getJavaDataType();
if (!Java2SqlType.isGenericSameType(typeA, typeB)) {
return new ReturnCode(DefaultMessagesImpl.getString("ColumnsComparisonMasterDetailsPage.notSameColumnType"), // $NON-NLS-1$
false);
}
if (!ColumnSetHelper.isFromSamePackage(ownerA, ownerB)) {
return new ReturnCode(DefaultMessagesImpl.getString("ColumnsComparisonMasterDetailsPage.schemaSameMessage"), // $NON-NLS-1$
false);
}
}
List<TdColumn> allColumns = new ArrayList<TdColumn>();
allColumns.addAll(columnAList);
allColumns.addAll(columnBList);
// MOD scorreia 2009-05-25 allow to compare elements from the same
// table
// if (ColumnHelper.isFromSameTable(allColumns)) {
// return new ReturnCode(DefaultMessagesImpl.getString("ColumnsComparisonMasterDetailsPage.TwoSideColumns"), false); //$NON-NLS-1$
// }
}
return new ReturnCode(true);
}
Aggregations