Java Code Examples for ims.rules.types.RulesEngineEntity

The following are top voted examples for showing how to use ims.rules.types.RulesEngineEntity. 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: RulesPriorityEditorImpl.java   Source Code and License 6 votes vote down vote up
/**
 * 
 */
public BusinessRuleVoCollection list(RulesEngineEntity entity)
{
	if (entity == null)
		return null;
	
	DomainFactory factory = getDomainFactory();
	IMSCriteria criteria = new IMSCriteria(BusinessRule.class, factory);
	criteria.equal("this.rootEntity", entity.getId());
	criteria.equal("this.active", true);
	
	List rules = criteria.find();
	Collections.sort(rules, new BusinessRuleComparator(SortOrder.DESCENDING));
	
	return BusinessRuleVoAssembler.createBusinessRuleVoCollectionFromBusinessRule(rules);
}
 
Example 2
Project: openMAXIMS   File: RulesPriorityEditorImpl.java   Source Code and License 6 votes vote down vote up
/**
 * 
 */
public BusinessRuleVoCollection list(RulesEngineEntity entity)
{
	if (entity == null)
		return null;
	
	DomainFactory factory = getDomainFactory();
	IMSCriteria criteria = new IMSCriteria(BusinessRule.class, factory);
	criteria.equal("this.rootEntity", entity.getId());
	criteria.equal("this.active", true);
	
	List rules = criteria.find();
	Collections.sort(rules, new BusinessRuleComparator(SortOrder.DESCENDING));
	
	return BusinessRuleVoAssembler.createBusinessRuleVoCollectionFromBusinessRule(rules);
}
 
Example 3
Project: openMAXIMS   File: RulesPriorityEditorImpl.java   Source Code and License 6 votes vote down vote up
/**
 * 
 */
public BusinessRuleVoCollection list(RulesEngineEntity entity)
{
	if (entity == null)
		return null;
	
	DomainFactory factory = getDomainFactory();
	IMSCriteria criteria = new IMSCriteria(BusinessRule.class, factory);
	criteria.equal("this.rootEntity", entity.getId());
	criteria.equal("this.active", true);
	
	List rules = criteria.find();
	Collections.sort(rules, new BusinessRuleComparator(SortOrder.DESCENDING));
	
	return BusinessRuleVoAssembler.createBusinessRuleVoCollectionFromBusinessRule(rules);
}
 
Example 4
Project: openmaxims-linux   File: RulesPriorityEditorImpl.java   Source Code and License 6 votes vote down vote up
/**
 * 
 */
public BusinessRuleVoCollection list(RulesEngineEntity entity)
{
	if (entity == null)
		return null;
	
	DomainFactory factory = getDomainFactory();
	IMSCriteria criteria = new IMSCriteria(BusinessRule.class, factory);
	criteria.equal("this.rootEntity", entity.getId());
	criteria.equal("this.active", true);
	
	List rules = criteria.find();
	Collections.sort(rules, new BusinessRuleComparator(SortOrder.DESCENDING));
	
	return BusinessRuleVoAssembler.createBusinessRuleVoCollectionFromBusinessRule(rules);
}
 
Example 5
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
/**
 * 
 */
private void populateRootEntities()
{
	// Clear the combobox
	form.cmbEntity().clear();

	// Get all public entities
	List<RulesEngineEntity> entities = Entities.getInstance().getAllPublicEntities();

	// Populate the combobox
	for (int i = 0; i < entities.size(); i++)
	{
		form.cmbEntity().newRow(entities.get(i), entities.get(i).getName());
	}
}
 
Example 6
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
/**
 * 
 */
private void setRulesEntities()
{
	// Clear combobox
	form.cmbEntity().clear();
	
	List<RulesEngineEntity> entities = new Entities().getAllPublicEntities();
	
	for (int i = 0 ; i < entities.size(); i++)
	{
		form.cmbEntity().newRow(entities.get(i), entities.get(i).getName());
	}
	
}
 
Example 7
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
private void populateSearchCriteria(boolean isActive, String name, String rulesEngineEntityID, Integer categoryID) 
{
	form.chkActiveOnly().setValue(isActive);
	form.txtRuleName().setValue(name);
	
	if (rulesEngineEntityID != null)
	{
		List<RulesEngineEntity> entities = new Entities().getAllPublicEntities();		
		for (int i = 0 ; i < entities.size(); i++)
		{
			if (rulesEngineEntityID.equals(entities.get(i).getId()))
			{
				form.cmbEntity().setValue(entities.get(i));
				break;
			}
		}
	}
	
	if (categoryID != null)
	{
		for (int i = 0; i < form.treRootEntity().getNodes().size(); i++) 
		{
			if (form.treRootEntity().getNodes().get(i).getValue() instanceof BusinessRuleCategory &&
					((BusinessRuleCategory)form.treRootEntity().getNodes().get(i).getValue()).getID() == categoryID)
			{
				form.treRootEntity().setValue(form.treRootEntity().getNodes().get(i).getValue());
				break;
			}
		}
	}
}
 
Example 8
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
private void populateRootEntity()
{
	form.lyrRules().tabConditions().cmbRootEntity().clear();
	List<RulesEngineEntity> entities = new Entities().getAllPublicEntities();

	Collections.sort(entities, new RulesEngineEntityComparator());

	for (int i = 0; i < entities.size(); i++)
	{
		form.lyrRules().tabConditions().cmbRootEntity().newRow(entities.get(i), entities.get(i).getName());
	}
}
 
Example 9
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
private void addEntityField()
{
	DynamicGridRow entityFieldInstanceRow = form.lyrRules().tabActions().dyngrdActions().getSelectedRow().getRows().newRow();
	entityFieldInstanceRow.setSelectable(true);

	RuleConditionRowVo vo = (RuleConditionRowVo) entityFieldInstanceRow.getIdentifier();

	int count = 1;

	if (vo != null)
		count = vo.getNumberOfColumns();

	setRowIdentifier(entityFieldInstanceRow, count, null);

	DynamicGridColumn valueColl = getColByIndexForActionGrid(count);
	if (valueColl == null)
	{
		valueColl = createColumnForActionGrid("", count);
	}

	setRowIdentifier(entityFieldInstanceRow, count, null);

	DynamicGridCell valueCell = entityFieldInstanceRow.getCells().newCell(valueColl, DynamicCellType.ENUMERATION);
	List<RulesEngineEntity> entities = new Entities().getAllPublicEntities();

	for (int i = 0; i < entities.size(); i++)
	{
		valueCell.getItems().newItem().setValue(entities.get(i).getName());
		valueCell.getItems().get(i).setIdentifier(entities.get(i));
	}
	valueCell.setValue(form.lyrRules().tabConditions().cmbRootEntity().getValue().getName());
	valueCell.setReadOnly(true);

	onDyngrdActionsCellValueChanged(valueCell);

	valueCell.setAutoPostBack(true);
	valueCell.setWidth(0);
}
 
Example 10
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
private void populateRulesNotificationEntry(RuleValueConditionEntry entry, DynamicGridRow parentRow)
{
	DynamicGridRow row = parentRow.getRows().newRow();
	DynamicGridColumn valueColl = getColByIndexForActionGrid(1);
	if (valueColl == null)
	{
		valueColl = createColumnForActionGrid("", 1);
	}

	setRowIdentifier(row, 1, RuleConditionType.VALUE);

	DynamicGridCell valueCell = row.getCells().newCell(valueColl, DynamicCellType.ENUMERATION);
	List<RulesEngineEntity> entities = new Entities().getAllPublicEntities();

	for (int i = 0; i < entities.size(); i++)
	{
		valueCell.getItems().newItem().setValue(entities.get(i).getName());
		valueCell.getItems().get(i).setIdentifier(entities.get(i));
	}
	valueCell.setValue(form.lyrRules().tabConditions().cmbRootEntity().getValue().getName());
	valueCell.setReadOnly(true);

	valueCell.setAutoPostBack(true);
	valueCell.setWidth(0);

	int count = row.getIdentifier() != null ? (row.getIdentifier() instanceof RuleConditionRowVo ? (((RuleConditionRowVo) row.getIdentifier()).getNumberOfColumns()) : 0) : 0;
	count++;
	try
	{
		addRuleNotificationCell(row, entry.getChild() != null ? entry.getChild() : entry, count);
	}
	catch (ParseException e)
	{
		e.printStackTrace();
	}
}
 
Example 11
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
public int compare(RulesEngineEntity o1, RulesEngineEntity o2)
{
	if (o1.getName() == null || o2.getName() == null)
		return 0;
	
	return o1.getName().compareToIgnoreCase(o2.getName());
}
 
Example 12
Project: AvoinApotti   File: Entities.java   Source Code and License 5 votes vote down vote up
public List<RulesEngineEntity> getAllPublicEntities()
{
	List<RulesEngineEntity> all = getAllEntities();
	List<RulesEngineEntity> result = new ArrayList<RulesEngineEntity>();
		for(int x = 0; x < all.size(); x++)
		{
			if(all.get(x).isPublic())
			{
				result.add(all.get(x));
			}
		}
	return result;
}
 
Example 13
Project: AvoinApotti   File: Entities.java   Source Code and License 5 votes vote down vote up
public RulesEngineEntity getEntityById(String id)
{
	for(int x = 0; x < getAllEntities().size(); x++)
	{
		if(getAllEntities().get(x).getId().equals((id)))
			return getAllEntities().get(x);
	}

	return null;
}
 
Example 14
Project: openMAXIMS   File: Logic.java   Source Code and License 5 votes vote down vote up
/**
 * 
 */
private void populateRootEntities()
{
	// Clear the combobox
	form.cmbEntity().clear();

	// Get all public entities
	List<RulesEngineEntity> entities = Entities.getInstance().getAllPublicEntities();

	// Populate the combobox
	for (int i = 0; i < entities.size(); i++)
	{
		form.cmbEntity().newRow(entities.get(i), entities.get(i).getName());
	}
}
 
Example 15
Project: openMAXIMS   File: Logic.java   Source Code and License 5 votes vote down vote up
/**
 * 
 */
private void setRulesEntities()
{
	// Clear combobox
	form.cmbEntity().clear();
	
	List<RulesEngineEntity> entities = new Entities().getAllPublicEntities();
	
	for (int i = 0 ; i < entities.size(); i++)
	{
		form.cmbEntity().newRow(entities.get(i), entities.get(i).getName());
	}
	
}
 
Example 16
Project: openMAXIMS   File: Logic.java   Source Code and License 5 votes vote down vote up
private void populateSearchCriteria(boolean isActive, String name, String rulesEngineEntityID, Integer categoryID) 
{
	form.chkActiveOnly().setValue(isActive);
	form.txtRuleName().setValue(name);
	
	if (rulesEngineEntityID != null)
	{
		List<RulesEngineEntity> entities = new Entities().getAllPublicEntities();		
		for (int i = 0 ; i < entities.size(); i++)
		{
			if (rulesEngineEntityID.equals(entities.get(i).getId()))
			{
				form.cmbEntity().setValue(entities.get(i));
				break;
			}
		}
	}
	
	if (categoryID != null)
	{
		for (int i = 0; i < form.treRootEntity().getNodes().size(); i++) 
		{
			if (form.treRootEntity().getNodes().get(i).getValue() instanceof BusinessRuleCategory &&
					((BusinessRuleCategory)form.treRootEntity().getNodes().get(i).getValue()).getID() == categoryID)
			{
				form.treRootEntity().setValue(form.treRootEntity().getNodes().get(i).getValue());
				break;
			}
		}
	}
}
 
Example 17
Project: openMAXIMS   File: Logic.java   Source Code and License 5 votes vote down vote up
private void populateRootEntity()
{
	form.lyrRules().tabConditions().cmbRootEntity().clear();
	List<RulesEngineEntity> entities = new Entities().getAllPublicEntities();

	Collections.sort(entities, new RulesEngineEntityComparator());

	for (int i = 0; i < entities.size(); i++)
	{
		form.lyrRules().tabConditions().cmbRootEntity().newRow(entities.get(i), entities.get(i).getName());
	}
}
 
Example 18
Project: openMAXIMS   File: Logic.java   Source Code and License 5 votes vote down vote up
private void addEntityField()
{
	DynamicGridRow entityFieldInstanceRow = form.lyrRules().tabActions().dyngrdActions().getSelectedRow().getRows().newRow();
	entityFieldInstanceRow.setSelectable(true);

	RuleConditionRowVo vo = (RuleConditionRowVo) entityFieldInstanceRow.getIdentifier();

	int count = 1;

	if (vo != null)
		count = vo.getNumberOfColumns();

	setRowIdentifier(entityFieldInstanceRow, count, null);

	DynamicGridColumn valueColl = getColByIndexForActionGrid(count);
	if (valueColl == null)
	{
		valueColl = createColumnForActionGrid("", count);
	}

	setRowIdentifier(entityFieldInstanceRow, count, null);

	DynamicGridCell valueCell = entityFieldInstanceRow.getCells().newCell(valueColl, DynamicCellType.ENUMERATION);
	List<RulesEngineEntity> entities = new Entities().getAllPublicEntities();

	for (int i = 0; i < entities.size(); i++)
	{
		valueCell.getItems().newItem().setValue(entities.get(i).getName());
		valueCell.getItems().get(i).setIdentifier(entities.get(i));
	}
	valueCell.setValue(form.lyrRules().tabConditions().cmbRootEntity().getValue().getName());
	valueCell.setReadOnly(true);

	onDyngrdActionsCellValueChanged(valueCell);

	valueCell.setAutoPostBack(true);
	valueCell.setWidth(0);
}
 
Example 19
Project: openMAXIMS   File: Logic.java   Source Code and License 5 votes vote down vote up
private void populateRulesNotificationEntry(RuleValueConditionEntry entry, DynamicGridRow parentRow)
{
	DynamicGridRow row = parentRow.getRows().newRow();
	DynamicGridColumn valueColl = getColByIndexForActionGrid(1);
	if (valueColl == null)
	{
		valueColl = createColumnForActionGrid("", 1);
	}

	setRowIdentifier(row, 1, RuleConditionType.VALUE);

	DynamicGridCell valueCell = row.getCells().newCell(valueColl, DynamicCellType.ENUMERATION);
	List<RulesEngineEntity> entities = new Entities().getAllPublicEntities();

	for (int i = 0; i < entities.size(); i++)
	{
		valueCell.getItems().newItem().setValue(entities.get(i).getName());
		valueCell.getItems().get(i).setIdentifier(entities.get(i));
	}
	valueCell.setValue(form.lyrRules().tabConditions().cmbRootEntity().getValue().getName());
	valueCell.setReadOnly(true);

	valueCell.setAutoPostBack(true);
	valueCell.setWidth(0);

	int count = row.getIdentifier() != null ? (row.getIdentifier() instanceof RuleConditionRowVo ? (((RuleConditionRowVo) row.getIdentifier()).getNumberOfColumns()) : 0) : 0;
	count++;
	try
	{
		addRuleNotificationCell(row, entry.getChild() != null ? entry.getChild() : entry, count);
	}
	catch (ParseException e)
	{
		e.printStackTrace();
	}
}
 
Example 20
Project: openMAXIMS   File: Logic.java   Source Code and License 5 votes vote down vote up
public int compare(RulesEngineEntity o1, RulesEngineEntity o2)
{
	if (o1.getName() == null || o2.getName() == null)
		return 0;
	
	return o1.getName().compareToIgnoreCase(o2.getName());
}
 
Example 21
Project: openMAXIMS   File: Entities.java   Source Code and License 5 votes vote down vote up
public List<RulesEngineEntity> getAllPublicEntities()
{
	List<RulesEngineEntity> all = getAllEntities();
	List<RulesEngineEntity> result = new ArrayList<RulesEngineEntity>();
		for(int x = 0; x < all.size(); x++)
		{
			if(all.get(x).isPublic())
			{
				result.add(all.get(x));
			}
		}
	return result;
}
 
Example 22
Project: openMAXIMS   File: Entities.java   Source Code and License 5 votes vote down vote up
public RulesEngineEntity getEntityById(String id)
{
	for(int x = 0; x < getAllEntities().size(); x++)
	{
		if(getAllEntities().get(x).getId().equals((id)))
			return getAllEntities().get(x);
	}

	return null;
}
 
Example 23
Project: openMAXIMS   File: Logic.java   Source Code and License 5 votes vote down vote up
/**
 * 
 */
private void populateRootEntities()
{
	// Clear the combobox
	form.cmbEntity().clear();

	// Get all public entities
	List<RulesEngineEntity> entities = Entities.getInstance().getAllPublicEntities();

	// Populate the combobox
	for (int i = 0; i < entities.size(); i++)
	{
		form.cmbEntity().newRow(entities.get(i), entities.get(i).getName());
	}
}
 
Example 24
Project: openMAXIMS   File: Logic.java   Source Code and License 5 votes vote down vote up
/**
 * 
 */
private void setRulesEntities()
{
	// Clear combobox
	form.cmbEntity().clear();
	
	List<RulesEngineEntity> entities = new Entities().getAllPublicEntities();
	
	for (int i = 0 ; i < entities.size(); i++)
	{
		form.cmbEntity().newRow(entities.get(i), entities.get(i).getName());
	}
	
}
 
Example 25
Project: openMAXIMS   File: Logic.java   Source Code and License 5 votes vote down vote up
private void populateSearchCriteria(boolean isActive, String name, String rulesEngineEntityID, Integer categoryID) 
{
	form.chkActiveOnly().setValue(isActive);
	form.txtRuleName().setValue(name);
	
	if (rulesEngineEntityID != null)
	{
		List<RulesEngineEntity> entities = new Entities().getAllPublicEntities();		
		for (int i = 0 ; i < entities.size(); i++)
		{
			if (rulesEngineEntityID.equals(entities.get(i).getId()))
			{
				form.cmbEntity().setValue(entities.get(i));
				break;
			}
		}
	}
	
	if (categoryID != null)
	{
		for (int i = 0; i < form.treRootEntity().getNodes().size(); i++) 
		{
			if (form.treRootEntity().getNodes().get(i).getValue() instanceof BusinessRuleCategory &&
					((BusinessRuleCategory)form.treRootEntity().getNodes().get(i).getValue()).getID() == categoryID)
			{
				form.treRootEntity().setValue(form.treRootEntity().getNodes().get(i).getValue());
				break;
			}
		}
	}
}
 
Example 26
Project: openMAXIMS   File: Logic.java   Source Code and License 5 votes vote down vote up
private void populateRootEntity()
{
	form.lyrRules().tabConditions().cmbRootEntity().clear();
	List<RulesEngineEntity> entities = new Entities().getAllPublicEntities();

	Collections.sort(entities, new RulesEngineEntityComparator());

	for (int i = 0; i < entities.size(); i++)
	{
		form.lyrRules().tabConditions().cmbRootEntity().newRow(entities.get(i), entities.get(i).getName());
	}
}
 
Example 27
Project: openMAXIMS   File: Logic.java   Source Code and License 5 votes vote down vote up
private void addEntityField()
{
	DynamicGridRow entityFieldInstanceRow = form.lyrRules().tabActions().dyngrdActions().getSelectedRow().getRows().newRow();
	entityFieldInstanceRow.setSelectable(true);

	RuleConditionRowVo vo = (RuleConditionRowVo) entityFieldInstanceRow.getIdentifier();

	int count = 1;

	if (vo != null)
		count = vo.getNumberOfColumns();

	setRowIdentifier(entityFieldInstanceRow, count, null);

	DynamicGridColumn valueColl = getColByIndexForActionGrid(count);
	if (valueColl == null)
	{
		valueColl = createColumnForActionGrid("", count);
	}

	setRowIdentifier(entityFieldInstanceRow, count, null);

	DynamicGridCell valueCell = entityFieldInstanceRow.getCells().newCell(valueColl, DynamicCellType.ENUMERATION);
	List<RulesEngineEntity> entities = new Entities().getAllPublicEntities();

	for (int i = 0; i < entities.size(); i++)
	{
		valueCell.getItems().newItem().setValue(entities.get(i).getName());
		valueCell.getItems().get(i).setIdentifier(entities.get(i));
	}
	valueCell.setValue(form.lyrRules().tabConditions().cmbRootEntity().getValue().getName());
	valueCell.setReadOnly(true);

	onDyngrdActionsCellValueChanged(valueCell);

	valueCell.setAutoPostBack(true);
	valueCell.setWidth(0);
}
 
Example 28
Project: openMAXIMS   File: Logic.java   Source Code and License 5 votes vote down vote up
private void populateRulesNotificationEntry(RuleValueConditionEntry entry, DynamicGridRow parentRow)
{
	DynamicGridRow row = parentRow.getRows().newRow();
	DynamicGridColumn valueColl = getColByIndexForActionGrid(1);
	if (valueColl == null)
	{
		valueColl = createColumnForActionGrid("", 1);
	}

	setRowIdentifier(row, 1, RuleConditionType.VALUE);

	DynamicGridCell valueCell = row.getCells().newCell(valueColl, DynamicCellType.ENUMERATION);
	List<RulesEngineEntity> entities = new Entities().getAllPublicEntities();

	for (int i = 0; i < entities.size(); i++)
	{
		valueCell.getItems().newItem().setValue(entities.get(i).getName());
		valueCell.getItems().get(i).setIdentifier(entities.get(i));
	}
	valueCell.setValue(form.lyrRules().tabConditions().cmbRootEntity().getValue().getName());
	valueCell.setReadOnly(true);

	valueCell.setAutoPostBack(true);
	valueCell.setWidth(0);

	int count = row.getIdentifier() != null ? (row.getIdentifier() instanceof RuleConditionRowVo ? (((RuleConditionRowVo) row.getIdentifier()).getNumberOfColumns()) : 0) : 0;
	count++;
	try
	{
		addRuleNotificationCell(row, entry.getChild() != null ? entry.getChild() : entry, count);
	}
	catch (ParseException e)
	{
		e.printStackTrace();
	}
}
 
Example 29
Project: openMAXIMS   File: Logic.java   Source Code and License 5 votes vote down vote up
public int compare(RulesEngineEntity o1, RulesEngineEntity o2)
{
	if (o1.getName() == null || o2.getName() == null)
		return 0;
	
	return o1.getName().compareToIgnoreCase(o2.getName());
}
 
Example 30
Project: openMAXIMS   File: Entities.java   Source Code and License 5 votes vote down vote up
public List<RulesEngineEntity> getAllPublicEntities()
{
	List<RulesEngineEntity> all = getAllEntities();
	List<RulesEngineEntity> result = new ArrayList<RulesEngineEntity>();
		for(int x = 0; x < all.size(); x++)
		{
			if(all.get(x).isPublic())
			{
				result.add(all.get(x));
			}
		}
	return result;
}
 
Example 31
Project: openMAXIMS   File: Entities.java   Source Code and License 5 votes vote down vote up
public RulesEngineEntity getEntityById(String id)
{
	for(int x = 0; x < getAllEntities().size(); x++)
	{
		if(getAllEntities().get(x).getId().equals((id)))
			return getAllEntities().get(x);
	}

	return null;
}
 
Example 32
Project: openmaxims-linux   File: Logic.java   Source Code and License 5 votes vote down vote up
/**
 * 
 */
private void populateRootEntities()
{
	// Clear the combobox
	form.cmbEntity().clear();

	// Get all public entities
	List<RulesEngineEntity> entities = Entities.getInstance().getAllPublicEntities();

	// Populate the combobox
	for (int i = 0; i < entities.size(); i++)
	{
		form.cmbEntity().newRow(entities.get(i), entities.get(i).getName());
	}
}
 
Example 33
Project: openmaxims-linux   File: Logic.java   Source Code and License 5 votes vote down vote up
/**
 * 
 */
private void setRulesEntities()
{
	// Clear combobox
	form.cmbEntity().clear();
	
	List<RulesEngineEntity> entities = new Entities().getAllPublicEntities();
	
	for (int i = 0 ; i < entities.size(); i++)
	{
		form.cmbEntity().newRow(entities.get(i), entities.get(i).getName());
	}
	
}
 
Example 34
Project: openmaxims-linux   File: Logic.java   Source Code and License 5 votes vote down vote up
private void populateSearchCriteria(boolean isActive, String name, String rulesEngineEntityID, Integer categoryID) 
{
	form.chkActiveOnly().setValue(isActive);
	form.txtRuleName().setValue(name);
	
	if (rulesEngineEntityID != null)
	{
		List<RulesEngineEntity> entities = new Entities().getAllPublicEntities();		
		for (int i = 0 ; i < entities.size(); i++)
		{
			if (rulesEngineEntityID.equals(entities.get(i).getId()))
			{
				form.cmbEntity().setValue(entities.get(i));
				break;
			}
		}
	}
	
	if (categoryID != null)
	{
		for (int i = 0; i < form.treRootEntity().getNodes().size(); i++) 
		{
			if (form.treRootEntity().getNodes().get(i).getValue() instanceof BusinessRuleCategory &&
					((BusinessRuleCategory)form.treRootEntity().getNodes().get(i).getValue()).getID() == categoryID)
			{
				form.treRootEntity().setValue(form.treRootEntity().getNodes().get(i).getValue());
				break;
			}
		}
	}
}
 
Example 35
Project: openmaxims-linux   File: Logic.java   Source Code and License 5 votes vote down vote up
private void populateRootEntity()
{
	form.lyrRules().tabConditions().cmbRootEntity().clear();
	List<RulesEngineEntity> entities = new Entities().getAllPublicEntities();

	Collections.sort(entities, new RulesEngineEntityComparator());

	for (int i = 0; i < entities.size(); i++)
	{
		form.lyrRules().tabConditions().cmbRootEntity().newRow(entities.get(i), entities.get(i).getName());
	}
}
 
Example 36
Project: openmaxims-linux   File: Logic.java   Source Code and License 5 votes vote down vote up
private void addEntityField()
{
	DynamicGridRow entityFieldInstanceRow = form.lyrRules().tabActions().dyngrdActions().getSelectedRow().getRows().newRow();
	entityFieldInstanceRow.setSelectable(true);

	RuleConditionRowVo vo = (RuleConditionRowVo) entityFieldInstanceRow.getIdentifier();

	int count = 1;

	if (vo != null)
		count = vo.getNumberOfColumns();

	setRowIdentifier(entityFieldInstanceRow, count, null);

	DynamicGridColumn valueColl = getColByIndexForActionGrid(count);
	if (valueColl == null)
	{
		valueColl = createColumnForActionGrid("", count);
	}

	setRowIdentifier(entityFieldInstanceRow, count, null);

	DynamicGridCell valueCell = entityFieldInstanceRow.getCells().newCell(valueColl, DynamicCellType.ENUMERATION);
	List<RulesEngineEntity> entities = new Entities().getAllPublicEntities();

	for (int i = 0; i < entities.size(); i++)
	{
		valueCell.getItems().newItem().setValue(entities.get(i).getName());
		valueCell.getItems().get(i).setIdentifier(entities.get(i));
	}
	valueCell.setValue(form.lyrRules().tabConditions().cmbRootEntity().getValue().getName());
	valueCell.setReadOnly(true);

	onDyngrdActionsCellValueChanged(valueCell);

	valueCell.setAutoPostBack(true);
	valueCell.setWidth(0);
}
 
Example 37
Project: openmaxims-linux   File: Logic.java   Source Code and License 5 votes vote down vote up
private void populateRulesNotificationEntry(RuleValueConditionEntry entry, DynamicGridRow parentRow)
{
	DynamicGridRow row = parentRow.getRows().newRow();
	DynamicGridColumn valueColl = getColByIndexForActionGrid(1);
	if (valueColl == null)
	{
		valueColl = createColumnForActionGrid("", 1);
	}

	setRowIdentifier(row, 1, RuleConditionType.VALUE);

	DynamicGridCell valueCell = row.getCells().newCell(valueColl, DynamicCellType.ENUMERATION);
	List<RulesEngineEntity> entities = new Entities().getAllPublicEntities();

	for (int i = 0; i < entities.size(); i++)
	{
		valueCell.getItems().newItem().setValue(entities.get(i).getName());
		valueCell.getItems().get(i).setIdentifier(entities.get(i));
	}
	valueCell.setValue(form.lyrRules().tabConditions().cmbRootEntity().getValue().getName());
	valueCell.setReadOnly(true);

	valueCell.setAutoPostBack(true);
	valueCell.setWidth(0);

	int count = row.getIdentifier() != null ? (row.getIdentifier() instanceof RuleConditionRowVo ? (((RuleConditionRowVo) row.getIdentifier()).getNumberOfColumns()) : 0) : 0;
	count++;
	try
	{
		addRuleNotificationCell(row, entry.getChild() != null ? entry.getChild() : entry, count);
	}
	catch (ParseException e)
	{
		e.printStackTrace();
	}
}
 
Example 38
Project: openmaxims-linux   File: Logic.java   Source Code and License 5 votes vote down vote up
public int compare(RulesEngineEntity o1, RulesEngineEntity o2)
{
	if (o1.getName() == null || o2.getName() == null)
		return 0;
	
	return o1.getName().compareToIgnoreCase(o2.getName());
}
 
Example 39
Project: openmaxims-linux   File: Entities.java   Source Code and License 5 votes vote down vote up
public List<RulesEngineEntity> getAllPublicEntities()
{
	List<RulesEngineEntity> all = getAllEntities();
	List<RulesEngineEntity> result = new ArrayList<RulesEngineEntity>();
		for(int x = 0; x < all.size(); x++)
		{
			if(all.get(x).isPublic())
			{
				result.add(all.get(x));
			}
		}
	return result;
}
 
Example 40
Project: openmaxims-linux   File: Entities.java   Source Code and License 5 votes vote down vote up
public RulesEngineEntity getEntityById(String id)
{
	for(int x = 0; x < getAllEntities().size(); x++)
	{
		if(getAllEntities().get(x).getId().equals((id)))
			return getAllEntities().get(x);
	}

	return null;
}