<commit_before>package org.motechproject.openmrs.atomfeed.service.impl;

import com.thoughtworks.xstream.XStream;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.motechproject.MotechException;
import org.motechproject.event.MotechEvent;
import org.motechproject.event.listener.EventRelay;
import org.motechproject.openmrs.atomfeed.OpenMrsHttpClient;
import org.motechproject.openmrs.atomfeed.builder.ConceptEvent;
import org.motechproject.openmrs.atomfeed.builder.EncounterEvent;
import org.motechproject.openmrs.atomfeed.builder.ObservationEvent;
import org.motechproject.openmrs.atomfeed.builder.PatientEvent;
import org.motechproject.openmrs.atomfeed.model.Entry;
import org.motechproject.openmrs.atomfeed.model.Feed;
import org.motechproject.openmrs.atomfeed.model.Link;
import org.motechproject.openmrs.atomfeed.repository.AtomFeedDao;
import org.motechproject.openmrs.atomfeed.service.AtomFeedService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Collections;
import java.util.List;

@Component("atomFeedService")
public class AtomFeedServiceImpl implements AtomFeedService {
    private static final Logger LOGGER = Logger.getLogger(AtomFeedServiceImpl.class);

    private final OpenMrsHttpClient client;
    private final XStream xstream;
    private final EventRelay eventRelay;
    private final AtomFeedDao atomFeedDao;

    @Autowired
    public AtomFeedServiceImpl(OpenMrsHttpClient client, EventRelay eventRelay, AtomFeedDao atomFeedDao) {
        this.client = client;
        this.eventRelay = eventRelay;
        this.atomFeedDao = atomFeedDao;

        xstream = new XStream();
        xstream.setClassLoader(getClass().getClassLoader());

        xstream.processAnnotations(Feed.class);
        xstream.processAnnotations(Entry.class);
        xstream.processAnnotations(Entry.Author.class);
        xstream.processAnnotations(Link.class);

        xstream.omitField(Entry.class, "summary");<commit_msg>RGillen | #334 | Fixed xmlpull package dependencies and atom feed bug (requires new Nexus artifacts)<commit_after>package org.motechproject.openmrs.atomfeed.service.impl;

import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.io.xml.Xpp3Driver;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.motechproject.MotechException;
import org.motechproject.event.MotechEvent;
import org.motechproject.event.listener.EventRelay;
import org.motechproject.openmrs.atomfeed.OpenMrsHttpClient;
import org.motechproject.openmrs.atomfeed.builder.ConceptEvent;
import org.motechproject.openmrs.atomfeed.builder.EncounterEvent;
import org.motechproject.openmrs.atomfeed.builder.ObservationEvent;
import org.motechproject.openmrs.atomfeed.builder.PatientEvent;
import org.motechproject.openmrs.atomfeed.model.Entry;
import org.motechproject.openmrs.atomfeed.model.Feed;
import org.motechproject.openmrs.atomfeed.model.Link;
import org.motechproject.openmrs.atomfeed.repository.AtomFeedDao;
import org.motechproject.openmrs.atomfeed.service.AtomFeedService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Collections;
import java.util.List;

@Component("atomFeedService")
public class AtomFeedServiceImpl implements AtomFeedService {
    private static final Logger LOGGER = Logger.getLogger(AtomFeedServiceImpl.class);

    private final OpenMrsHttpClient client;
    private final XStream xstream;
    private final EventRelay eventRelay;
    private final AtomFeedDao atomFeedDao;

    @Autowired
    public AtomFeedServiceImpl(OpenMrsHttpClient client, EventRelay eventRelay, AtomFeedDao atomFeedDao) {
        this.client = client;
        this.eventRelay = eventRelay;
        this.atomFeedDao = atomFeedDao;

        xstream = new XStream(new Xpp3Driver());
        xstream.setClassLoader(getClass().getClassLoader());

        xstream.processAnnotations(Feed.class);
        xstream.processAnnotations(Entry.class);
        xstream.processAnnotations(Entry.Author.class);
        xstream.processAnnotations(Link.class);

        xstream.omitField(Entry.class, "summary");
{'fraction_non_alphanumeric': 0.08874764595103578, 'fraction_numerical': 0.001647834274952919, 'mean_word_length': 5.418429003021148, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '3878963', 'n_tokens_mistral': 1309, 'n_tokens_neox': 1273, 'n_words': 203}