use of org.talend.designer.neo4j.data.Index 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);
}
use of org.talend.designer.neo4j.data.Index in project tbd-studio-se by Talend.
the class Neo4jUI method updateTabs.
public void updateTabs(Table table) {
if (table.getSelection().length < 1) {
return;
}
TableItem item = table.getSelection()[0];
if (item.getData() != null) {
List<Index> indexes = ((MetadataColumnExt) item.getData()).getData().getIndexes();
tabFolderEditors.getInputIndexEditor().getExtendedToolbar().getAddButton().getButton().setEnabled(true);
if (indexes != null) {
tabFolderEditors.getInputIndexEditor().update((MetadataColumnExt) item.getData());
}
List<Relationship> relationships = ((MetadataColumnExt) item.getData()).getData().getRelationships();
tabFolderEditors.getInputRelationshipEditor().getExtendedToolbar().getAddButton().getButton().setEnabled(true);
if (relationships != null) {
tabFolderEditors.getInputRelationshipEditor().update((MetadataColumnExt) item.getData());
}
}
}
use of org.talend.designer.neo4j.data.Index in project tbd-studio-se by Talend.
the class IndexTableView method createIndexNameColumn.
private void createIndexNameColumn(TableViewerCreator<Index> tableViewerCreator, final Table table) {
TableViewerCreatorColumn<Index, String> column = new TableViewerCreatorColumn<Index, String>(tableViewerCreator);
// TODO: Internationalize this
column.setTitle("Name");
column.setModifiable(true);
column.setWidth(115);
column.setBeanPropertyAccessors(new IBeanPropertyAccessors<Index, String>() {
@Override
public String get(Index bean) {
return bean.getName() == null ? "" : bean.getName();
}
@Override
public void set(Index bean, String value) {
bean.setName(value);
}
});
column.setCellEditor(new TextCellEditor(table));
}
use of org.talend.designer.neo4j.data.Index in project tbd-studio-se by Talend.
the class IndexTableView method createIndexValueColumn.
private void createIndexValueColumn(TableViewerCreator<Index> tableViewerCreator, final Table table) {
TableViewerCreatorColumn<Index, String> column = new TableViewerCreatorColumn<Index, String>(tableViewerCreator);
// TODO: Internationalize this
column.setTitle("Value (empty for current row)");
column.setModifiable(true);
column.setWidth(215);
column.setBeanPropertyAccessors(new IBeanPropertyAccessors<Index, String>() {
@Override
public String get(Index bean) {
return bean.getValue() == null ? "" : bean.getValue();
}
@Override
public void set(Index bean, String value) {
bean.setValue(value);
}
});
column.setCellEditor(new TextCellEditor(table));
}
use of org.talend.designer.neo4j.data.Index in project tbd-studio-se by Talend.
the class UIManager method getNewIndexesList.
private List<Map<String, Object>> getNewIndexesList() {
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 (Index index : ext.getData().getIndexes()) {
Map<String, Object> value = new HashMap<String, Object>();
value.put(Neo4jComponent.SCHEMA_COLUMN, ext.getLabel());
value.put(Neo4jComponent.INDEX_NAME, index.getName());
value.put(Neo4jComponent.KEY, index.getKey());
value.put(Neo4jComponent.VALUE, index.getValue());
value.put(Neo4jComponent.UNIQUE, String.valueOf(index.isUnique()));
map.add(value);
}
}
return map;
}
Aggregations