/**
  * the singleton pattern
  *
  * @return Expressomail_Controller_Sieve
  */
 public static function getInstance()
 {
     if (self::$_instance === NULL) {
         self::$_instance = new Expressomail_Controller_Sieve();
     }
     return self::$_instance;
 }
 /**
  * set sieve rules for account
  *
  * @param   array $accountId
  * @param   array $rulesData
  * @return  array
  */
 public function saveRules($accountId, $rulesData)
 {
     $records = new Tinebase_Record_RecordSet('Expressomail_Model_Sieve_Rule', $this->_fixRulesData($rulesData));
     $records = Expressomail_Controller_Sieve::getInstance()->setRules($accountId, $records);
     return $this->_multipleRecordsToJson($records);
 }
 protected function _setTestScriptname()
 {
     $this->_oldActiveSieveScriptName = Expressomail_Controller_Sieve::getInstance()->getActiveScriptName($this->_account->getId());
     $this->_testSieveScriptName = 'Expressomail_Unittest';
     Expressomail_Controller_Sieve::getInstance()->setScriptName($this->_testSieveScriptName);
 }