1 23 24 package org.dbforms.event.eventtype; 25 26 import org.apache.commons.logging.Log; 27 import org.apache.commons.logging.LogFactory; 28 29 30 31 38 public class DbFormsEventTypeStrategy extends CompositeEventTypeStrategy { 39 40 private static Log logCat = LogFactory.getLog(DbFormsEventTypeStrategy.class 41 .getName()); 42 43 48 public DbFormsEventTypeStrategy() { 49 strategyList.add(new DatabaseEventTypeStrategy()); 50 strategyList.add(new NavigationEventTypeStrategy()); 51 } 52 53 60 public int getEventGroup(String eventString) { 61 int groupValue = EventType.EVENT_UNDEFINED; 62 63 for (int i = 0; i < strategyList.size(); i++) { 64 logCat.info("::getEventGroup - using [" + getChild(i).getId() 65 + "] strategy"); 66 groupValue = getChild(i) 67 .getEventGroup(eventString); 68 69 if (groupValue != EventType.EVENT_UNDEFINED) { 70 break; 71 } 72 } 73 74 return groupValue; 75 } 76 77 78 85 public String getEventType(String eventString) { 86 String typeValue = String.valueOf(EventType.EVENT_UNDEFINED); 87 88 for (int i = 0; i < strategyList.size(); i++) { 89 logCat.info("::getEventType - using [" + getChild(i).getId() 90 + "] strategy"); 91 typeValue = getChild(i) 92 .getEventType(eventString); 93 94 if (!typeValue.equals(String.valueOf(EventType.EVENT_UNDEFINED))) { 95 break; 96 } 97 } 98 99 logCat.info("::getEventType - returned the event type [" + typeValue 100 + "] from [" + eventString + "]"); 101 102 return typeValue; 103 } 104 105 106 111 public String getId() { 112 return "DbFormsEventTypeStrategy"; 113 } 114 } 115 | Popular Tags |