Returns the cache of alert conditions for the given policy, creating one if it doesn't exist .
@param policyId The id of the policy for the cache of alert conditions
@return The cache of alert conditions for the given policy
553848
public AlertConditionCache alertConditions(long policyId)
    {
        AlertConditionCache cache = conditions.get(policyId);
        if(cache == null)
            conditions.put(policyId, cache = new AlertConditionCache(policyId));
        return cache;
    }
583948
@Override
    public Map<String, AbstractPolicy> getPolicies(EvaluationCtx eval, PolicyFinder policyFinder)
    throws PolicyIndexException {
        // no indexing, return everything
        // return a copy, otherwise the map could change during evaluation if policies are added, deleted etc
        readLock.lock();
        try {
            Map<String, AbstractPolicy> result = new ConcurrentHashMap<String, AbstractPolicy>();
            for(String id:policies.keySet()){
                AbstractPolicy policy = handleDocument(m_policyReader.readPolicy(policies.get(id)),policyFinder);
                result.put(id, policy);
            }
            return result;
        }
        catch (ParsingException pe) {
            throw new PolicyIndexException(pe.getMessage(),pe);
        }finally {
            readLock.unlock();
        }
    }
13809
public Optional<SyntheticsAlertCondition> create(long policyId, SyntheticsAlertCondition condition)
    {
        return HTTP.POST(String.format("/v2/alerts_synthetics_conditions/policies/%d.json", policyId), condition, SYNTHETICS_ALERT_CONDITION);
    }
1092745
public Collection<AlertCondition> list(long policyId, String name)
    {
        List<AlertCondition> ret = new ArrayList<AlertCondition>();
        Collection<AlertCondition> conditions = list(policyId);
        for(AlertCondition condition : conditions)
        {
            if(condition.getName().equals(name))
                ret.add(condition);
        }
        return ret;
    }
696793
public Optional<AlertPolicyChannel> update(long policyId, long channelId)
    {
        QueryParameterList queryParams = new QueryParameterList();
        queryParams.add("policy_id", policyId);
        queryParams.add("channel_ids", channelId);
        return HTTP.PUT("/v2/alerts_policy_channels.json", null, null, queryParams, ALERT_POLICY_CHANNEL);
    }
1096320
public static function fetchTemporaryCopy( $policyID )
    {
        $policy = eZPersistentObject::fetchObject( self::definition(),
            null, array( 'original_id' => $policyID ), true );

        if ( $policy instanceof eZPolicy )
        {
            return $policy;
        }
        // The temporary copy does not exist yet, create it
        else
        {
            $policy = self::fetch( $policyID );
            if ( $policy === null )
                return false;
            else
            {
                return $policy->createTemporaryCopy();
            }
        }
    }
1133866
public AlertPolicyFilter policies(AlertPolicy... policies) {
        allItemsNotNull(policies, "Anti-affinity Policies");

        evaluation = new AndEvaluation<>(evaluation, Filter.or(
            Streams.map(policies, AlertPolicy::asFilter)
        ), AlertPolicyMetadata::getId);

        return this;
    }
1317846
private function getCacheContent($policy, $cache, &$data) {
        $policyContent = $this->tryReadFile($policy);
        $cacheContent = $this->tryReadFile($cache);
        $data = null;

        if ($policyContent === false || $cacheContent === false) {
            $this->tryDeleteFile($policy);
            $this->tryDeleteFile($cache);
            return false;
        }

        $policyEntry = json_decode($policyContent, true);

        $absoluteExpiration = (int)$policyEntry['absoluteExpiration'];

        if ($absoluteExpiration != 0 && $absoluteExpiration < time()) {
            $this->tryDeleteFile($policy);
            $this->tryDeleteFile($cache);
            return false;
        }

        $data = unserialize($cacheContent);

        return true;
    }
668018
public AlertPolicyChannelService delete(long policyId, long channelId)
    {
        QueryParameterList queryParams = new QueryParameterList();
        queryParams.add("policy_id", policyId);
        queryParams.add("channel_id", channelId);
        HTTP.DELETE("/v2/alerts_policy_channels.json", null, queryParams);       
        return this;
    }
1228472
public static cachepolicylabel[] get(nitro_service service) throws Exception{
		cachepolicylabel obj = new cachepolicylabel();
		cachepolicylabel[] response = (cachepolicylabel[])obj.get_resources(service);
		return response;
	}
462588
private AuthorizationInfo getUncachedAuthorizationInfoById(String id) {
        // Retrieve the API key by ID
        ApiKey apiKey = _authIdentityReader.getIdentity(id);
        if (apiKey == null) {
            _log.debug("Authorization info requested for non-existent id {}", id);
            return _nullAuthorizationInfo;
        }

        return new SimpleAuthorizationInfo(ImmutableSet.copyOf(apiKey.getRoles()));
    }
1326359
public static SystemConfiguration get(final long _id)
        throws CacheReloadException
    {
        final Cache<Long, SystemConfiguration> cache = InfinispanCache.get().<Long, SystemConfiguration>getCache(
                        SystemConfiguration.IDCACHE);
        if (!cache.containsKey(_id)) {
            SystemConfiguration.getSystemConfigurationFromDB(SystemConfiguration.SQL_ID, _id);
        }
        return cache.get(_id);
    }
439645
public Collection<NrqlAlertCondition> list(long policyId, String name)
    {
        List<NrqlAlertCondition> ret = new ArrayList<NrqlAlertCondition>();
        Collection<NrqlAlertCondition> conditions = list(policyId);
        for(NrqlAlertCondition condition : conditions)
        {
            if(condition.getName().equals(name))
                ret.add(condition);
        }
        return ret;
    }
973688
public boolean syncAlerts(NewRelicCache cache)
    {
        boolean ret = true;

        if(apiClient == null)
            throw new IllegalArgumentException("null API client");

        // Get the alert configuration using the REST API
        if(cache.isAlertsEnabled())
        {
            ret = false;

            // Get the alert policies
            logger.info("Getting the alert policies");
            Collection<AlertPolicy> policies = apiClient.alertPolicies().list();
            for(AlertPolicy policy : policies)
            {
                cache.alertPolicies().add(policy);

                // Add the alert conditions
                if(cache.isApmEnabled() || cache.isServersEnabled() || cache.isBrowserEnabled() || cache.isMobileEnabled())
                    cache.alertPolicies().alertConditions(policy.getId()).add(apiClient.alertConditions().list(policy.getId()));
                cache.alertPolicies().nrqlAlertConditions(policy.getId()).add(apiClient.nrqlAlertConditions().list(policy.getId()));
                if(cache.isApmEnabled() || cache.isMobileEnabled())
                    cache.alertPolicies().externalServiceAlertConditions(policy.getId()).add(apiClient.externalServiceAlertConditions().list(policy.getId()));
                if(cache.isSyntheticsEnabled())
                    cache.alertPolicies().syntheticsAlertConditions(policy.getId()).add(apiClient.syntheticsAlertConditions().list(policy.getId()));
                if(cache.isPluginsEnabled())
                    cache.alertPolicies().pluginsAlertConditions(policy.getId()).add(apiClient.pluginsAlertConditions().list(policy.getId()));
                if(cache.isInfrastructureEnabled())
                    cache.alertPolicies().infraAlertConditions(policy.getId()).add(infraApiClient.infraAlertConditions().list(policy.getId()));
            }

            // Get the alert channels
            logger.info("Getting the alert channels");
            Collection<AlertChannel> channels = apiClient.alertChannels().list();
            cache.alertChannels().set(channels);
            cache.alertPolicies().setAlertChannels(channels);
            cache.setUpdatedAt();

            ret = true;
        }

        return ret;
    }
816727
public Message getMessage(MessageId id)
  {
    // Performance note: this method uses a lazy initialization pattern. When
    // a MessageId is first requested, we fetch the data from the ResourceBundle
    // and create a new Message object, which is then cached. On the next 
    // request, we'll use the cached version instead. 
    Message message;
    if (cachedMessages.containsKey(id))
    {
      message = cachedMessages.get(id);
    } 
    else
    {
      message = new Message(id, defaultSeverities.get(id), getMessageAsString(id), getSuggestion(id));
      cachedMessages.put(id, message);
    }

    return message;
  }
647200
public Optional<AlertCondition> update(AlertCondition condition)
    {
        return HTTP.PUT(String.format("/v2/alerts_conditions/%d.json", condition.getId()), condition, ALERT_CONDITION);
    }
1163501
public static policydataset[] get(nitro_service service) throws Exception{
		policydataset obj = new policydataset();
		policydataset[] response = (policydataset[])obj.get_resources(service);
		return response;
	}