GuidedDTDRLPersistence { void doAttribs(List<BaseColumn> allColumns, List<AttributeCol52> attributeCols, List<DTCellValue52> row, RuleModel rm) { List<RuleAttribute> attribs = new ArrayList<RuleAttribute>(); for (int j = 0; j < attributeCols.size(); j++) { AttributeCol52 at = attributeCols.get(j); int index = allColumns.indexOf(at); final DTCellValue52 dcv = row.get(index); String cell = GuidedDTDRLUtilities.convertDTCellValueToString(dcv); if (validateAttributeCell(cell)) { if (Objects.equals(at.getAttribute(), NEGATE_RULE.getAttributeName())) { rm.setNegated(Boolean.valueOf(cell)); } else { attribs.add(new RuleAttribute(at.getAttribute(), cell)); } } } if (attribs.size() > 0) { rm.attributes = attribs.toArray(new RuleAttribute[attribs.size()]); } }  static GuidedDTDRLPersistence getInstance(); String marshal(final GuidedDecisionTable52 originalDTable);  }
@Test public void testAttribs() { GuidedDTDRLPersistence p = new GuidedDTDRLPersistence(); Object[] row = new Object[]{"1", "desc", "a", null}; List<BaseColumn> allColumns = new ArrayList<BaseColumn>(); allColumns.add(new RowNumberCol52()); allColumns.add(new DescriptionCol52()); List<AttributeCol52> attributeCols = new ArrayList<AttributeCol52>(); RuleModel rm = new RuleModel(); RuleAttribute[] orig = rm.attributes; p.doAttribs(allColumns, attributeCols, DataUtilities.makeDataRowList(row), rm); assertSame(orig, rm.attributes); AttributeCol52 col1 = new AttributeCol52(); col1.setAttribute(Attribute.SALIENCE.getAttributeName()); AttributeCol52 col2 = new AttributeCol52(); col2.setAttribute(Attribute.AGENDA_GROUP.getAttributeName()); attributeCols.add(col1); attributeCols.add(col2); allColumns.addAll(attributeCols); p.doAttribs(allColumns, attributeCols, DataUtilities.makeDataRowList(row), rm); assertEquals(1, rm.attributes.length); assertEquals("salience", rm.attributes[0].getAttributeName()); assertEquals("a", rm.attributes[0].getValue()); row = new Object[]{"1", "desc", 1l, "b"}; p.doAttribs(allColumns, attributeCols, DataUtilities.makeDataRowList(row), rm); assertEquals(2, rm.attributes.length); assertEquals("salience", rm.attributes[0].getAttributeName()); assertEquals("1", rm.attributes[0].getValue()); assertEquals("agenda-group", rm.attributes[1].getAttributeName()); assertEquals("b", rm.attributes[1].getValue()); }