Search in sources :

Example 1 with MetadataTableImpl

use of org.talend.core.model.metadata.builder.connection.impl.MetadataTableImpl in project tdi-studio-se by Talend.

the class DBTreeProvider method createMetatable.

/**
     * tguiu Comment method "createMetatable".
     * 
     * @param node
     * @param iMetadataFileDelimited
     * @param table
     * @return
     */
private RepositoryNode createMetatable(RepositoryNode node, IRepositoryViewObject repObj, final org.talend.core.model.metadata.builder.connection.MetadataTable table, boolean isBuildIn) {
    MetadataTableRepositoryObject modelObj = new MetadataTableRepositoryObject(repObj, table);
    if (table instanceof MetadataTableImpl) {
        modelObj.setRepositoryName(((MetadataTableImpl) table).getOriginalLabel());
    } else {
        modelObj.setRepositoryName(table.getLabel());
    }
    // statusCode use for source table name
    modelObj.setSourceName(table.getSourceName());
    // purpose use for Image text.
    modelObj.setImage(IMAGES_TABLE_NODE_ICON);
    // description use for color.
    if (modelObj.getTable().isDivergency() && !isBuildIn && !modelObj.getTable().isSynchronised()) {
        modelObj.setColor(COLOR_RED);
    }
    if (modelObj.getRepositoryName() == null || modelObj.getRepositoryName().trim().equals("")) {
        //$NON-NLS-1$
        modelObj.setColor(COLOR_GRAY);
    }
    modelObj.setBuildIn(isBuildIn);
    RepositoryNode tableNode = new RepositoryNodeExt(modelObj, node, ENodeType.REPOSITORY_ELEMENT);
    tableNode.setProperties(EProperties.LABEL, table.getLabel());
    tableNode.setProperties(EProperties.CONTENT_TYPE, RepositoryNodeType.TABLE);
    boolean[] isDiffs = repositoryNodeManager.isDiff(tableNode);
    if (isDiffs[0]) {
        modelObj.setDiffImage(IMAGES_GRAY_ICON);
    }
    if (isDiffs[1]) {
        modelObj.setDiffImage(IMAGES_RED_ICON);
    }
    if (isDiffs[2]) {
        modelObj.setDiffImage(IMAGES_REFRESH_ICON);
    }
    return tableNode;
}
Also used : MetadataTableImpl(org.talend.core.model.metadata.builder.connection.impl.MetadataTableImpl) RepositoryNode(org.talend.repository.model.RepositoryNode) RepositoryNodeExt(org.talend.sqlbuilder.RepositoryNodeExt)

Aggregations

MetadataTableImpl (org.talend.core.model.metadata.builder.connection.impl.MetadataTableImpl)1 RepositoryNode (org.talend.repository.model.RepositoryNode)1 RepositoryNodeExt (org.talend.sqlbuilder.RepositoryNodeExt)1