/**
  * @see LinkedToMappingRuleDataAnalyzerInterface::runAndMakeMessages()
  */
 public function runAndMakeMessages(AnalyzerSupportedDataProvider $dataProvider, $columnName, $mappingRuleType, $mappingRuleData)
 {
     assert('is_string($columnName)');
     assert('is_string($mappingRuleType)');
     assert('is_array($mappingRuleData)');
     assert('is_int($mappingRuleData["type"])');
     assert('$mappingRuleData["type"] == UserValueTypeModelAttributeMappingRuleForm::ZURMO_USER_ID ||
                 $mappingRuleData["type"] == UserValueTypeModelAttributeMappingRuleForm::EXTERNAL_SYSTEM_USER_ID ||
                 $mappingRuleData["type"] == UserValueTypeModelAttributeMappingRuleForm::ZURMO_USERNAME');
     $this->type = $mappingRuleData["type"];
     if ($mappingRuleData['type'] == UserValueTypeModelAttributeMappingRuleForm::ZURMO_USER_ID) {
         $this->acceptableValues = UserValueTypeSanitizerUtil::getUserIds();
     } elseif ($mappingRuleData['type'] == UserValueTypeModelAttributeMappingRuleForm::EXTERNAL_SYSTEM_USER_ID) {
         $this->acceptableValues = UserValueTypeSanitizerUtil::getUserExternalSystemIds();
     } else {
         $acceptableValues = UserValueTypeSanitizerUtil::getUsernames();
         $this->acceptableValues = ArrayUtil::resolveArrayToLowerCase($acceptableValues);
     }
     $this->processAndMakeMessage($dataProvider, $columnName);
 }
 protected function getAcceptableValues()
 {
     if ($this->mappingRuleData['type'] == UserValueTypeModelAttributeMappingRuleForm::ZURMO_USER_ID) {
         return UserValueTypeSanitizerUtil::getUserIds();
     } elseif ($this->mappingRuleData['type'] == UserValueTypeModelAttributeMappingRuleForm::EXTERNAL_SYSTEM_USER_ID) {
         return UserValueTypeSanitizerUtil::getUserExternalSystemIds();
     } else {
         $acceptableValues = UserValueTypeSanitizerUtil::getUsernames();
         return ArrayUtil::resolveArrayToLowerCase($acceptableValues);
     }
 }
 /**
  * Check whether the specified value corresponds to a valid username of a user model.
  * @param AnalyzerSupportedDataProvider $dataProvider
  * @param string $columnName
  */
 protected function resolveForTypeUsername(AnalyzerSupportedDataProvider $dataProvider, $columnName)
 {
     assert('is_string($columnName)');
     $usernameValues = UserValueTypeSanitizerUtil::getUsernames();
     $usernameValues = ArrayUtil::resolveArrayToLowerCase($usernameValues);
     $data = $dataProvider->getCountDataByGroupByColumnName($columnName);
     $count = 0;
     foreach ($data as $valueCountData) {
         if ($valueCountData[$columnName] == null) {
             continue;
         }
         if (!in_array(TextUtil::strToLowerWithDefaultEncoding($valueCountData[$columnName]), $usernameValues)) {
             $count++;
         }
     }
     if ($count > 0) {
         $label = '{count} username(s) specified were not found. ';
         $label .= 'These values will not be used during the import.';
         $this->addMessage(Zurmo::t('ImportModule', $label, array('{count}' => $count)));
     }
 }