Search in sources :

Example 1 with Neo4jData

use of org.talend.designer.neo4j.data.Neo4jData in project tbd-studio-se by Talend.

the class Neo4jManager method convert.

public void convert(Neo4jComponent externalNode, IMetadataTable outputMetaTable) {
    List<IMetadataColumn> exts = new ArrayList<IMetadataColumn>();
    for (IMetadataColumn column : outputMetaTable.getListColumns()) {
        if (column instanceof MetadataColumnExt) {
            exts.add(column.clone());
        } else if (column instanceof MetadataColumn) {
            MetadataColumnExt ext = new MetadataColumnExt((MetadataColumn) column);
            ext.setData(new Neo4jData());
            List<Map<String, Object>> mapValues = getNeo4jComponent().getOriginalValuesList();
            for (Map<String, Object> mapValue : mapValues) {
                if (ext.getLabel().equals(mapValue.get(Neo4jComponent.SCHEMA_COLUMN))) {
                    ext.getData().setAutoIndexed(Boolean.valueOf((String) mapValue.get(Neo4jComponent.AUTO_INDEXED)));
                }
            }
            mapValues = getNeo4jComponent().getOriginalIndexesList();
            for (Map<String, Object> mapValue : mapValues) {
                if (ext.getLabel().equals(mapValue.get(Neo4jComponent.SCHEMA_COLUMN))) {
                    Index index = new Index();
                    index.setName((String) mapValue.get(Neo4jComponent.INDEX_NAME));
                    index.setKey((String) mapValue.get(Neo4jComponent.KEY));
                    index.setUnique(Boolean.valueOf((String) mapValue.get(Neo4jComponent.UNIQUE)));
                    index.setValue((String) mapValue.get(Neo4jComponent.VALUE));
                    ext.getData().getIndexes().add(index);
                }
            }
            mapValues = getNeo4jComponent().getOriginalRelationshipsList();
            for (Map<String, Object> mapValue : mapValues) {
                if (ext.getLabel().equals(mapValue.get(Neo4jComponent.SCHEMA_COLUMN))) {
                    Relationship relationship = new Relationship();
                    Index index = new Index();
                    index.setName((String) mapValue.get(Neo4jComponent.INDEX_NAME));
                    index.setKey((String) mapValue.get(Neo4jComponent.KEY));
                    index.setValue((String) mapValue.get(Neo4jComponent.VALUE));
                    relationship.setIndex(index);
                    relationship.setType((String) mapValue.get(Neo4jComponent.TYPE));
                    relationship.setDirection(Direction.getFromName((String) mapValue.get(Neo4jComponent.DIRECTION)));
                    ext.getData().getRelationships().add(relationship);
                }
            }
            exts.add(ext);
        }
    }
    outputMetaTable.setListColumns(exts);
}
Also used : IMetadataColumn(org.talend.core.model.metadata.IMetadataColumn) MetadataColumn(org.talend.core.model.metadata.MetadataColumn) Relationship(org.talend.designer.neo4j.data.Relationship) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) Index(org.talend.designer.neo4j.data.Index) IMetadataColumn(org.talend.core.model.metadata.IMetadataColumn) Map(java.util.Map) Neo4jData(org.talend.designer.neo4j.data.Neo4jData) MetadataColumnExt(org.talend.designer.neo4j.ui.editor.MetadataColumnExt)

Example 2 with Neo4jData

use of org.talend.designer.neo4j.data.Neo4jData in project tbd-studio-se by Talend.

the class MetadataTableEditorExt method createNewMetadataColumn.

@Override
public IMetadataColumn createNewMetadataColumn() {
    final MetadataColumnExt metadataColumnExt = new MetadataColumnExt((MetadataColumn) super.createNewMetadataColumn());
    metadataColumnExt.setData(new Neo4jData());
    return metadataColumnExt;
}
Also used : Neo4jData(org.talend.designer.neo4j.data.Neo4jData)

Aggregations

Neo4jData (org.talend.designer.neo4j.data.Neo4jData)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Map (java.util.Map)1 IMetadataColumn (org.talend.core.model.metadata.IMetadataColumn)1 MetadataColumn (org.talend.core.model.metadata.MetadataColumn)1 Index (org.talend.designer.neo4j.data.Index)1 Relationship (org.talend.designer.neo4j.data.Relationship)1 MetadataColumnExt (org.talend.designer.neo4j.ui.editor.MetadataColumnExt)1