Java Code Examples for ims.rules.types.RuleValueComparator

The following are top voted examples for showing how to use ims.rules.types.RuleValueComparator. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: AvoinApotti   File: Logic.java   Source Code and License 6 votes vote down vote up
private void populateRulesValueCondition(RuleLogicalCondition condition, DynamicGridRow parentRow, int j)
{
	RuleValueCondition ruleValueCondition = (RuleValueCondition) condition.getConditions().get(j);

	// Entry, Comparator, ComparedValue
	RuleValueConditionEntry entry = ruleValueCondition.getEntry();
	RuleValueComparator comparator = ruleValueCondition.getComparator();
	String comparatedValue = ruleValueCondition.getComparedValue();

	DynamicGridRow row = addValueCondition(parentRow, false);
	int count = row.getIdentifier() != null ? (row.getIdentifier() instanceof RuleConditionRowVo ? (((RuleConditionRowVo) row.getIdentifier()).getNumberOfColumns()) : 0) : 0;
	count++;
	try
	{
		addRuleValueConditionCell(row, entry.getChild() != null ? entry.getChild() : entry, count, comparator, comparatedValue);
	}
	catch (ParseException e)
	{
		e.printStackTrace();
	}
}
 
Example 2
Project: openMAXIMS   File: Logic.java   Source Code and License 6 votes vote down vote up
private void populateRulesValueCondition(RuleLogicalCondition condition, DynamicGridRow parentRow, int j)
{
	RuleValueCondition ruleValueCondition = (RuleValueCondition) condition.getConditions().get(j);

	// Entry, Comparator, ComparedValue
	RuleValueConditionEntry entry = ruleValueCondition.getEntry();
	RuleValueComparator comparator = ruleValueCondition.getComparator();
	String comparatedValue = ruleValueCondition.getComparedValue();

	DynamicGridRow row = addValueCondition(parentRow, false);
	int count = row.getIdentifier() != null ? (row.getIdentifier() instanceof RuleConditionRowVo ? (((RuleConditionRowVo) row.getIdentifier()).getNumberOfColumns()) : 0) : 0;
	count++;
	try
	{
		addRuleValueConditionCell(row, entry.getChild() != null ? entry.getChild() : entry, count, comparator, comparatedValue);
	}
	catch (ParseException e)
	{
		e.printStackTrace();
	}
}
 
Example 3
Project: openMAXIMS   File: Logic.java   Source Code and License 6 votes vote down vote up
private void populateRulesValueCondition(RuleLogicalCondition condition, DynamicGridRow parentRow, int j)
{
	RuleValueCondition ruleValueCondition = (RuleValueCondition) condition.getConditions().get(j);

	// Entry, Comparator, ComparedValue
	RuleValueConditionEntry entry = ruleValueCondition.getEntry();
	RuleValueComparator comparator = ruleValueCondition.getComparator();
	String comparatedValue = ruleValueCondition.getComparedValue();

	DynamicGridRow row = addValueCondition(parentRow, false);
	int count = row.getIdentifier() != null ? (row.getIdentifier() instanceof RuleConditionRowVo ? (((RuleConditionRowVo) row.getIdentifier()).getNumberOfColumns()) : 0) : 0;
	count++;
	try
	{
		addRuleValueConditionCell(row, entry.getChild() != null ? entry.getChild() : entry, count, comparator, comparatedValue);
	}
	catch (ParseException e)
	{
		e.printStackTrace();
	}
}
 
Example 4
Project: openmaxims-linux   File: Logic.java   Source Code and License 6 votes vote down vote up
private void populateRulesValueCondition(RuleLogicalCondition condition, DynamicGridRow parentRow, int j)
{
	RuleValueCondition ruleValueCondition = (RuleValueCondition) condition.getConditions().get(j);

	// Entry, Comparator, ComparedValue
	RuleValueConditionEntry entry = ruleValueCondition.getEntry();
	RuleValueComparator comparator = ruleValueCondition.getComparator();
	String comparatedValue = ruleValueCondition.getComparedValue();

	DynamicGridRow row = addValueCondition(parentRow, false);
	int count = row.getIdentifier() != null ? (row.getIdentifier() instanceof RuleConditionRowVo ? (((RuleConditionRowVo) row.getIdentifier()).getNumberOfColumns()) : 0) : 0;
	count++;
	try
	{
		addRuleValueConditionCell(row, entry.getChild() != null ? entry.getChild() : entry, count, comparator, comparatedValue);
	}
	catch (ParseException e)
	{
		e.printStackTrace();
	}
}
 
Example 5
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
private Object getRuleComparator(RuleValueComparator comparator, String comparedValue)
{
	if (comparator == RuleValueComparator.EMPTY)
	{
		return "== null";
	}
	else if (comparator == RuleValueComparator.EQUALS)
	{
		return ".equals(\"<b>" + comparedValue + "</b>\")";
	}
	else if (comparator == RuleValueComparator.GREATEREQUALSTHAN)
	{
		return ">=";
	}
	else if (comparator == RuleValueComparator.GREATERTHAN)
	{
		return ">";
	}
	else if (comparator == RuleValueComparator.LESSEQUALSTHAN)
	{
		return "<=";
	}
	else if (comparator == RuleValueComparator.LESSTHAN)
	{
		return "<";
	}
	else if (comparator == RuleValueComparator.NOTEQUALS)
	{
		return "!=";
	}
	else if (comparator == RuleValueComparator.CONTAINS)
	{
		return ".contains(\"<b>" + comparedValue + "</b>\")";
	}

	return "<ERROR: Rule comparator not supported: " + comparator.toString() + ">";
}
 
Example 6
Project: openMAXIMS   File: Logic.java   Source Code and License 5 votes vote down vote up
private Object getRuleComparator(RuleValueComparator comparator, String comparedValue)
{
	if (comparator == RuleValueComparator.EMPTY)
	{
		return "== null";
	}
	else if (comparator == RuleValueComparator.EQUALS)
	{
		return ".equals(\"<b>" + comparedValue + "</b>\")";
	}
	else if (comparator == RuleValueComparator.GREATEREQUALSTHAN)
	{
		return ">=";
	}
	else if (comparator == RuleValueComparator.GREATERTHAN)
	{
		return ">";
	}
	else if (comparator == RuleValueComparator.LESSEQUALSTHAN)
	{
		return "<=";
	}
	else if (comparator == RuleValueComparator.LESSTHAN)
	{
		return "<";
	}
	else if (comparator == RuleValueComparator.NOTEQUALS)
	{
		return "!=";
	}
	else if (comparator == RuleValueComparator.CONTAINS)
	{
		return ".contains(\"<b>" + comparedValue + "</b>\")";
	}

	return "<ERROR: Rule comparator not supported: " + comparator.toString() + ">";
}
 
Example 7
Project: openMAXIMS   File: Logic.java   Source Code and License 5 votes vote down vote up
private Object getRuleComparator(RuleValueComparator comparator, String comparedValue)
{
	if (comparator == RuleValueComparator.EMPTY)
	{
		return "== null";
	}
	else if (comparator == RuleValueComparator.EQUALS)
	{
		return ".equals(\"<b>" + comparedValue + "</b>\")";
	}
	else if (comparator == RuleValueComparator.GREATEREQUALSTHAN)
	{
		return ">=";
	}
	else if (comparator == RuleValueComparator.GREATERTHAN)
	{
		return ">";
	}
	else if (comparator == RuleValueComparator.LESSEQUALSTHAN)
	{
		return "<=";
	}
	else if (comparator == RuleValueComparator.LESSTHAN)
	{
		return "<";
	}
	else if (comparator == RuleValueComparator.NOTEQUALS)
	{
		return "!=";
	}
	else if (comparator == RuleValueComparator.CONTAINS)
	{
		return ".contains(\"<b>" + comparedValue + "</b>\")";
	}

	return "<ERROR: Rule comparator not supported: " + comparator.toString() + ">";
}
 
Example 8
Project: openmaxims-linux   File: Logic.java   Source Code and License 5 votes vote down vote up
private Object getRuleComparator(RuleValueComparator comparator, String comparedValue)
{
	if (comparator == RuleValueComparator.EMPTY)
	{
		return "== null";
	}
	else if (comparator == RuleValueComparator.EQUALS)
	{
		return ".equals(\"<b>" + comparedValue + "</b>\")";
	}
	else if (comparator == RuleValueComparator.GREATEREQUALSTHAN)
	{
		return ">=";
	}
	else if (comparator == RuleValueComparator.GREATERTHAN)
	{
		return ">";
	}
	else if (comparator == RuleValueComparator.LESSEQUALSTHAN)
	{
		return "<=";
	}
	else if (comparator == RuleValueComparator.LESSTHAN)
	{
		return "<";
	}
	else if (comparator == RuleValueComparator.NOTEQUALS)
	{
		return "!=";
	}
	else if (comparator == RuleValueComparator.CONTAINS)
	{
		return ".contains(\"<b>" + comparedValue + "</b>\")";
	}

	return "<ERROR: Rule comparator not supported: " + comparator.toString() + ">";
}
 
Example 9
Project: AvoinApotti   File: Logic.java   Source Code and License 4 votes vote down vote up
private void createCellsByType(RulesEngineField identifier, DynamicGridCell cell)
{
	int nextCollAvaible = clearRightCells((Integer) cell.getColumn().getIdentifier(), cell.getRow());
	RulesEngineFieldType type = identifier.getType();

	DynamicGridRow row = cell.getRow();
	RuleConditionRowVo vo = (RuleConditionRowVo) row.getIdentifier();
	int count = vo.getNumberOfColumns();

	DynamicGridColumn coll = null;
	if (nextCollAvaible != 0)
	{
		coll = getColByIndex(nextCollAvaible);
		if (coll == null)
		{
			coll = createColumn("", nextCollAvaible);
		}
	}
	else
	{
		count++;
		coll = getColByIndex(count);
		if (coll == null)
		{
			coll = createColumn("", count);
		}
	}

	setRowIdentifier(row, count, RuleConditionType.VALUE);

	count++;

	DynamicGridCell conditionValueCell = cell.getRow().getCells().newCell(coll, DynamicCellType.ENUMERATION);
	for (int j = 0; j < type.getComparators().length; j++)
	{
		if (checkRowForAnyCollection(cell))
		{
			if (type.getComparators()[j].equals(RuleValueComparator.NOTEQUALS))
				continue;
		}

		DynamicGridCellItem item = conditionValueCell.getItems().newItem(type.getComparators()[j]);
		item.setIdentifier(type.getComparators()[j]);
		conditionValueCell.setValue(type.getComparators()[j]);
		conditionValueCell.setIdentifier(type.getComparators()[j]);
	}

	setRowIdentifier(row, count, RuleConditionType.VALUE);

	conditionValueCell.setAutoPostBack(true);
	count++;

	DynamicGridColumn colll = getColByIndex(count);
	DynamicGridCell cellValue = null;

	if (colll == null)
	{
		colll = createColumn("", count);
	}

	setRowIdentifier(row, count, RuleConditionType.VALUE);

	createCellByType(identifier, cell, type, colll, cellValue);
}
 
Example 10
Project: openMAXIMS   File: Logic.java   Source Code and License 4 votes vote down vote up
private void createCellsByType(RulesEngineField identifier, DynamicGridCell cell)
{
	int nextCollAvaible = clearRightCells((Integer) cell.getColumn().getIdentifier(), cell.getRow());
	RulesEngineFieldType type = identifier.getType();

	DynamicGridRow row = cell.getRow();
	RuleConditionRowVo vo = (RuleConditionRowVo) row.getIdentifier();
	int count = vo.getNumberOfColumns();

	DynamicGridColumn coll = null;
	if (nextCollAvaible != 0)
	{
		coll = getColByIndex(nextCollAvaible);
		if (coll == null)
		{
			coll = createColumn("", nextCollAvaible);
		}
	}
	else
	{
		count++;
		coll = getColByIndex(count);
		if (coll == null)
		{
			coll = createColumn("", count);
		}
	}

	setRowIdentifier(row, count, RuleConditionType.VALUE);

	count++;

	DynamicGridCell conditionValueCell = cell.getRow().getCells().newCell(coll, DynamicCellType.ENUMERATION);
	for (int j = 0; j < type.getComparators().length; j++)
	{
		if (checkRowForAnyCollection(cell))
		{
			if (type.getComparators()[j].equals(RuleValueComparator.NOTEQUALS))
				continue;
		}

		DynamicGridCellItem item = conditionValueCell.getItems().newItem(type.getComparators()[j]);
		item.setIdentifier(type.getComparators()[j]);
		conditionValueCell.setValue(type.getComparators()[j]);
		conditionValueCell.setIdentifier(type.getComparators()[j]);
	}

	setRowIdentifier(row, count, RuleConditionType.VALUE);

	conditionValueCell.setAutoPostBack(true);
	count++;

	DynamicGridColumn colll = getColByIndex(count);
	DynamicGridCell cellValue = null;

	if (colll == null)
	{
		colll = createColumn("", count);
	}

	setRowIdentifier(row, count, RuleConditionType.VALUE);

	createCellByType(identifier, cell, type, colll, cellValue);
}
 
Example 11
Project: openMAXIMS   File: Logic.java   Source Code and License 4 votes vote down vote up
private void createCellsByType(RulesEngineField identifier, DynamicGridCell cell)
{
	int nextCollAvaible = clearRightCells((Integer) cell.getColumn().getIdentifier(), cell.getRow());
	RulesEngineFieldType type = identifier.getType();

	DynamicGridRow row = cell.getRow();
	RuleConditionRowVo vo = (RuleConditionRowVo) row.getIdentifier();
	int count = vo.getNumberOfColumns();

	DynamicGridColumn coll = null;
	if (nextCollAvaible != 0)
	{
		coll = getColByIndex(nextCollAvaible);
		if (coll == null)
		{
			coll = createColumn("", nextCollAvaible);
		}
	}
	else
	{
		count++;
		coll = getColByIndex(count);
		if (coll == null)
		{
			coll = createColumn("", count);
		}
	}

	setRowIdentifier(row, count, RuleConditionType.VALUE);

	count++;

	DynamicGridCell conditionValueCell = cell.getRow().getCells().newCell(coll, DynamicCellType.ENUMERATION);
	for (int j = 0; j < type.getComparators().length; j++)
	{
		if (checkRowForAnyCollection(cell))
		{
			if (type.getComparators()[j].equals(RuleValueComparator.NOTEQUALS))
				continue;
		}

		DynamicGridCellItem item = conditionValueCell.getItems().newItem(type.getComparators()[j]);
		item.setIdentifier(type.getComparators()[j]);
		conditionValueCell.setValue(type.getComparators()[j]);
		conditionValueCell.setIdentifier(type.getComparators()[j]);
	}

	setRowIdentifier(row, count, RuleConditionType.VALUE);

	conditionValueCell.setAutoPostBack(true);
	count++;

	DynamicGridColumn colll = getColByIndex(count);
	DynamicGridCell cellValue = null;

	if (colll == null)
	{
		colll = createColumn("", count);
	}

	setRowIdentifier(row, count, RuleConditionType.VALUE);

	createCellByType(identifier, cell, type, colll, cellValue);
}
 
Example 12
Project: openmaxims-linux   File: Logic.java   Source Code and License 4 votes vote down vote up
private void createCellsByType(RulesEngineField identifier, DynamicGridCell cell)
{
	int nextCollAvaible = clearRightCells((Integer) cell.getColumn().getIdentifier(), cell.getRow());
	RulesEngineFieldType type = identifier.getType();

	DynamicGridRow row = cell.getRow();
	RuleConditionRowVo vo = (RuleConditionRowVo) row.getIdentifier();
	int count = vo.getNumberOfColumns();

	DynamicGridColumn coll = null;
	if (nextCollAvaible != 0)
	{
		coll = getColByIndex(nextCollAvaible);
		if (coll == null)
		{
			coll = createColumn("", nextCollAvaible);
		}
	}
	else
	{
		count++;
		coll = getColByIndex(count);
		if (coll == null)
		{
			coll = createColumn("", count);
		}
	}

	setRowIdentifier(row, count, RuleConditionType.VALUE);

	count++;

	DynamicGridCell conditionValueCell = cell.getRow().getCells().newCell(coll, DynamicCellType.ENUMERATION);
	for (int j = 0; j < type.getComparators().length; j++)
	{
		if (checkRowForAnyCollection(cell))
		{
			if (type.getComparators()[j].equals(RuleValueComparator.NOTEQUALS))
				continue;
		}

		DynamicGridCellItem item = conditionValueCell.getItems().newItem(type.getComparators()[j]);
		item.setIdentifier(type.getComparators()[j]);
		conditionValueCell.setValue(type.getComparators()[j]);
		conditionValueCell.setIdentifier(type.getComparators()[j]);
	}

	setRowIdentifier(row, count, RuleConditionType.VALUE);

	conditionValueCell.setAutoPostBack(true);
	count++;

	DynamicGridColumn colll = getColByIndex(count);
	DynamicGridCell cellValue = null;

	if (colll == null)
	{
		colll = createColumn("", count);
	}

	setRowIdentifier(row, count, RuleConditionType.VALUE);

	createCellByType(identifier, cell, type, colll, cellValue);
}