Search in sources :

Example 6 with MetadataColumn

use of org.talend.core.model.metadata.MetadataColumn in project tdi-studio-se by Talend.

the class ConnectionCreateActionTest method createSimpleMetadata.

private IMetadataTable createSimpleMetadata() {
    IMetadataTable table = new org.talend.core.model.metadata.MetadataTable();
    IMetadataColumn column1 = new MetadataColumn();
    //$NON-NLS-1$
    column1.setLabel("C1");
    //$NON-NLS-1$
    column1.setTalendType("id_String");
    table.getListColumns().add(column1);
    IMetadataColumn column2 = new MetadataColumn();
    //$NON-NLS-1$
    column2.setLabel("C2");
    //$NON-NLS-1$
    column2.setTalendType("id_String");
    table.getListColumns().add(column2);
    IMetadataColumn column3 = new MetadataColumn();
    //$NON-NLS-1$
    column3.setLabel("C3");
    //$NON-NLS-1$
    column3.setTalendType("id_Integer");
    table.getListColumns().add(column3);
    return table;
}
Also used : IMetadataTable(org.talend.core.model.metadata.IMetadataTable) IMetadataColumn(org.talend.core.model.metadata.IMetadataColumn) MetadataColumn(org.talend.core.model.metadata.MetadataColumn) IMetadataTable(org.talend.core.model.metadata.IMetadataTable) IMetadataColumn(org.talend.core.model.metadata.IMetadataColumn)

Example 7 with MetadataColumn

use of org.talend.core.model.metadata.MetadataColumn in project tdi-studio-se by Talend.

the class NodeQueryCheckUtilTest method createSimpleMetadata.

private IMetadataTable createSimpleMetadata() {
    IMetadataTable table = new org.talend.core.model.metadata.MetadataTable();
    IMetadataColumn column1 = new MetadataColumn();
    //$NON-NLS-1$
    column1.setLabel("C1");
    //$NON-NLS-1$
    column1.setTalendType("id_String");
    table.getListColumns().add(column1);
    IMetadataColumn column2 = new MetadataColumn();
    //$NON-NLS-1$
    column2.setLabel("C2");
    //$NON-NLS-1$
    column2.setTalendType("id_String");
    table.getListColumns().add(column2);
    IMetadataColumn column3 = new MetadataColumn();
    //$NON-NLS-1$
    column3.setLabel("C3");
    //$NON-NLS-1$
    column3.setTalendType("id_String");
    table.getListColumns().add(column3);
    IMetadataColumn column4 = new MetadataColumn();
    //$NON-NLS-1$
    column4.setLabel("C4");
    //$NON-NLS-1$
    column4.setTalendType("id_String");
    table.getListColumns().add(column4);
    return table;
}
Also used : IMetadataTable(org.talend.core.model.metadata.IMetadataTable) IMetadataColumn(org.talend.core.model.metadata.IMetadataColumn) MetadataColumn(org.talend.core.model.metadata.MetadataColumn) IMetadataTable(org.talend.core.model.metadata.IMetadataTable) IMetadataColumn(org.talend.core.model.metadata.IMetadataColumn)

Example 8 with MetadataColumn

use of org.talend.core.model.metadata.MetadataColumn in project tdi-studio-se by Talend.

the class FunctionManagerExtTest method testGetOneColDataNull2.

@Test
public void testGetOneColDataNull2() {
    // test function/function name as null or ""
    FunctionManagerExt functionManagerExt = new FunctionManagerExt();
    MetadataColumn newColumn = new MetadataColumn();
    //$NON-NLS-1$
    newColumn.setLabel("newColumn");
    newColumn.setTalendType(JavaTypesManager.STRING.getId());
    MetadataColumnExt columnExt = new MetadataColumnExt(newColumn);
    assertNull(functionManagerExt.getOneColData(columnExt));
    Function function = new Function();
    columnExt.setFunction(function);
    String value = functionManagerExt.getOneColData(columnExt);
    //$NON-NLS-1$
    assertEquals(value, "");
}
Also used : MetadataColumn(org.talend.core.model.metadata.MetadataColumn) MetadataColumnExt(org.talend.designer.rowgenerator.ui.editor.MetadataColumnExt) Test(org.junit.Test)

Example 9 with MetadataColumn

use of org.talend.core.model.metadata.MetadataColumn in project tdi-studio-se by Talend.

the class FunctionManagerExtTest method testGetOneColDataDefaultFunction.

@Test
public void testGetOneColDataDefaultFunction() {
    FunctionManagerExt functionManagerExt = new FunctionManagerExt();
    MetadataColumn newColumn = new MetadataColumn();
    //$NON-NLS-1$
    newColumn.setLabel("newColumn");
    newColumn.setTalendType(JavaTypesManager.STRING.getId());
    MetadataColumnExt columnExt = new MetadataColumnExt(newColumn);
    // Function name as "PURE_PERL_NAME"
    Function function = new Function();
    function.setName(PURE_PERL_NAME);
    function.setDescription(PURE_PERL_DESC);
    StringParameter param = new StringParameter();
    param.setName(PURE_PERL_PARAM);
    //$NON-NLS-1$
    param.setValue("value1");
    List<Parameter> params = new ArrayList<Parameter>();
    params.add(param);
    function.setParameters(params);
    columnExt.setFunction(function);
    String value = functionManagerExt.getOneColData(columnExt);
    assertEquals(value, param.getValue());
}
Also used : MetadataColumn(org.talend.core.model.metadata.MetadataColumn) ArrayList(java.util.ArrayList) MetadataColumnExt(org.talend.designer.rowgenerator.ui.editor.MetadataColumnExt) Test(org.junit.Test)

Example 10 with MetadataColumn

use of org.talend.core.model.metadata.MetadataColumn in project tdi-studio-se by Talend.

the class JavaProcessorUtilitiesTest method createMetadataColumns.

private void createMetadataColumns(IMetadataTable table, int columns) {
    for (int i = 0; i < columns; i++) {
        MetadataColumn newColumn = new MetadataColumn();
        newColumn.setLabel("newColumn" + i);
        newColumn.setTalendType("id_String");
        table.getListColumns().add(newColumn);
    }
}
Also used : MetadataColumn(org.talend.core.model.metadata.MetadataColumn)

Aggregations

MetadataColumn (org.talend.core.model.metadata.MetadataColumn)44 IMetadataColumn (org.talend.core.model.metadata.IMetadataColumn)35 IMetadataTable (org.talend.core.model.metadata.IMetadataTable)20 ArrayList (java.util.ArrayList)14 MetadataTable (org.talend.core.model.metadata.MetadataTable)13 Test (org.junit.Test)6 MetadataColumnExt (org.talend.designer.rowgenerator.ui.editor.MetadataColumnExt)6 IElementParameter (org.talend.core.model.process.IElementParameter)4 Node (org.talend.designer.core.ui.editor.nodes.Node)4 IComponent (org.talend.core.model.components.IComponent)3 IConnection (org.talend.core.model.process.IConnection)3 ChangeMetadataCommand (org.talend.designer.core.ui.editor.cmd.ChangeMetadataCommand)3 OutputTreeNode (org.talend.designer.xmlmap.model.emf.xmlmap.OutputTreeNode)3 List (java.util.List)2 Schema (org.apache.avro.Schema)2 Command (org.eclipse.gef.commands.Command)2 CompoundCommand (org.eclipse.gef.commands.CompoundCommand)2 DisposeEvent (org.eclipse.swt.events.DisposeEvent)2 DisposeListener (org.eclipse.swt.events.DisposeListener)2 Point (org.eclipse.swt.graphics.Point)2