/*
 * Copyright 2015 Hewlett-Packard Development Company, L.P.
 * Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License.
 */

package com.hp.autonomy.hod.client.api.textindex.query.search;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder;
import lombok.Data;
import lombok.Setter;
import lombok.experimental.Accessors;

/**
 * An entity returned from an HP Haven OnDemand index
 */
@Data
@JsonDeserialize(builder = Entity.Builder.class)
public class Entity {
    /**
     * @return The name of the concept found
     */
    private final String text;

    /**
     * @return The number of documents with this concept
     */
    private final Integer docsWithPhrase;

    /**
     * @return The total number of occurrences of this element in the results set
     */
    private final Integer occurrences;

    /**
     * @return The number of documents of the results set in which all terms of this element appear.
     */
    private final Integer docsWithAllTerms;

    /**
     * @return The cluster into which the phrase has been grouped
     */
    private final Integer cluster;

    private Entity(final Builder builder) {
        text = builder.text;
        docsWithPhrase = builder.docsWithPhrase;
        occurrences = builder.occurrences;
        docsWithAllTerms = builder.docsWithAllTerms;
        cluster = builder.cluster;
    }

    @Setter
    @Accessors(chain = true)
    @JsonPOJOBuilder(withPrefix = "set")
    @JsonIgnoreProperties(ignoreUnknown = true)
    public static class Builder {
        private String text;
        private Integer docsWithPhrase;
        private Integer occurrences;
        private Integer docsWithAllTerms;
        private Integer cluster;

        public Entity build() {
            return new Entity(this);
        }

    }
}

@@ -516,16 +516,46 @@
 ssors;%0A%0A
+import java.io.Serializable;%0A%0A
 /**%0A * A
@@ -683,17 +683,113 @@
  Entity 
-%7B
+implements Serializable %7B%0A    private static final long serialVersionUID = -768487153426935202L;%0A
 %0A    /**
@@ -834,16 +834,61 @@
 t found%0A
+     * @serial The name of the concept found%0A
      */%0A
@@ -984,16 +984,73 @@
 concept%0A
+     * @serial The number of documents with this concept%0A
      */%0A
@@ -1182,16 +1182,98 @@
 lts set%0A
+     * @serial The total number of occurrences of this element in the results set%0A
      */%0A
@@ -1421,16 +1421,117 @@
 appear.%0A
+     * @serial The number of documents of the results set in which all terms of this element appear.%0A
      */%0A
@@ -1649,16 +1649,82 @@
 grouped%0A
+     * @serial The cluster into which the phrase has been grouped%0A
      */%0A

Implement Serializable on Entity. [rev: matthew.gordon]