@Test public void conversionWithEnumerationsInCells() { final ConversionResult result = new ConversionResult(); final List<DataListener> listeners = new ArrayList<>(); addModelField("org.test.Message", "this", "org.test.Message", DataType.TYPE_THIS); addModelField("org.test.Message", "status", Integer.class.getName(), DataType.TYPE_NUMERIC_INTEGER); addModelField("org.test.Message", "message", String.class.getName(), DataType.TYPE_STRING); final GuidedDecisionTableGeneratorListener listener = new GuidedDecisionTableGeneratorListener(result, dmo); listeners.add(listener); final ExcelParser parser = new ExcelParser(listeners); final InputStream is = this.getClass().getResourceAsStream("RHBRMS-2055 (Decision table with enums).xls"); try { parser.parseFile(is); } finally { try { is.close(); } catch (IOException ioe) { fail(ioe.getMessage()); } } assertEquals(3, result.getMessages().size()); assertTrue(result.getMessages().get(0).getMessage().contains("C11")); assertTrue(result.getMessages().get(1).getMessage().contains("C12")); assertTrue(result.getMessages().get(2).getMessage().contains("F11")); final List<GuidedDecisionTable52> dtables = listener.getGuidedDecisionTables(); assertNotNull(dtables); assertEquals(1, dtables.size()); GuidedDecisionTable52 dtable = dtables.get(0); assertEquals("HelloWorld1", dtable.getTableName()); assertEquals(GuidedDecisionTable52.TableFormat.EXTENDED_ENTRY, dtable.getTableFormat()); List<BaseColumn> columns = dtable.getExpandedColumns(); assertNotNull(columns); assertEquals(7, columns.size()); assertTrue(columns.get(0) instanceof RowNumberCol52); assertTrue(columns.get(1) instanceof RuleNameColumn); assertTrue(columns.get(2) instanceof DescriptionCol52); assertTrue(columns.get(3) instanceof BRLConditionVariableColumn); assertTrue(columns.get(4) instanceof BRLActionVariableColumn); assertTrue(columns.get(5) instanceof BRLActionVariableColumn); assertTrue(columns.get(6) instanceof BRLActionVariableColumn); assertEquals(1, dtable.getConditions().size()); assertTrue(dtable.getConditions().get(0) instanceof BRLConditionColumn); BRLConditionColumn conditionCol0 = ((BRLConditionColumn) dtable.getConditions().get(0)); assertEquals("Converted from ['Status']", conditionCol0.getHeader()); assertEquals(1, conditionCol0.getChildColumns().size()); List<IPattern> conditionCol0definition = conditionCol0.getDefinition(); assertEquals(1, conditionCol0definition.size()); assertTrue(conditionCol0definition.get(0) instanceof FactPattern); FactPattern conditionCol0fp = (FactPattern) conditionCol0definition.get(0); assertEquals("Message", conditionCol0fp.getFactType()); assertEquals(1, conditionCol0fp.getNumberOfConstraints()); assertTrue(conditionCol0fp.getConstraint(0) instanceof SingleFieldConstraint); final SingleFieldConstraint conditionCol0fpsfc0 = (SingleFieldConstraint) conditionCol0fp.getConstraint(0); assertEquals("status", conditionCol0fpsfc0.getFieldName()); assertEquals("==", conditionCol0fpsfc0.getOperator()); assertEquals("param1", conditionCol0fpsfc0.getValue()); assertEquals(SingleFieldConstraint.TYPE_TEMPLATE, conditionCol0fpsfc0.getConstraintValueType()); assertEquals(DataType.TYPE_NUMERIC_INTEGER, conditionCol0fpsfc0.getFieldType()); BRLConditionVariableColumn conditionCol0param0 = conditionCol0.getChildColumns().get(0); assertEquals("param1", conditionCol0param0.getVarName()); assertEquals("Status", conditionCol0param0.getHeader()); assertEquals(DataType.TYPE_NUMERIC_INTEGER, conditionCol0param0.getFieldType()); assertEquals("Message", conditionCol0param0.getFactType()); assertEquals("status", conditionCol0param0.getFactField()); assertEquals(2, dtable.getActionCols().size()); assertTrue(dtable.getActionCols().get(0) instanceof BRLActionColumn); BRLActionColumn actionCol0 = ((BRLActionColumn) dtable.getActionCols().get(0)); assertEquals("Converted from ['Print out message?']", actionCol0.getHeader()); assertEquals(1, actionCol0.getChildColumns().size()); List<IAction> actionCol0definition = actionCol0.getDefinition(); assertEquals(1, actionCol0definition.size()); assertTrue(actionCol0definition.get(0) instanceof FreeFormLine); FreeFormLine actionCol0ffl0 = (FreeFormLine) actionCol0definition.get(0); assertEquals("System.out.println(m.getMessage());", actionCol0ffl0.getText()); BRLActionColumn actionCol1 = ((BRLActionColumn) dtable.getActionCols().get(1)); assertEquals("Converted from ['Set message', 'Set status']", actionCol1.getHeader()); assertEquals(2, actionCol1.getChildColumns().size()); List<IAction> actionCol1definition = actionCol1.getDefinition(); assertEquals(1, actionCol1definition.size()); assertTrue(actionCol1definition.get(0) instanceof ActionSetField); ActionSetField actionCol1asf0 = (ActionSetField) actionCol1definition.get(0); assertEquals("m", actionCol1asf0.getVariable()); ActionFieldValue[] actionCol1asf0afvs = actionCol1asf0.getFieldValues(); assertEquals(2, actionCol1asf0afvs.length); ActionFieldValue actionCol1asf0afv0 = actionCol1asf0afvs[0]; assertEquals("message", actionCol1asf0afv0.getField()); assertEquals("param2", actionCol1asf0afv0.getValue()); assertEquals(FieldNatureType.TYPE_TEMPLATE, actionCol1asf0afv0.getNature()); assertEquals(DataType.TYPE_STRING, actionCol1asf0afv0.getType()); ActionFieldValue actionCol1asf0afv1 = actionCol1asf0afvs[1]; assertEquals("status", actionCol1asf0afv1.getField()); assertEquals("param3", actionCol1asf0afv1.getValue()); assertEquals(FieldNatureType.TYPE_TEMPLATE, actionCol1asf0afv1.getNature()); assertEquals(DataType.TYPE_NUMERIC_INTEGER, actionCol1asf0afv1.getType()); BRLActionVariableColumn actionCol0param0 = actionCol0.getChildColumns().get(0); assertEquals("", actionCol0param0.getVarName()); assertEquals("Print out message?", actionCol0param0.getHeader()); assertEquals(DataType.TYPE_BOOLEAN, actionCol0param0.getFieldType()); assertNull(actionCol0param0.getFactType()); assertNull(actionCol0param0.getFactField()); assertTrue(dtable.getActionCols().get(0) instanceof BRLActionColumn); BRLActionVariableColumn actionCol1param0 = actionCol1.getChildColumns().get(0); assertEquals("param2", actionCol1param0.getVarName()); assertEquals("Set message", actionCol1param0.getHeader()); assertEquals(DataType.TYPE_STRING, actionCol1param0.getFieldType()); assertEquals("Message", actionCol1param0.getFactType()); assertEquals("message", actionCol1param0.getFactField()); BRLActionVariableColumn actionCol1param1 = actionCol1.getChildColumns().get(1); assertEquals("param3", actionCol1param1.getVarName()); assertEquals("Set status", actionCol1param1.getHeader()); assertEquals(DataType.TYPE_NUMERIC_INTEGER, actionCol1param1.getFieldType()); assertEquals("Message", actionCol1param1.getFactType()); assertEquals("status", actionCol1param1.getFactField()); assertEquals(2, dtable.getData().size()); assertTrue(isRowEquivalent(new Object[]{1, "", "Hello World", null, false, "Goodbye cruel world", null}, dtable.getData().get(0))); assertTrue(isRowEquivalent(new Object[]{2, "", "Goodbye", null, false, "", null}, dtable.getData().get(1))); }
public List<GuidedDecisionTable52> getGuidedDecisionTables() { return _dtables; }
GuidedDecisionTableGeneratorListener implements
        RuleSheetListener { public List<GuidedDecisionTable52> getGuidedDecisionTables() { return _dtables; } }
GuidedDecisionTableGeneratorListener implements
        RuleSheetListener { public List<GuidedDecisionTable52> getGuidedDecisionTables() { return _dtables; } GuidedDecisionTableGeneratorListener(final ConversionResult conversionResult,
                                                final PackageDataModelOracle _dmo); }
GuidedDecisionTableGeneratorListener implements
        RuleSheetListener { public List<GuidedDecisionTable52> getGuidedDecisionTables() { return _dtables; } GuidedDecisionTableGeneratorListener(final ConversionResult conversionResult,
                                                final PackageDataModelOracle _dmo); CaseInsensitiveMap getProperties(); Package getRuleSet(); List<Import> getImports(); List<Global> getGlobals(); List<String> getFunctions(); List<String> getQueries(); List<String> getTypeDeclarations(); List<GuidedDecisionTable52> getGuidedDecisionTables(); void startSheet(final String name); void finishSheet(); void newRow(final int rowNumber,
                       final int columns); void newCell(final int row,
                        final int column,
                        final String value,
                        int mergedColStart); }
GuidedDecisionTableGeneratorListener implements
        RuleSheetListener { public List<GuidedDecisionTable52> getGuidedDecisionTables() { return _dtables; } GuidedDecisionTableGeneratorListener(final ConversionResult conversionResult,
                                                final PackageDataModelOracle _dmo); CaseInsensitiveMap getProperties(); Package getRuleSet(); List<Import> getImports(); List<Global> getGlobals(); List<String> getFunctions(); List<String> getQueries(); List<String> getTypeDeclarations(); List<GuidedDecisionTable52> getGuidedDecisionTables(); void startSheet(final String name); void finishSheet(); void newRow(final int rowNumber,
                       final int columns); void newCell(final int row,
                        final int column,
                        final String value,
                        int mergedColStart);  }