<commit_before>package org.kuali.rice.ksb.api.registry;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAnyElement;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.kuali.rice.core.api.CoreConstants;
import org.kuali.rice.core.api.mo.ModelObjectComplete;
import org.w3c.dom.Element;

/**
 * Wraps information resulting from a "removeAndPublish" operation on the
 * registry.  Effectively contains a list of {@link ServiceEndpoint} instances
 * for services that were published and those that were removed
 * 
 * @author Kuali Rice Team (<EMAIL>)
 *
 */
@XmlRootElement(name = RemoveAndPublishResult.Constants.ROOT_ELEMENT_NAME)
@XmlAccessorType(XmlAccessType.NONE)
@XmlType(name = RemoveAndPublishResult.Constants.TYPE_NAME, propOrder = {
		RemoveAndPublishResult.Elements.SERVICES_REMOVED,
		RemoveAndPublishResult.Elements.SERVICES_PUBLISHED,
		CoreConstants.CommonElements.FUTURE_ELEMENTS
})
public class RemoveAndPublishResult implements ModelObjectComplete {

	private static final long serialVersionUID = 4279564869510247725L;

	@XmlElementWrapper(name = Elements.SERVICES_REMOVED, required = false)
	@XmlElement(name = Elements.SERVICE_REMOVED, required = false)
	private final List<ServiceEndpoint> servicesRemoved;
	
	@XmlElementWrapper(name = Elements.SERVICES_PUBLISHED, required = false)
	@XmlElement(name = Elements.SERVICE_PUBLISHED, required = false)
	private final List<ServiceEndpoint> servicesPublished;
	
    @SuppressWarnings("unused")
    @XmlAnyElement
    private final Collection<Element> _futureElements = null;

	private RemoveAndPublishResult() {
		this.servicesRemoved = null;
		this.servicesPublished = null;
	}
	
	private RemoveAndPublishResult(List<ServiceEndpoint> servicesRemoved, List<ServiceEndpoint> servicesPublished) {
		this.servicesRemoved = servicesRemoved;
		this.servicesPublished = servicesPublished;
	}
	
	public static RemoveAndPublishResult create(List<ServiceEndpoint> servicesRemoved, List<ServiceEndpoint> servicesPublished) {
		return new RemoveAndPublishResult(new ArrayList<ServiceEndpoint>(servicesRemoved),
				new ArrayList<ServiceEndpoint>(servicesPublished));
	}

	public List<ServiceEndpoint> getServicesRemoved() {
		return Collections.unmodifiableList(servicesRemoved);
	}

	public List<ServiceEndpoint> getServicesPublished() {
		return Collections.unmodifiableList(servicesPublished);
	}
	
	@Override
    public int hashCode() {
        return HashCodeBuilder.reflectionHashCode(this, Constants.HASH_CODE_EQUALS_EXCLUDE);
    }

    @Override
    public boolean equals(Object object) {
        return EqualsBuilder.reflectionEquals(object, this, Constants.HASH_CODE_EQUALS_EXCLUDE);
    }

    @Override
    public String toString() {
        return ToStringBuilder.reflectionToString(this);
    }
	
	/**
     * Defines some internal constants used on this class.
     */<commit_msg>KULRICE-4816 - javadoc'd RemoveAndPublishResult<commit_after>package org.kuali.rice.ksb.api.registry;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAnyElement;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.kuali.rice.core.api.CoreConstants;
import org.kuali.rice.core.api.mo.ModelObjectComplete;
import org.w3c.dom.Element;

/**
 * Wraps information resulting from a "removeAndPublish" operation on the
 * registry.  Effectively contains a list of {@link ServiceEndpoint} instances
 * for services that were published and those that were removed
 * 
 * @author Kuali Rice Team (<EMAIL>)
 *
 */
@XmlRootElement(name = RemoveAndPublishResult.Constants.ROOT_ELEMENT_NAME)
@XmlAccessorType(XmlAccessType.NONE)
@XmlType(name = RemoveAndPublishResult.Constants.TYPE_NAME, propOrder = {
		RemoveAndPublishResult.Elements.SERVICES_REMOVED,
		RemoveAndPublishResult.Elements.SERVICES_PUBLISHED,
		CoreConstants.CommonElements.FUTURE_ELEMENTS
})
public class RemoveAndPublishResult implements ModelObjectComplete {

	private static final long serialVersionUID = 4279564869510247725L;

	@XmlElementWrapper(name = Elements.SERVICES_REMOVED, required = false)
	@XmlElement(name = Elements.SERVICE_REMOVED, required = false)
	private final List<ServiceEndpoint> servicesRemoved;
	
	@XmlElementWrapper(name = Elements.SERVICES_PUBLISHED, required = false)
	@XmlElement(name = Elements.SERVICE_PUBLISHED, required = false)
	private final List<ServiceEndpoint> servicesPublished;
	
    @SuppressWarnings("unused")
    @XmlAnyElement
    private final Collection<Element> _futureElements = null;

	private RemoveAndPublishResult() {
		this.servicesRemoved = null;
		this.servicesPublished = null;
	}
	
	private RemoveAndPublishResult(List<ServiceEndpoint> servicesRemoved, List<ServiceEndpoint> servicesPublished) {
		this.servicesRemoved = servicesRemoved;
		this.servicesPublished = servicesPublished;
	}
	
	/**
	 * Creates a new {@code RemoveAndPublishResult} from the given lists of services removed and published.
	 * 
	 * @param servicesRemoved the list of services removed by the operation, can be a null or empty list
	 * @param servicesPublished the list of services published by the operation, can be a null or empty list
	 * 
	 * @return the constructed {@code RemoveAndPublishResult}, should never return null
	 */
	public static RemoveAndPublishResult create(List<ServiceEndpoint> servicesRemoved, List<ServiceEndpoint> servicesPublished) {
		return new RemoveAndPublishResult(new ArrayList<ServiceEndpoint>(servicesRemoved),
				new ArrayList<ServiceEndpoint>(servicesPublished));
	}

	/**
	 * Returns an unmodifiable list of services that were removed as the result
	 * of a remove-and-publish operation.
	 * 
	 * @return an unmodifiable list of removed services, will never be null but
	 * may be empty if no services were removed
	 */
	public List<ServiceEndpoint> getServicesRemoved() {
		return Collections.unmodifiableList(servicesRemoved);
	}

	/**
	 * Returns an unmodifiable list of services that were published as the result
	 * of a remove-and-publish operation.
	 * 
	 * @return an unmodifiable list of published services, will never be null but
	 * may be empty if no services were published
	 */
	public List<ServiceEndpoint> getServicesPublished() {
		return Collections.unmodifiableList(servicesPublished);
	}
	
	@Override
    public int hashCode() {
        return HashCodeBuilder.reflectionHashCode(this, Constants.HASH_CODE_EQUALS_EXCLUDE);
    }

    @Override
    public boolean equals(Object object) {
        return EqualsBuilder.reflectionEquals(object, this, Constants.HASH_CODE_EQUALS_EXCLUDE);
    }

    @Override
    public String toString() {
        return ToStringBuilder.reflectionToString(this);
    }
	
	/**
     * Defines some internal constants used on this class.
     */
{'fraction_non_alphanumeric': 0.08365860005204268, 'fraction_numerical': 0.005724694249284413, 'mean_word_length': 5.443419949706622, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 14}, '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': '3960077', 'n_tokens_mistral': 2286, 'n_tokens_neox': 2120, 'n_words': 507}