private boolean parseAttributes(final RuleModel m, final Map<String, AttributeDescr> attributes) { boolean isJavaDialect = false; for (Map.Entry<String, AttributeDescr> entry : attributes.entrySet()) { String name = entry.getKey(); String value = normalizeAttributeValue(entry.getValue().getValue().trim()); RuleAttribute ruleAttribute = new RuleAttribute(name, value); m.addAttribute(ruleAttribute); isJavaDialect |= name.equals("dialect") && value.equals("java"); } return isJavaDialect; }
private RuleAttribute visitRuleAttribute(RuleAttribute attr) { RuleAttribute clone = new RuleAttribute(); clone.setAttributeName(attr.getAttributeName()); clone.setValue(attr.getValue()); return clone; }
private String getRuleDialect() { final RuleModel model = getModeller().getModel(); for (int i = 0; i < model.attributes.length; i++) { RuleAttribute attr = model.attributes[i]; if (attr.getAttributeName().equals("dialect")) { return attr.getValue(); } } return DRLConstraintValueBuilder.DEFAULT_DIALECT; }
/** * Marshal model attributes * @param buf * @param model */ protected void marshalAttributes(final StringBuilder buf, final RuleModel model) { boolean hasDialect = false; for (int i = 0; i < model.attributes.length; i++) { RuleAttribute attr = model.attributes[i]; buf.append("\t"); buf.append(attr); buf.append("\n"); if (attr.getAttributeName().equals("dialect")) { constraintValueBuilder = DRLConstraintValueBuilder.getBuilder(attr.getValue()); hasDialect = true; } } // Un comment below for mvel if (!hasDialect) { RuleAttribute attr = new RuleAttribute("dialect", DRLConstraintValueBuilder.DEFAULT_DIALECT); buf.append("\t"); buf.append(attr); buf.append("\n"); } }
final EditAttributeWidgetFactory editAttributeWidgetFactory = new EditAttributeWidgetFactory(isReadOnly); final String attributeName = at.getAttributeName(); if (attributeName.equals(RULEFLOW_GROUP_ATTR) || attributeName.equals(AGENDA_GROUP_ATTR) if (at.getValue() == null || at.getValue().isEmpty()) { lb.setSelectedIndex(1); at.setValue(DIALECTS[1]); } else if (at.getValue().equals(DIALECTS[0])) { lb.setSelectedIndex(0); } else if (at.getValue().equals(DIALECTS[1])) { lb.setSelectedIndex(1); } else { lb.setSelectedIndex(1); at.setValue(DIALECTS[1]);
private Widget checkBoxEditor(final RuleAttribute at, final boolean isReadOnly) { final CheckBox box = new CheckBox(); box.setEnabled(!isReadOnly); if (at.getValue() == null || at.getValue().isEmpty()) { box.setValue(false); at.setValue(FALSE_VALUE); } else { box.setValue((at.getValue().equals(TRUE_VALUE))); } box.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { at.setValue((box.getValue()) ? TRUE_VALUE : FALSE_VALUE); } }); return box; }
@Override protected String[] getReservedAttributes() { int size = model.attributes.length; String[] duplicates = new String[size]; for (int i = 0; i < size; i++) { duplicates[i] = model.attributes[i].getAttributeName(); } return duplicates; }
public void onClick(ClickEvent event) { at.setValue((box.getValue()) ? TRUE_VALUE : FALSE_VALUE); } });
private String getRuleDialect() { final RuleModel model = getModeller().getModel(); for (int i = 0; i < model.attributes.length; i++) { RuleAttribute attr = model.attributes[i]; if (attr.getAttributeName().equals("dialect")) { return attr.getValue(); } } return DRLConstraintValueBuilder.DEFAULT_DIALECT; }
final EditAttributeWidgetFactory editAttributeWidgetFactory = new EditAttributeWidgetFactory(isReadOnly); final String attributeName = at.getAttributeName(); if (attributeName.equals(RULEFLOW_GROUP_ATTR) || attributeName.equals(AGENDA_GROUP_ATTR) if (at.getValue() == null || at.getValue().isEmpty()) { lb.setSelectedIndex(1); at.setValue(DIALECTS[1]); } else if (at.getValue().equals(DIALECTS[0])) { lb.setSelectedIndex(0); } else if (at.getValue().equals(DIALECTS[1])) { lb.setSelectedIndex(1); } else { lb.setSelectedIndex(1); at.setValue(DIALECTS[1]);
private Widget checkBoxEditor(final RuleAttribute at, final boolean isReadOnly) { final CheckBox box = new CheckBox(); box.setEnabled(!isReadOnly); if (at.getValue() == null || at.getValue().isEmpty()) { box.setValue(false); at.setValue(FALSE_VALUE); } else { box.setValue((at.getValue().equals(TRUE_VALUE))); } box.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { at.setValue((box.getValue()) ? TRUE_VALUE : FALSE_VALUE); } }); return box; }
@Override protected String[] getReservedAttributes() { int size = model.attributes.length; String[] duplicates = new String[size]; for (int i = 0; i < size; i++) { duplicates[i] = model.attributes[i].getAttributeName(); } return duplicates; }
public void onClick(ClickEvent event) { at.setValue((box.getValue()) ? TRUE_VALUE : FALSE_VALUE); } });
@Override protected void handleAttributeAddition(final String attributeName) { if (attributeName.equals(RuleAttributeWidget.LOCK_LHS) || attributeName.equals(RuleAttributeWidget.LOCK_RHS)) { model.addMetadata(new RuleMetadata(attributeName, "true")); } else { model.addAttribute(new RuleAttribute(attributeName, "")); } refresh.execute(); }
private RuleAttribute visitRuleAttribute(RuleAttribute attr) { RuleAttribute clone = new RuleAttribute(); clone.setAttributeName(attr.getAttributeName()); clone.setValue(attr.getValue()); return clone; }
private void visitRuleAttribute(final RuleAttribute attr) { PartType type = PartType.getPartTypeFromAttribueDescrName(attr.getAttributeName()); switch (type) { case AGENDA_GROUP: case ACTIVATION_GROUP: case RULEFLOW_GROUP: case ENTRY_POINT: SharedPart sharedRef = new SharedPart(attr.getValue(), type); builder.addGenerator(sharedRef); break; // OCRAM: finish default: // logger.info("Not processing attribute: " + descr.getName()); } }
@Test public void testInitTextBoxByRuleAttribute() { final TextBox textBox = mock(TextBox.class); final String attributeValue = "123"; doReturn(attributeValue).when(ruleAttribute).getValue(); factory.initTextBoxByRuleAttribute(textBox, ruleAttribute); verify(textBox).setEnabled(!isReadOnly); verify(textBox).setValue(attributeValue); }