예제 #1
0
 def get_no_of_eventcalls_within_time_interval(event_noun_id,
                                               event_rule_id):
     """
     Retrieve no of calls made for a specific event rule
     :param event_noun_id: Event id [Integer, Required]
     :param event_rule_id: Event rule id [Integer, Required]
     :return: Count of calls [Integer]
     """
     event_rule_result_set = db_obj.execute(
         EventDal.GET_EVENT_RULE_INFO_FROM_ID, event_rule_id)
     if event_rule_result_set.has_row():
         event_row_set = event_rule_result_set.get_rows()
         event_rule_time_interval = event_row_set[0][
             "event_rule_time_interval"]
         result_set = db_obj.execute(
             EventDal.GET_ALL_EVENTS_WITHIN_TIME_INTERVAL,
             (event_noun_id, event_rule_time_interval))
         return result_set.row_count()
예제 #2
0
 def get_event_rule_info(event_rule_id):
     """
     Retrieve's event rule information
     :param event_rule_id: Event rule id [Integer, Required]
     :return: A list object with event rule information
     """
     result_set = db_obj.execute(EventDal.GET_EVENT_RULE_INFO_FROM_ID,
                                 event_rule_id)
     return result_set.get_rows()[0]
예제 #3
0
 def is_event_rule_in_db(event_rule_name):
     """
     Check's whether provided event rule exit's in db
     :param event_rule_name: Name of the event rule [String, Required]
     :return: True: If event rule exist
              False: If event rule oes not exist
     """
     result_set = db_obj.execute(EventDal.GET_EVENT_RULE_ID,
                                 (event_rule_name))
     return True if result_set.has_row() else False
예제 #4
0
 def get_event_rule_id_from_noun_id(event_id):
     """
     Retrieve's event rule id
     :param event_id: Noun event id [Integer, Required]
     :return: Event rule id [Integer]
     """
     result_set = db_obj.execute(EventDal.GET_EVENT_RULE_ID_FROM_NOUN_ID,
                                 event_id)
     if result_set.has_row():
         return result_set.get_rows()[0]["event_rule_id"]
     else:
         return -1