コード例 #1
0
 protected function _mapEricssonModelToModel(array $data)
 {
     $data = parent::_mapEricssonModelToModel($data);
     if (isset($data['entity']) && isset($data['entity']['universeType']) && ($universeType = AlarmRuleMapper::getInstance()->mapUniverseFromEricsson($data['entity']['universeType']))) {
         $data['entity']['universeType'] = $universeType;
         if (isset($data['entity']['customer']['id'])) {
             $data['entity']['customerId'] = $data['entity']['customer']['id'];
             if (isset($data['entity']['customer']['name'])) {
                 $data['entity']['customerName'] = $data['entity']['customer']['name'];
             }
             unset($data['entity']['customer']);
         }
         if (isset($data['entity']['billingAccount']['id'])) {
             $data['entity']['billingAccountId'] = $data['entity']['billingAccount']['id'];
             if (isset($data['entity']['billingAccount']['name'])) {
                 $data['entity']['billingAccountName'] = $data['entity']['billingAccount']['name'];
             }
             unset($data['entity']['billingAccount']);
         }
         if (isset($data['entity']['commercialGroup']['id'])) {
             $data['entity']['commercialGroupId'] = $data['entity']['commercialGroup']['id'];
             if (isset($data['entity']['commercialGroup']['name'])) {
                 $data['entity']['commercialGroupName'] = $data['entity']['commercialGroup']['name'];
             }
             unset($data['entity']['commercialGroup']);
         }
         if (isset($data['entity']['customerId'])) {
             $data['entity']['customerId'] = OrgCustomerMapper::buildOrgId($data['entity']['customerId']);
         }
         if (isset($data['entity']['subscriptionId'])) {
             foreach ($data['entity']['subscriptionId'] as &$simId) {
                 if (isset($simId['type'])) {
                     $idType = SimMapper::mapSubscriptionIdFromEricsson($simId['type']);
                     $simId['type'] = $idType;
                 }
             }
         }
         if (isset($data['businessRule'])) {
             foreach ($data['businessRule'] as &$businessRule) {
                 $businessRule = AlarmRuleMapper::getInstance()->mapBusinessRuleToModel($businessRule);
             }
         }
     }
     if (isset($data['state']) && ($state = $this->_mapStateToModel($data['state']))) {
         $data['state'] = $state;
     }
     if (isset($data['alarmRule']['id'])) {
         $data['alarmRuleId'] = $data['alarmRule']['id'];
         if (isset($data['alarmRule']['name'])) {
             $data['alarmRuleName'] = $data['alarmRule']['name'];
         }
         unset($data['alarmRule']);
     }
     $alarmRuleMapper = AlarmRuleMapper::getInstance();
     if (isset($data['severity']) && ($severity = $alarmRuleMapper->mapSeverityFromEricsson($data['severity']))) {
         $data['severity'] = $severity;
     }
     if (isset($data['condition']) && ($condition = $alarmRuleMapper->mapConditionFromEricsson($data['condition']))) {
         $data['condition'] = $condition;
     }
     return $data;
 }