<commit_before>/*
 * Copyright (c) 2013-2014, Arjuna Technologies Limited, Newcastle-upon-Tyne, England. All rights reserved.
 */

package com.arjuna.databroker.webportal.comms;

import java.util.LinkedList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.ejb.Stateless;
import org.jboss.resteasy.client.ClientRequest;
import org.jboss.resteasy.client.ClientResponse;
import org.jboss.resteasy.util.GenericType;
import org.jboss.resteasy.util.HttpResponseCodes;
import com.arjuna.databroker.control.comms.AdvertNodeDTO;

@Stateless
public class AdvertClient
{
    private static final Logger logger = Logger.getLogger(AdvertClient.class.getName());

    public List<AdvertNodeSummary> getAdverts(String serviceRootURL, String requesterId, String userId)
    {
        List<AdvertNodeSummary> adverts = new LinkedList<AdvertNodeSummary>();

        try
        {
            if ((serviceRootURL != null) && (requesterId != null) && (userId != null))
            {
                ClientRequest request = new ClientRequest(serviceRootURL + "/control/ws/metadata/adverts");
                request.queryParameter("requesterid", requesterId);
                request.queryParameter("userId", userId);

                ClientResponse<List<AdvertNodeDTO>> response = request.get(new GenericType<List<AdvertNodeDTO>>() {});

                if (response.getStatus() == HttpResponseCodes.SC_OK)
                {
                    List<AdvertNodeDTO> advertNodeDTOs = response.getEntity();
 
                    logger.log(Level.FINE, "Received 'adverts' [" + advertNodeDTOs + "]");

                    for (AdvertNodeDTO advertNodeDTO: advertNodeDTOs)
                        adverts.add(new AdvertNodeSummary(advertNodeDTO.getId(), advertNodeDTO.getMetadataId(), advertNodeDTO.getMetadataPath(), advertNodeDTO.getRootNode(), advertNodeDTO.getNodeClass(), advertNodeDTO.getName(), advertNodeDTO.getSummary(), advertNodeDTO.getDiscription(), advertNodeDTO.getDateCreated(), advertNodeDTO.getDateUpdate(), advertNodeDTO.getOwner(), advertNodeDTO.getTags(), advertNodeDTO.getChildNodeIds()));
                }
                else
                    logger.log(Level.WARNING, "Problem in 'getAdverts' getting entity " + response.getStatus());
            }
            else
                logger.log(Level.WARNING, "Invalid parameter in 'getAdverts' for getting adverts");
        }
        catch (Throwable throwable)
        {
            logger.log(Level.WARNING, "Problem in 'getAdverts'", throwable);
        }

        return adverts;
    }
}
<commit_msg>Reduced logging output<commit_after>/*
 * Copyright (c) 2013-2014, Arjuna Technologies Limited, Newcastle-upon-Tyne, England. All rights reserved.
 */

package com.arjuna.databroker.webportal.comms;

import java.util.LinkedList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.ejb.Stateless;
import org.jboss.resteasy.client.ClientRequest;
import org.jboss.resteasy.client.ClientResponse;
import org.jboss.resteasy.util.GenericType;
import org.jboss.resteasy.util.HttpResponseCodes;
import com.arjuna.databroker.control.comms.AdvertNodeDTO;

@Stateless
public class AdvertClient
{
    private static final Logger logger = Logger.getLogger(AdvertClient.class.getName());

    public List<AdvertNodeSummary> getAdverts(String serviceRootURL, String requesterId, String userId)
    {
        List<AdvertNodeSummary> adverts = new LinkedList<AdvertNodeSummary>();

        try
        {
            if ((serviceRootURL != null) && (requesterId != null) && (userId != null))
            {
                ClientRequest request = new ClientRequest(serviceRootURL + "/control/ws/metadata/adverts");
                request.queryParameter("requesterid", requesterId);
                request.queryParameter("userId", userId);

                ClientResponse<List<AdvertNodeDTO>> response = request.get(new GenericType<List<AdvertNodeDTO>>() {});

                if (response.getStatus() == HttpResponseCodes.SC_OK)
                {
                    List<AdvertNodeDTO> advertNodeDTOs = response.getEntity();
 
                    logger.log(Level.FINE, "Received 'adverts' number " + advertNodeDTOs.size());

                    for (AdvertNodeDTO advertNodeDTO: advertNodeDTOs)
                        adverts.add(new AdvertNodeSummary(advertNodeDTO.getId(), advertNodeDTO.getMetadataId(), advertNodeDTO.getMetadataPath(), advertNodeDTO.getRootNode(), advertNodeDTO.getNodeClass(), advertNodeDTO.getName(), advertNodeDTO.getSummary(), advertNodeDTO.getDiscription(), advertNodeDTO.getDateCreated(), advertNodeDTO.getDateUpdate(), advertNodeDTO.getOwner(), advertNodeDTO.getTags(), advertNodeDTO.getChildNodeIds()));
                }
                else
                    logger.log(Level.WARNING, "Problem in 'getAdverts' getting entity " + response.getStatus());
            }
            else
                logger.log(Level.WARNING, "Invalid parameter in 'getAdverts' for getting adverts");
        }
        catch (Throwable throwable)
        {
            logger.log(Level.WARNING, "Problem in 'getAdverts'", throwable);
        }

        return adverts;
    }
}

{'fraction_non_alphanumeric': 0.11077158135981666, 'fraction_numerical': 0.0030557677616501145, 'mean_word_length': 3.044015444015444, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7063544', 'n_tokens_mistral': 1490, 'n_tokens_neox': 1465, 'n_words': 267}