Ñò
ýÉªWc           @   sJ   d  d k  Z  d e  i  f d „  ƒ  YZ d „  Z e d j o e ƒ  n d S(   iÿÿÿÿNt   AlertActionsc           B   s>   e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   c         C   s   t  i  i |  ƒ d  S(   N(   t	   BaseClasst   __init__(   t   self(    (    sf   /home/jenkins/workspace/prepack-aio-release-4.2/prepack-aio/src/main/resources/scripts/AlertActions.pyR      s    c         C   sQ   | d } | d } |  i  i d | | f ƒ t |  i  i ƒ  ƒ o t St Sd  S(   Ni    i   sO   SELECT IDENTIFIER FROM ALERT_ACTIONS WHERE IDENTIFIER='%s' AND ACTION_TYPE='%s'(   t   cursort   executet   lent   fetchallt   Truet   False(   R   t   datat   alertIdentifiert
   actionType(    (    sf   /home/jenkins/workspace/prepack-aio-release-4.2/prepack-aio/src/main/resources/scripts/AlertActions.pyt   checkExistence   s    

c         C   s   d S(   Ni   (    (   R   (    (    sf   /home/jenkins/workspace/prepack-aio-release-4.2/prepack-aio/src/main/resources/scripts/AlertActions.pyt	   getNextId   s    c         C   sd   y< d |  i  t | ƒ ƒ } | GH|  i i | ƒ |  i ƒ  SWn! t j
 o } | GH|  i ƒ  SXd  S(   NsE   INSERT INTO ALERT_ACTIONS (IDENTIFIER, ACTION_TYPE, DETAIL) VALUES %s(   t
   tupleToStrt   listR   R   t   committ	   Exceptiont   rollback(   R   t   id_R
   t	   statementt   e(    (    sf   /home/jenkins/workspace/prepack-aio-release-4.2/prepack-aio/src/main/resources/scripts/AlertActions.pyt   insert   s    c         C   sj   yB d | d | d | d f } | GH|  i  i | ƒ |  i ƒ  SWn! t j
 o } | GH|  i ƒ  SXd  S(   NsQ   UPDATE ALERT_ACTIONS SET DETAIL = '%s' WHERE IDENTIFIER='%s' AND ACTION_TYPE='%s'i   i    i   (   R   R   R   R   R   (   R   R
   R   R   (    (    sf   /home/jenkins/workspace/prepack-aio-release-4.2/prepack-aio/src/main/resources/scripts/AlertActions.pyt   update   s    c         C   s§   | d } d } t | ƒ d j o | d } n yN | d j o d | } n d | | f } | GH|  i i | ƒ |  i ƒ  SWn! t j
 o } | GH|  i ƒ  SXd S(   sm    delete the alert actions that are associated with the alert id
		data[0]: alert id
		data[1]: action type
		i    i   s/   DELETE FROM ALERT_ACTIONS WHERE IDENTIFIER='%s'sF   DELETE FROM ALERT_ACTIONS WHERE IDENTIFIER='%s' and ACTION_TYPE = '%s'N(   t   NoneR   R   R   R   R   R   (   R   R
   t   alertIdR   R   R   (    (    sf   /home/jenkins/workspace/prepack-aio-release-4.2/prepack-aio/src/main/resources/scripts/AlertActions.pyt   delete*   s    
(   t   __name__t
   __module__R   R   R   R   R   R   (    (    (    sf   /home/jenkins/workspace/prepack-aio-release-4.2/prepack-aio/src/main/resources/scripts/AlertActions.pyR       s   						c          C   s    t  ƒ  }  |  i d d d ƒ d  S(   Nt   testidentifieri   ié  (   R    t   add(   t   aa(    (    sf   /home/jenkins/workspace/prepack-aio-release-4.2/prepack-aio/src/main/resources/scripts/AlertActions.pyt   mainD   s    	t   __main__(   R   R    R!   R   (    (    (    sf   /home/jenkins/workspace/prepack-aio-release-4.2/prepack-aio/src/main/resources/scripts/AlertActions.pyt   <module>   s   @	