ModelValidationEngine - old style validator needed to osgi events work and FireFacts OSGI event is not sent

This commit is contained in:
Murilo Habermann Torquato 2015-03-19 14:52:50 -03:00
parent 267fe358df
commit 32ee03af05
1 changed files with 4 additions and 5 deletions

View File

@ -338,7 +338,7 @@ public class ModelValidationEngine
*/ */
public String fireModelChange (PO po, int changeType) public String fireModelChange (PO po, int changeType)
{ {
if (po == null || m_modelChangeListeners.size() == 0) if (po == null )
return null; return null;
String propertyName = po.get_TableName() + "*"; String propertyName = po.get_TableName() + "*";
@ -502,7 +502,7 @@ public class ModelValidationEngine
*/ */
public String fireDocValidate (PO po, int docTiming) public String fireDocValidate (PO po, int docTiming)
{ {
if (po == null || m_docValidateListeners.size() == 0) if (po == null)
return null; return null;
String propertyName = po.get_TableName() + "*"; String propertyName = po.get_TableName() + "*";
@ -688,7 +688,7 @@ public class ModelValidationEngine
*/ */
public String fireFactsValidate (MAcctSchema schema, List<Fact> facts, PO po) public String fireFactsValidate (MAcctSchema schema, List<Fact> facts, PO po)
{ {
if (schema == null || facts == null || po == null || m_factsValidateListeners.size() == 0) if (schema == null || facts == null || po == null)
return null; return null;
String propertyName = po.get_TableName() + "*"; String propertyName = po.get_TableName() + "*";
@ -715,6 +715,7 @@ public class ModelValidationEngine
FactsEventData eventData = new FactsEventData(schema, facts, po); FactsEventData eventData = new FactsEventData(schema, facts, po);
Event event = EventManager.newEvent(IEventTopics.ACCT_FACTS_VALIDATE, Event event = EventManager.newEvent(IEventTopics.ACCT_FACTS_VALIDATE,
new EventProperty(EventManager.EVENT_DATA, eventData), new EventProperty("tableName", po.get_TableName())); new EventProperty(EventManager.EVENT_DATA, eventData), new EventProperty("tableName", po.get_TableName()));
EventManager.getInstance().sendEvent(event);
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
List<String> errors = (List<String>) event.getProperty(IEventManager.EVENT_ERROR_MESSAGES); List<String> errors = (List<String>) event.getProperty(IEventManager.EVENT_ERROR_MESSAGES);
if (errors != null && !errors.isEmpty()) if (errors != null && !errors.isEmpty())
@ -769,8 +770,6 @@ public class ModelValidationEngine
*/ */
public void fireImportValidate (ImportProcess process, PO importModel, PO targetModel, int timing) public void fireImportValidate (ImportProcess process, PO importModel, PO targetModel, int timing)
{ {
if (m_impValidateListeners.size() == 0)
return;
String propertyName = process.getImportTableName() + "*"; String propertyName = process.getImportTableName() + "*";
ArrayList<ImportValidator> list = m_impValidateListeners.get(propertyName); ArrayList<ImportValidator> list = m_impValidateListeners.get(propertyName);