<commit_before>/*
 * Copyright 2017, Red Hat, Inc. and individual contributors
 * as indicated by the @author tags. See the copyright.txt file in the
 * distribution for a full listing of individual contributors.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */
package org.zanata.webtrans.shared.rest.dto;

import java.io.Serializable;
import java.util.Collections;
import java.util.List;

import org.codehaus.jackson.annotate.JsonIgnore;
import org.zanata.webtrans.shared.model.ProjectIterationId;

import com.google.common.base.MoreObjects;
import com.google.gwt.user.client.rpc.IsSerializable;

/**
 * Criteria for TM merge from internal TM.
 */
public class InternalTMSource implements Serializable, IsSerializable {

    public static final InternalTMSource SELECT_ALL = new InternalTMSource(InternalTMChoice.SelectAny, null) {
        private static final long serialVersionUID = 1L;

        @Override
        public String toString() {
            return "Select internal TM from any project version";
        }
    };

    public static final InternalTMSource SELECT_NONE = new InternalTMSource(InternalTMChoice.SelectNone, null);
    private static final long serialVersionUID = 1L;
    private InternalTMChoice choice;
    private List<ProjectIterationId> projectIterationIds;
    @JsonIgnore
    private List<Long> filteredProjectVersionIds = Collections.emptyList();

    public InternalTMSource(InternalTMChoice choice,
            List<ProjectIterationId> projectIterationIds) {
        this.choice = choice;
        this.projectIterationIds = projectIterationIds;
    }

    public InternalTMSource() {
    }

    public List<ProjectIterationId> getProjectIterationIds() {
        return projectIterationIds;
    }

    public InternalTMChoice getChoice() {
        return choice;
    }

    @Override
    public String toString() {
        return MoreObjects.toStringHelper(this)
                .add("choice", choice)
                .add("projectIterationIds", projectIterationIds)
                .toString();
    }

    public void setFilteredProjectVersionIds(
            List<Long> filteredProjectVersionIds) {
        this.filteredProjectVersionIds = filteredProjectVersionIds;
    }

    public List<Long> getFilteredProjectVersionIds() {
        return filteredProjectVersionIds;
    }

    public enum InternalTMChoice {
        SelectNone, SelectAny, SelectSome

    }
}<commit_msg>fix: TM serializable issue (#529)<commit_after>/*
 * Copyright 2017, Red Hat, Inc. and individual contributors
 * as indicated by the @author tags. See the copyright.txt file in the
 * distribution for a full listing of individual contributors.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */
package org.zanata.webtrans.shared.rest.dto;

import java.io.Serializable;
import java.util.Collections;
import java.util.List;

import org.codehaus.jackson.annotate.JsonIgnore;
import org.zanata.webtrans.shared.model.ProjectIterationId;

import com.google.common.base.MoreObjects;
import com.google.gwt.user.client.rpc.IsSerializable;

/**
 * Criteria for TM merge from internal TM.
 */
public class InternalTMSource implements Serializable, IsSerializable {

    public static final InternalTMSource SELECT_ALL = new InternalTMSource(InternalTMChoice.SelectAny, null);
    public static final InternalTMSource SELECT_NONE = new InternalTMSource(InternalTMChoice.SelectNone, null);
    private static final long serialVersionUID = 1L;
    private InternalTMChoice choice;
    private List<ProjectIterationId> projectIterationIds;
    @JsonIgnore
    private List<Long> filteredProjectVersionIds = Collections.emptyList();

    public InternalTMSource(InternalTMChoice choice,
            List<ProjectIterationId> projectIterationIds) {
        this.choice = choice;
        this.projectIterationIds = projectIterationIds;
    }

    public InternalTMSource() {
    }

    public List<ProjectIterationId> getProjectIterationIds() {
        return projectIterationIds;
    }

    public InternalTMChoice getChoice() {
        return choice;
    }

    @Override
    public String toString() {
        // SELECT_ALL
        if (choice.equals(InternalTMChoice.SelectAny) && projectIterationIds == null) {
            return "Select internal TM from any project version";
        }
        return MoreObjects.toStringHelper(this)
                .add("choice", choice)
                .add("projectIterationIds", projectIterationIds)
                .toString();
    }

    public void setFilteredProjectVersionIds(
            List<Long> filteredProjectVersionIds) {
        this.filteredProjectVersionIds = filteredProjectVersionIds;
    }

    public List<Long> getFilteredProjectVersionIds() {
        return filteredProjectVersionIds;
    }

    public enum InternalTMChoice {
        SelectNone, SelectAny, SelectSome

    }
}
{'fraction_non_alphanumeric': 0.0713151207115629, 'fraction_numerical': 0.0063532401524777635, 'mean_word_length': 3.4723011363636362, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '2375399', 'n_tokens_mistral': 1675, 'n_tokens_neox': 1619, 'n_words': 559}