Search in sources :

Example 1 with SAPTable

use of org.talend.core.model.metadata.builder.connection.SAPTable 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)

Aggregations

IMetadataTable (org.talend.core.model.metadata.IMetadataTable)1 MetadataTable (org.talend.core.model.metadata.builder.connection.MetadataTable)1 SAPFunctionUnit (org.talend.core.model.metadata.builder.connection.SAPFunctionUnit)1 SAPTable (org.talend.core.model.metadata.builder.connection.SAPTable)1 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)1 MetadataColumnRepositoryObject (org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject)1 MetadataTableRepositoryObject (org.talend.core.repository.model.repositoryObject.MetadataTableRepositoryObject)1 SAPFunctionRepositoryObject (org.talend.core.repository.model.repositoryObject.SAPFunctionRepositoryObject)1 SAPIDocRepositoryObject (org.talend.core.repository.model.repositoryObject.SAPIDocRepositoryObject)1