<commit_before>/*
 * Copyright 2012, 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.model;

import java.io.Serializable;

import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.OneToOne;

import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import org.hibernate.validator.constraints.NotEmpty;
import org.zanata.common.DocumentType;

import com.google.common.base.Objects;

@Entity
@Getter
@Setter
@NoArgsConstructor
// is this necessary?
public class HRawDocument extends ModelEntityBase implements Serializable {

    private static final long serialVersionUID = 5129552589912687504L;

    // TODO ensure any document deletion cascades to remove associated
    // HRawDocument
    private HDocument document;

    // TODO none of these should allow null
    private String contentHash;
    private String fileId;
    private DocumentType type;
    private String uploadedBy;

    private String adapterParameters;

    @OneToOne(mappedBy = "rawDocument")
    public HDocument getDocument() {
        return document;
    }

    public void setDocument(HDocument document) {
        this.document = document;
    }

    @NotEmpty
    public String getContentHash() {
        return contentHash;
    }

    @Enumerated(EnumType.STRING)
    public DocumentType getType() {
        return type;
    }

    public String getUploadedBy() {
        return uploadedBy;
    }

    @Override
    public String toString() {
        return getClass().getSimpleName() + "@"
                + Integer.toHexString(hashCode()) + "[id=" + id
                + ",versionNum=" + versionNum + ",contentHash=" + contentHash
                + "]";
    }
    // TODO override equals to use contentHash, type, parameters, etc.<commit_msg>fix HRawDocument toString error<commit_after>/*
 * Copyright 2012, 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.model;

import java.io.Serializable;

import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.OneToOne;

import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import org.hibernate.validator.constraints.NotEmpty;
import org.zanata.common.DocumentType;

import com.google.common.base.Objects;

@Entity
@Getter
@Setter
@NoArgsConstructor
// is this necessary?
public class HRawDocument extends ModelEntityBase implements Serializable {

    private static final long serialVersionUID = 5129552589912687504L;

    // TODO ensure any document deletion cascades to remove associated
    // HRawDocument
    private HDocument document;

    // TODO none of these should allow null
    private String contentHash;
    private String fileId;
    private DocumentType type;
    private String uploadedBy;

    private String adapterParameters;

    @OneToOne(mappedBy = "rawDocument")
    public HDocument getDocument() {
        return document;
    }

    public void setDocument(HDocument document) {
        this.document = document;
    }

    @NotEmpty
    public String getContentHash() {
        return contentHash;
    }

    @Enumerated(EnumType.STRING)
    public DocumentType getType() {
        return type;
    }

    public String getUploadedBy() {
        return uploadedBy;
    }

    @Override
    public String toString() {
        return getClass().getSimpleName() + "@"
                + Integer.toHexString(hashCode()) + "[id=" + getId()
                + ",versionNum=" + getVersionNum() + ",contentHash=" + contentHash
                + "]";
    }
    // TODO override equals to use contentHash, type, parameters, etc.
{'fraction_non_alphanumeric': 0.07614213197969544, 'fraction_numerical': 0.01305293691080493, 'mean_word_length': 3.3716323296354993, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '7658889', 'n_tokens_mistral': 1505, 'n_tokens_neox': 1427, 'n_words': 564}