protected function _checkUniverse($filterList, $universe, $checkExpense = true)
 {
     // Check if the user is allowed to perform this action
     $dumbAlarm = new Application\Model\AlarmModel();
     $dumbAlarm->condition = AlarmRuleCondition::CONDITION_LIFE_CYCLE_STATUS_CHANGE;
     try {
         $dumbAlarm->importData(array('entity' => array('universeType' => $universe)));
         $this->_allowed->direct('read', $dumbAlarm);
         if ($checkExpense) {
             try {
                 $dumbAlarm->condition = AlarmRuleCondition::CONDITION_EXPENSE_DATA_LIMIT;
                 $this->_allowed->direct('read', $dumbAlarm);
             } catch (Exception $e) {
                 $filterList->addFilter(new \App_ListFilter_EqualFilter(array('fieldName' => AlarmFilterFields::RULE_CONDITION, 'value' => AlarmRuleCondition::CONDITION_EXPENSE_DATA_LIMIT, 'inverted' => true)));
                 $filterList->addFilter(new \App_ListFilter_EqualFilter(array('fieldName' => AlarmFilterFields::RULE_CONDITION, 'value' => AlarmRuleCondition::CONDITION_EXPENSE_DATA_THRESHOLD, 'inverted' => true)));
                 $filterList->addFilter(new \App_ListFilter_EqualFilter(array('fieldName' => AlarmFilterFields::RULE_CONDITION, 'value' => AlarmRuleCondition::CONDITION_EXPENSE_SMS_LIMIT, 'inverted' => true)));
                 $filterList->addFilter(new \App_ListFilter_EqualFilter(array('fieldName' => AlarmFilterFields::RULE_CONDITION, 'value' => AlarmRuleCondition::CONDITION_EXPENSE_SMS_THRESHOLD, 'inverted' => true)));
                 $filterList->addFilter(new \App_ListFilter_EqualFilter(array('fieldName' => AlarmFilterFields::RULE_CONDITION, 'value' => AlarmRuleCondition::CONDITION_EXPENSE_TOTAL_LIMIT, 'inverted' => true)));
                 $filterList->addFilter(new \App_ListFilter_EqualFilter(array('fieldName' => AlarmFilterFields::RULE_CONDITION, 'value' => AlarmRuleCondition::CONDITION_EXPENSE_TOTAL_THRESHOLD, 'inverted' => true)));
                 $filterList->addFilter(new \App_ListFilter_EqualFilter(array('fieldName' => AlarmFilterFields::RULE_CONDITION, 'value' => AlarmRuleCondition::CONDITION_EXPENSE_VOICE_LIMIT, 'inverted' => true)));
                 $filterList->addFilter(new \App_ListFilter_EqualFilter(array('fieldName' => AlarmFilterFields::RULE_CONDITION, 'value' => AlarmRuleCondition::CONDITION_EXPENSE_VOICE_THRESHOLD, 'inverted' => true)));
                 return false;
             }
         }
     } catch (Exception $e) {
         $filterList->addFilter(new \App_ListFilter_EqualFilter(array('fieldName' => AlarmFilterFields::UNIVERSE_TYPE, 'value' => $universe, 'inverted' => true)));
     }
     return true;
 }
 protected function _getSummary(\App_ListFilter $filterList = NULL)
 {
     $org = \App::getOrgUserLogged();
     $result = new GroupListModel();
     $dumbAlarm = new Application\Model\AlarmModel();
     $dumbAlarm->condition = AlarmRuleCondition::CONDITION_LIFE_CYCLE_STATUS_CHANGE;
     $this->_helper->filterNotAllowedFilters()->setThrowExOnNotAllowed(true);
     $this->_addGroup($result, $filterList, array(array('fieldName' => AlarmFilterFields::STATE, 'value' => AlarmModel::STATE_CLOSED, 'inverted' => true)), 'ALL');
     $this->_addGroup($result, $filterList, array(array('fieldName' => AlarmFilterFields::SEVERITY, 'value' => AlarmRuleModel::SEVERITY_CRITICAL, 'inverted' => false)), AlarmRuleModel::SEVERITY_CRITICAL, true);
     $this->_addGroup($result, $filterList, array(array('fieldName' => AlarmFilterFields::SEVERITY, 'value' => AlarmRuleModel::SEVERITY_URGENT, 'inverted' => false)), AlarmRuleModel::SEVERITY_URGENT, true);
     $this->_addGroup($result, $filterList, array(array('fieldName' => AlarmFilterFields::SEVERITY, 'value' => AlarmRuleModel::SEVERITY_INFORMATIVE, 'inverted' => false)), AlarmRuleModel::SEVERITY_INFORMATIVE, true);
     $this->_addGroup($result, $filterList, array(array('fieldName' => AlarmFilterFields::STATE, 'value' => AlarmModel::STATE_ATTENDED, 'inverted' => false)), AlarmModel::STATE_ATTENDED);
     $this->_addGroup($result, $filterList, array(array('fieldName' => AlarmFilterFields::STATE, 'value' => AlarmModel::STATE_OPENED, 'inverted' => false)), AlarmModel::STATE_OPENED);
     $this->_addGroup($result, $filterList, array(array('fieldName' => AlarmFilterFields::STATE, 'value' => AlarmModel::STATE_CLOSED, 'inverted' => false)), AlarmModel::STATE_CLOSED);
     if ($org instanceof OrgCustomerModel) {
         $alarmType = $filterList->getOneFilterByFieldName(AlarmFilterFields::ALARM_TYPE);
         $isSupervision = $alarmType && $alarmType->getValue() == AlarmModel::TYPE_SUPERVISION && !$alarmType->getInverted();
         if (!$isSupervision) {
             try {
                 $dumbAlarm->importData(array('entity' => array('universeType' => AlarmRuleModel::UNIVERSE_SUBSCRIPTIONS_OF_COMMERCIAL_GROUP)));
                 $this->_helper->allowed('read', $dumbAlarm);
                 $this->_addGroup($result, $filterList, array(array('fieldName' => AlarmFilterFields::UNIVERSE_TYPE, 'value' => AlarmRuleModel::UNIVERSE_SUBSCRIPTIONS_OF_COMMERCIAL_GROUP, 'inverted' => false)), AlarmRuleModel::UNIVERSE_SUBSCRIPTIONS_OF_COMMERCIAL_GROUP, true);
             } catch (PermissionException $e) {
                 //Nothing to do
             } catch (NotAllowedException $e) {
                 //Nothing to do
             }
             try {
                 $dumbAlarm->importData(array('entity' => array('universeType' => AlarmRuleModel::UNIVERSE_COMMERCIAL_GROUP)));
                 $this->_helper->allowed('read', $dumbAlarm);
                 $this->_addGroup($result, $filterList, array(array('fieldName' => AlarmFilterFields::UNIVERSE_TYPE, 'value' => AlarmRuleModel::UNIVERSE_COMMERCIAL_GROUP, 'inverted' => false)), AlarmRuleModel::UNIVERSE_COMMERCIAL_GROUP, true);
             } catch (PermissionException $e) {
                 //Nothing to do
             } catch (NotAllowedException $e) {
                 //Nothing to do
             }
         }
     }
     return $result;
 }