Search in sources :

Example 1 with ModelMetaData

use of org.drools.workbench.services.verifier.plugin.client.api.ModelMetaData in project drools-wb by kiegroup.

the class ModelMetaDataEnhancer method getHeaderMetaData.

public HeaderMetaData getHeaderMetaData() {
    int columnIndex = 0;
    final Map<Integer, ModelMetaData> map = new HashMap<>();
    for (final BaseColumn baseColumn : model.getExpandedColumns()) {
        if (baseColumn instanceof ConditionCol52) {
            map.put(columnIndex, new ModelMetaData(model.getPattern((ConditionCol52) baseColumn), PatternType.LHS));
        } else if (baseColumn instanceof ActionInsertFactCol52) {
            final ActionInsertFactCol52 aif = (ActionInsertFactCol52) baseColumn;
            map.put(columnIndex, new ModelMetaData(aif.getFactType(), aif.getBoundName(), PatternType.RHS));
        } else if (baseColumn instanceof ActionSetFieldCol52) {
            final ActionSetFieldCol52 asf = (ActionSetFieldCol52) baseColumn;
            map.put(columnIndex, new ModelMetaData(getFactType(asf), asf.getBoundName(), PatternType.RHS));
        }
        columnIndex++;
    }
    return new HeaderMetaData(map);
}
Also used : ConditionCol52(org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52) ActionInsertFactCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionInsertFactCol52) HashMap(java.util.HashMap) HeaderMetaData(org.drools.workbench.services.verifier.plugin.client.api.HeaderMetaData) BaseColumn(org.drools.workbench.models.guided.dtable.shared.model.BaseColumn) ActionSetFieldCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionSetFieldCol52) ModelMetaData(org.drools.workbench.services.verifier.plugin.client.api.ModelMetaData)

Example 2 with ModelMetaData

use of org.drools.workbench.services.verifier.plugin.client.api.ModelMetaData in project drools-wb by kiegroup.

the class ModelMetaDataEnhancerTest method conditionCol52Column.

@Test
public void conditionCol52Column() throws Exception {
    final ArrayList<BaseColumn> columns = new ArrayList<>();
    final ConditionCol52 conditionCol52 = new ConditionCol52();
    final Pattern52 pattern52 = new Pattern52();
    columns.add(conditionCol52);
    when(model.getExpandedColumns()).thenReturn(columns);
    when(model.getPattern(conditionCol52)).thenReturn(pattern52);
    final Map<Integer, ModelMetaData> metaData = new ModelMetaDataEnhancer(model).getHeaderMetaData().getPatternsByColumnNumber();
    assertEquals(1, metaData.size());
    assertEquals(pattern52, metaData.get(0).getPattern());
    assertEquals(PatternType.LHS, metaData.get(0).getPatternType());
}
Also used : ConditionCol52(org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52) Pattern52(org.drools.workbench.models.guided.dtable.shared.model.Pattern52) ArrayList(java.util.ArrayList) BaseColumn(org.drools.workbench.models.guided.dtable.shared.model.BaseColumn) ModelMetaData(org.drools.workbench.services.verifier.plugin.client.api.ModelMetaData) Test(org.junit.Test)

Aggregations

BaseColumn (org.drools.workbench.models.guided.dtable.shared.model.BaseColumn)2 ConditionCol52 (org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52)2 ModelMetaData (org.drools.workbench.services.verifier.plugin.client.api.ModelMetaData)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 ActionInsertFactCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionInsertFactCol52)1 ActionSetFieldCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionSetFieldCol52)1 Pattern52 (org.drools.workbench.models.guided.dtable.shared.model.Pattern52)1 HeaderMetaData (org.drools.workbench.services.verifier.plugin.client.api.HeaderMetaData)1 Test (org.junit.Test)1