The system power state

@param boolean $translate If true, return the string representation via self::$POWER_STATES
@return array The power state.
762262
public function systemPowerState( $translate = false )
    {
        $states = $this->getSNMP()->get( self::OID_SYSTEM_POWER_STATE );

        if( !$translate )
            return $states;

        return $this->getSNMP()->translate( $states, self::$POWER_STATES );
    }
916202
public function powerSupplySource( $translate = false )
    {
        $states = $this->getSNMP()->walk1d( self::OID_POWER_SUPPLY_SOURCE );

        if( !$translate )
            return $states;

        return $this->getSNMP()->translate( $states, self::$POWER_SUPPLY_SOURCES );
    }
337584
def get_power_state(self, userid):
        """"""
        LOG.debug('Querying power stat of %s' % userid)
        requestData = "PowerVM " + userid + " status"
        action = "query power state of '%s'" % userid
        with zvmutils.log_and_reraise_smt_request_failed(action):
            results = self._request(requestData)
        with zvmutils.expect_invalid_resp_data(results):
            status = results['response'][0].partition(': ')[2]
        return status
263658
public function getTranslatedPropertyNameAssoc($locale, $mapping)
    {
        return [
            'property'   => $this->getTranslatedPropertyName($locale, $mapping['property']),
            'assoc'      => $this->getTranslatedPropertyName($locale, $mapping['assoc']),
            'assocNulls' => $this->getTranslatedPropertyName($locale, $mapping['assocNulls']),
        ];
    }
4278
private function getStateSchema(): array
    {
        return [
            "type" => "assoc" ,
            "required" => false,
            "properties" => [
                "class" => [ "type" => "fqcn", "required" => false ],
                "initial" => [
                    "type" => "bool",
                    "required" => false
                ],
                "final" => [
                    "type" => "bool",
                    "required" => false
                ],
                "interactive" => [
                    "type" => "bool",
                    "required" => false
                ],
                "output" => [
                    "type" => "assoc",
                    "required" => false,
                    "properties" => [
                        ":any_name:" => [ "type" => "any" ]
                    ]
                ],
                "input_schema" =>  [
                    "type" => "assoc",
                    "required" => false,
                    "properties" => [
                        ":any_name:" => [ "type" => "any" ]
                    ]
                ],
                "output_schema" =>  [
                    "type" => "assoc",
                    "required" => false,
                    "properties" => [
                        ":any_name:" => [ "type" => "any" ]
                    ]
                ],
                "settings" =>  [
                    "type" => "assoc",
                    "required" => false,
                    "properties" => [
                        ":any_name:" => [ "type" => "any" ]
                    ]
                ],
                "transitions" =>  [
                    "type" => "assoc",
                    "required" => true,
                    "properties" => [
                        ":any_name:" => [
                            "type" => "enum" ,
                            "required" => false,
                            "one_of" => [ "string", "&transition" ]
                        ]
                    ]
                ]
            ]
        ];
    }
541513
public function transFormErrors($formErrorList, $translationDomain)
    {
        $ret = [];
        foreach ($formErrorList as $k => $formError) {
            $ret[$k] = $this->translator->trans($formError->getMessage(), $formError->getMessageParameters(), $translationDomain);
        }
        return $ret;
    }
466256
private static String translateLegacySystemId(String systemId) {

        String result = systemId;
        for (String[] translation : LEGACY_TRANSLATIONS) {
            if (systemId.startsWith(translation[0])) {
                // replace prefix with second component if it matches the first component
                result = translation[1] + systemId.substring(translation[0].length());
                break;
            }
        }
        if (OpenCms.getRepositoryManager() != null) {
            result = OpenCms.getResourceManager().getXsdTranslator().translateResource(result);
        }
        return result;
    }
425526
public function types($translate = false) {
        $types = $this->getSNMP()->subOidWalk(self::OID_TYPE, 12);

        if (!$translate)
            return $types;

        return $this->getSNMP()->translate($types, self::$TYPES);
    }
792304
public function translations($active = true)
    {
        if ($active) {
            return $this->hasMany(BlockTranslation::class)->where('is_active', '=', true);
        }
        return $this->hasMany(BlockTranslation::class);
    }
1059823
public function transform($translation)
    {
        $translation = $this->entityToArray(RouteTranslation::class, $translation);
        return [
            'id'        => (int) $translation['id'],
            'langCode'  => $translation['lang_code'],
            'url'       => $translation['url'],
            'isActive'  => (bool) $translation['is_active'],
            'createdAt' => $translation['created_at'],
            'updatedAt' => $translation['updated_at'],
        ];
    }
912518
private function translate($key, $translations)
    {
        if ($translations != null && isset($translations[$key])) {
            return $translations[$key];
        }

        return $key;
    }
373521
public function refreshAuthority($inputs)
    {
        $result = $this->restCall('RefreshAuthority.json', $inputs);

        if ($result['Status'] == 100 || $result['Status'] == 101) {
            return ['Status' => 'success', 'refreshed' => true];
        } else {
            return ['Status' => 'error', 'error' => $result['Status']];
        }
    }
1038248
public function routeDetails($translate = false) {
        $fetchList = [
            'routeDest' => 'destination',
            'routeMask' => 'mask',
            'routeTos' => 'TOS',
            'routeNextHop' => 'nextHop',
            'routeIfIndex' => 'ifIndex',
            'routeType' => 'type',
            'routeProto' => 'protocol',
            'routeAge' => 'age',
            'routeInfo' => 'info',
            'routeNextHopAS' => 'nextHopAS',
            'routeMetric1' => 'metric1',
            'routeMetric2' => 'metric2',
            'routeMetric3' => 'metric3',
            'routeMetric4' => 'metric4',
            'routeMetric5' => 'metric5',
            'routeStatus' => 'status'
        ];
        $canTranslate = [ 'routeType', 'routeProto', 'routeStatus'];
        $details = [];

        foreach ($fetchList as $fn => $idx) {
            if (in_array($fn, $canTranslate))
                $values = $this->$fn($translate);
            else
                $values = $this->$fn();
            foreach ($values as $ip => $value)
                $details[$ip][$idx] = $value;
        }
        return $details;
    }
513160
public function translate($key, $translation, $locale = null) {
        $this->translations[$this->locale($locale)][$key] = $translation;

        return $translation;
    }
1005198
protected function replace($translation, $replacement = []) {
        foreach ($replacement as $key => $value) {
            $translation = str_replace(':'.$key, $value, $translation);
        }

        return $translation;
    }
604126
def guest_get_power_state(self, userid):
        """"""
        action = "get power state of guest '%s'" % userid
        with zvmutils.log_and_reraise_sdkbase_error(action):
            return self._vmops.get_power_state(userid)
696348
public function getLocaleCondition($alias = 'translation')
    {
        $expr = new Query\Expr();

        // TODO This may change between master/sub requests
        $current = $this->localeProvider->getCurrentLocale();
        $fallback = $this->localeProvider->getFallbackLocale();

        if ($current != $fallback) {
            return $expr->orX(
                $expr->eq($alias . '.locale', $expr->literal($this->localeProvider->getCurrentLocale())),
                $expr->eq($alias . '.locale', $expr->literal($this->localeProvider->getFallbackLocale()))
            );
        }

        return $expr->eq($alias . '.locale', $expr->literal($this->localeProvider->getCurrentLocale()));
    }