Search in sources :

Example 1 with MetadataColumnRepositoryObject

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;
}
Also used : IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) MetadataColumnRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject) ERepositoryObjectType(org.talend.core.model.repository.ERepositoryObjectType)

Example 2 with MetadataColumnRepositoryObject

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;
}
Also used : IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) MetadataColumnRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject) ICDCProviderService(org.talend.core.ui.ICDCProviderService)

Example 3 with MetadataColumnRepositoryObject

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());
        }
    }
}
Also used : SAPFunctionRepositoryObject(org.talend.core.repository.model.repositoryObject.SAPFunctionRepositoryObject) SAPFunctionUnit(org.talend.core.model.metadata.builder.connection.SAPFunctionUnit) SAPIDocRepositoryObject(org.talend.core.repository.model.repositoryObject.SAPIDocRepositoryObject) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) MetadataTable(org.talend.core.model.metadata.builder.connection.MetadataTable) IMetadataTable(org.talend.core.model.metadata.IMetadataTable) MetadataColumnRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject) SAPTable(org.talend.core.model.metadata.builder.connection.SAPTable) MetadataTableRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataTableRepositoryObject)

Example 4 with MetadataColumnRepositoryObject

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;
}
Also used : IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) MetadataColumnRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject) ERepositoryObjectType(org.talend.core.model.repository.ERepositoryObjectType)

Example 5 with MetadataColumnRepositoryObject

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);
}
Also used : TypedReturnCode(org.talend.utils.sugars.TypedReturnCode) ReturnCode(org.talend.utils.sugars.ReturnCode) TdColumn(org.talend.cwm.relational.TdColumn) ArrayList(java.util.ArrayList) MetadataColumnRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject) ColumnSet(orgomg.cwm.resource.relational.ColumnSet) RepositoryNode(org.talend.repository.model.RepositoryNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode)

Aggregations

MetadataColumnRepositoryObject (org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject)46 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)30 IRepositoryNode (org.talend.repository.model.IRepositoryNode)27 RepositoryNode (org.talend.repository.model.RepositoryNode)14 TdColumn (org.talend.cwm.relational.TdColumn)13 ArrayList (java.util.ArrayList)10 ModelElementIndicator (org.talend.dataprofiler.core.model.ModelElementIndicator)10 DBColumnRepNode (org.talend.dq.nodes.DBColumnRepNode)9 ModelElement (orgomg.cwm.objectmodel.core.ModelElement)9 Connection (org.talend.core.model.metadata.builder.connection.Connection)8 MetadataColumn (org.talend.core.model.metadata.builder.connection.MetadataColumn)7 TdTable (org.talend.cwm.relational.TdTable)7 List (java.util.List)5 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)5 ICommonViewerWorkbenchSite (org.eclipse.ui.navigator.ICommonViewerWorkbenchSite)5 MetadataTableRepositoryObject (org.talend.core.repository.model.repositoryObject.MetadataTableRepositoryObject)5 ReturnCode (org.talend.utils.sugars.ReturnCode)5 Test (org.junit.Test)3 PersistenceException (org.talend.commons.exception.PersistenceException)3 MetadataTable (org.talend.core.model.metadata.builder.connection.MetadataTable)3