Search in sources :

Example 56 with MetadataTable

use of org.talend.core.model.metadata.MetadataTable in project tbd-studio-se by Talend.

the class HadoopClusterRepositoryTypeProcessor method selectRepositoryNode.

/*
     * (non-Javadoc)
     * 
     * @see
     * org.talend.repository.ui.processor.SingleTypeProcessor#selectRepositoryNode(org.eclipse.jface.viewers.Viewer,
     * org.talend.repository.model.RepositoryNode, org.talend.repository.model.RepositoryNode)
     */
@Override
protected boolean selectRepositoryNode(Viewer viewer, RepositoryNode parentNode, RepositoryNode node) {
    final String repositoryType = getRepositoryType();
    if (node == null || repositoryType == null) {
        return false;
    }
    ERepositoryObjectType repObjType = (ERepositoryObjectType) node.getProperties(EProperties.CONTENT_TYPE);
    if (repObjType == ERepositoryObjectType.REFERENCED_PROJECTS) {
        return true;
    }
    if (node.getType() == ENodeType.SYSTEM_FOLDER) {
        return true;
    }
    if (node.getType() == ENodeType.SIMPLE_FOLDER || HCRepositoryUtil.isHadoopContainerNode(node)) {
        return isValidFolder(node);
    }
    IRepositoryViewObject object = node.getObject();
    if (object == null || object.getProperty().getItem() == null) {
        return false;
    }
    if (object instanceof MetadataTable) {
        return false;
    }
    Item item = object.getProperty().getItem();
    if (item instanceof FolderItem) {
        return true;
    }
    return true;
}
Also used : Item(org.talend.core.model.properties.Item) FolderItem(org.talend.core.model.properties.FolderItem) FolderItem(org.talend.core.model.properties.FolderItem) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) MetadataTable(org.talend.core.model.metadata.MetadataTable) ERepositoryObjectType(org.talend.core.model.repository.ERepositoryObjectType)

Example 57 with MetadataTable

use of org.talend.core.model.metadata.MetadataTable in project tbd-studio-se by Talend.

the class HadoopSubRepositoryTypeProcessor method selectRepositoryNode.

/*
     * (non-Javadoc)
     *
     * @see
     * org.talend.repository.ui.processor.SingleTypeProcessor#selectRepositoryNode(org.eclipse.jface.viewers.Viewer,
     * org.talend.repository.model.RepositoryNode, org.talend.repository.model.RepositoryNode)
     */
@Override
protected boolean selectRepositoryNode(Viewer viewer, RepositoryNode parentNode, RepositoryNode node) {
    final String repositoryType = getRepositoryType();
    if (node == null || repositoryType == null) {
        return false;
    }
    ERepositoryObjectType repObjType = (ERepositoryObjectType) node.getProperties(EProperties.CONTENT_TYPE);
    if (repObjType == ERepositoryObjectType.REFERENCED_PROJECTS) {
        return true;
    }
    if (node.getType() == ENodeType.SYSTEM_FOLDER) {
        return true;
    }
    if (node.getType() == ENodeType.SIMPLE_FOLDER || HCRepositoryUtil.isHadoopContainerNode(node)) {
        return isValidFolder(node);
    }
    IRepositoryViewObject object = node.getObject();
    if (object == null || object.getProperty().getItem() == null) {
        return false;
    }
    if (object instanceof MetadataTable) {
        return false;
    }
    Item item = object.getProperty().getItem();
    if (item instanceof FolderItem) {
        return true;
    }
    return true;
}
Also used : Item(org.talend.core.model.properties.Item) FolderItem(org.talend.core.model.properties.FolderItem) FolderItem(org.talend.core.model.properties.FolderItem) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) MetadataTable(org.talend.core.model.metadata.MetadataTable) ERepositoryObjectType(org.talend.core.model.repository.ERepositoryObjectType)

Example 58 with MetadataTable

use of org.talend.core.model.metadata.MetadataTable in project tbd-studio-se by Talend.

the class UIManager method getNewRelationShipsList.

private List<Map<String, Object>> getNewRelationShipsList() {
    List<Map<String, Object>> map = new ArrayList<Map<String, Object>>();
    MetadataTable table = (MetadataTable) neo4jManager.getNeo4jComponent().getMetadataList().get(0);
    neo4jManager.convert(neo4jManager.getNeo4jComponent(), table);
    for (IMetadataColumn col : table.getListColumns()) {
        MetadataColumnExt ext = (MetadataColumnExt) col;
        for (Relationship relationship : ext.getData().getRelationships()) {
            Map<String, Object> value = new HashMap<String, Object>();
            value.put(Neo4jComponent.SCHEMA_COLUMN, ext.getLabel());
            value.put(Neo4jComponent.TYPE, relationship.getType());
            value.put(Neo4jComponent.DIRECTION, relationship.getDirection().getName());
            value.put(Neo4jComponent.INDEX_NAME, relationship.getIndex().getName());
            value.put(Neo4jComponent.KEY, relationship.getIndex().getKey());
            value.put(Neo4jComponent.VALUE, relationship.getIndex().getValue());
            map.add(value);
        }
    }
    return map;
}
Also used : HashMap(java.util.HashMap) Relationship(org.talend.designer.neo4j.data.Relationship) ArrayList(java.util.ArrayList) MetadataTable(org.talend.core.model.metadata.MetadataTable) IMetadataColumn(org.talend.core.model.metadata.IMetadataColumn) HashMap(java.util.HashMap) Map(java.util.Map) MetadataColumnExt(org.talend.designer.neo4j.ui.editor.MetadataColumnExt)

Example 59 with MetadataTable

use of org.talend.core.model.metadata.MetadataTable in project tbd-studio-se by Talend.

the class RetrieveConfigurationProcess method getMetadataTable.

private MetadataTable getMetadataTable() {
    MetadataTable targetTable = new MetadataTable();
    targetTable.setAttachedConnector(EConnectionType.FLOW_MAIN.getName());
    List columnList = new ArrayList<MetadataColumn>();
    IMetadataColumn clusterNameColumn = new MetadataColumn();
    // $NON-NLS-1$
    clusterNameColumn.setLabel("clusterName");
    clusterNameColumn.setTalendType(JavaTypesManager.STRING.getId());
    columnList.add(clusterNameColumn);
    IMetadataColumn serviceNameColumn = new MetadataColumn();
    // $NON-NLS-1$
    serviceNameColumn.setLabel("serviceName");
    serviceNameColumn.setTalendType(JavaTypesManager.STRING.getId());
    columnList.add(serviceNameColumn);
    IMetadataColumn confFileNameColumn = new MetadataColumn();
    // $NON-NLS-1$
    confFileNameColumn.setLabel("confFileName");
    confFileNameColumn.setTalendType(JavaTypesManager.STRING.getId());
    columnList.add(confFileNameColumn);
    IMetadataColumn confFileContentColumn = new MetadataColumn();
    // $NON-NLS-1$
    confFileContentColumn.setLabel("confFileContent");
    confFileContentColumn.setTalendType(JavaTypesManager.STRING.getId());
    columnList.add(confFileContentColumn);
    targetTable.setListColumns(columnList);
    return targetTable;
}
Also used : IMetadataColumn(org.talend.core.model.metadata.IMetadataColumn) MetadataColumn(org.talend.core.model.metadata.MetadataColumn) IMetadataTable(org.talend.core.model.metadata.IMetadataTable) MetadataTable(org.talend.core.model.metadata.MetadataTable) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) IMetadataColumn(org.talend.core.model.metadata.IMetadataColumn)

Example 60 with MetadataTable

use of org.talend.core.model.metadata.MetadataTable in project tbd-studio-se by Talend.

the class NoSQLRepositoryTypeProcessor method selectRepositoryNode.

/*
     * (non-Javadoc)
     *
     * @see
     * org.talend.repository.ui.processor.SingleTypeProcessor#selectRepositoryNode(org.eclipse.jface.viewers.Viewer,
     * org.talend.repository.model.RepositoryNode, org.talend.repository.model.RepositoryNode)
     */
@Override
protected boolean selectRepositoryNode(Viewer viewer, RepositoryNode parentNode, RepositoryNode node) {
    final String repositoryType = getRepositoryType();
    if (node == null || repositoryType == null) {
        return false;
    }
    ERepositoryObjectType repObjType = (ERepositoryObjectType) node.getProperties(EProperties.CONTENT_TYPE);
    if (repObjType == ERepositoryObjectType.REFERENCED_PROJECTS) {
        return true;
    }
    if (node.getType() == ENodeType.SYSTEM_FOLDER) {
        return true;
    }
    IRepositoryViewObject object = node.getObject();
    if (object == null || object.getProperty().getItem() == null) {
        return false;
    }
    if (object instanceof MetadataTable) {
        return false;
    }
    Item item = object.getProperty().getItem();
    if (item instanceof FolderItem) {
        return true;
    }
    if (item instanceof NoSQLConnectionItem) {
        NoSQLConnectionItem connectionItem = (NoSQLConnectionItem) item;
        NoSQLConnection connection = (NoSQLConnection) connectionItem.getConnection();
        if (repositoryType.startsWith(INoSQLConstants.NOSQL_TYPE_PREFIX)) {
            // $NON-NLS-1$
            String realDbType = repositoryType.substring(repositoryType.indexOf(":") + 1);
            if (!StringUtils.equalsIgnoreCase(realDbType, connection.getDbType())) {
                return false;
            }
        }
    }
    return true;
}
Also used : Item(org.talend.core.model.properties.Item) FolderItem(org.talend.core.model.properties.FolderItem) NoSQLConnectionItem(org.talend.repository.model.nosql.NoSQLConnectionItem) FolderItem(org.talend.core.model.properties.FolderItem) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) MetadataTable(org.talend.core.model.metadata.MetadataTable) NoSQLConnection(org.talend.repository.model.nosql.NoSQLConnection) ERepositoryObjectType(org.talend.core.model.repository.ERepositoryObjectType) NoSQLConnectionItem(org.talend.repository.model.nosql.NoSQLConnectionItem)

Aggregations

MetadataTable (org.talend.core.model.metadata.MetadataTable)61 IMetadataTable (org.talend.core.model.metadata.IMetadataTable)46 IMetadataColumn (org.talend.core.model.metadata.IMetadataColumn)29 ArrayList (java.util.ArrayList)23 HashMap (java.util.HashMap)15 Map (java.util.Map)14 IElementParameter (org.talend.core.model.process.IElementParameter)14 Item (org.talend.core.model.properties.Item)14 MetadataColumn (org.talend.core.model.metadata.MetadataColumn)13 IConnection (org.talend.core.model.process.IConnection)13 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)13 Node (org.talend.designer.core.ui.editor.nodes.Node)11 List (java.util.List)9 ERepositoryObjectType (org.talend.core.model.repository.ERepositoryObjectType)9 Command (org.eclipse.gef.commands.Command)8 Point (org.eclipse.swt.graphics.Point)8 INode (org.talend.core.model.process.INode)8 ChangeMetadataCommand (org.talend.designer.core.ui.editor.cmd.ChangeMetadataCommand)8 PropertyChangeCommand (org.talend.designer.core.ui.editor.cmd.PropertyChangeCommand)8 Connection (org.talend.designer.core.ui.editor.connections.Connection)8