// Path: prelert-engine-api-common/src/main/java/com/prelert/job/results/CategoryDefinition.java
// @JsonInclude(Include.NON_NULL)
// public class CategoryDefinition
// {
//     public static final String TYPE = "categoryDefinition";
//     public static final String CATEGORY_ID = "categoryId";
//     public static final String TERMS = "terms";
//     public static final String REGEX = "regex";
//     public static final String EXAMPLES = "examples";
// 
//     private long m_Id = 0L;
//     private String m_Terms = "";
//     private String m_Regex = "";
//     private final Set<String> m_Examples = new TreeSet<>();
// 
//     public long getCategoryId()
//     {
//         return m_Id;
//     }
// 
//     public void setCategoryId(long categoryId)
//     {
//         m_Id = categoryId;
//     }
// 
//     public String getTerms()
//     {
//         return m_Terms;
//     }
// 
//     public void setTerms(String terms)
//     {
//         m_Terms = terms;
//     }
// 
//     public String getRegex()
//     {
//         return m_Regex;
//     }
// 
//     public void setRegex(String regex)
//     {
//         m_Regex = regex;
//     }
// 
//     public List<String> getExamples()
//     {
//         return new ArrayList<>(m_Examples);
//     }
// 
//     public void setExamples(Collection<String> examples)
//     {
//         m_Examples.clear();
//         m_Examples.addAll(examples);
//     }
// 
//     public void addExample(String example)
//     {
//         m_Examples.add(example);
//     }
// 
//     @Override
//     public boolean equals(Object other)
//     {
//         if (this == other)
//         {
//             return true;
//         }
//         if (other instanceof CategoryDefinition == false)
//         {
//             return false;
//         }
//         CategoryDefinition that = (CategoryDefinition) other;
//         return Objects.equals(this.m_Id, that.m_Id)
//                 && Objects.equals(this.m_Terms, that.m_Terms)
//                 && Objects.equals(this.m_Regex, that.m_Regex)
//                 && Objects.equals(this.m_Examples, that.m_Examples);
//     }
// 
//     @Override
//     public int hashCode()
//     {
//         return Objects.hash(m_Id, m_Terms, m_Regex, m_Examples);
//     }
// }
// 
// Path: prelert-engine-api-common/src/main/java/com/prelert/rs/data/SingleDocument.java
// @JsonPropertyOrder({"exists", "type", "document"})
// @JsonInclude(Include.NON_NULL)
// public class SingleDocument<T>
// {
//     private boolean m_Exists;
//     private String m_Type;
// 
//     private T m_Document;
// 
//     /**
//      * Return true if the requested document exists
//      * @return true is document exists
//      */
//     public boolean isExists()
//     {
//         return m_Exists;
//     }
// 
//     public void setExists(boolean exists)
//     {
//         m_Exists = exists;
//     }
// 
//     /**
//      * The type of the requested document
//      * @return The document type
//      */
//     public String getType()
//     {
//         return m_Type;
//     }
// 
//     public void setType(String type)
//     {
//         m_Type = type;
//     }
// 
//     /**
//      * Get the requested document or null
//      * @return The document or <code>null</code>
//      */
//     public T getDocument()
//     {
//         return m_Document;
//     }
// 
//     /**
//      * Set the requested document.
//      * If the doc is non-null {@link #isExists() Exists} is set to true
//      * else it is false
//      * @param doc the requested document
//      */
//     public void setDocument(T doc)
//     {
//         m_Document = doc;
//         m_Exists = (doc != null) ? true : false;
//     }
// }


import com.prelert.rs.data.SingleDocument;
import java.io.IOException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.prelert.job.results.CategoryDefinition;
/****************************************************************************
 *                                                                          *
 * Copyright 2015-2016 Prelert Ltd                                          *
 *                                                                          *
 * Licensed under the Apache License, Version 2.0 (the "License");          *
 * you may not use this file except in compliance with the License.         *
 * You may obtain a copy of the License at                                  *
 *                                                                          *
 *    http://www.apache.org/licenses/LICENSE-2.0                            *
 *                                                                          *
 * Unless required by applicable law or agreed to in writing, software      *
 * distributed under the License is distributed on an "AS IS" BASIS,        *
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
 * See the License for the specific language governing permissions and      *
 * limitations under the License.                                           *
 *                                                                          *
 ***************************************************************************/

package com.prelert.rs.client;



public class CategoryDefinitionRequestBuilder extends BaseJobRequestBuilder<CategoryDefinition>
{
    private final String m_CategoryId;

    /**
     * @param client The engine API client
     * @param jobId The Job's unique Id
     * @param categoryId The category's unique ID
     */
    public CategoryDefinitionRequestBuilder(EngineApiClient client, String jobId, String categoryId)
    {
        super(client, jobId);
        m_CategoryId = categoryId;
    }

    /**
     * Returns a single document with the category definition that was requested
     *
     * @return A {@link SingleDocument} object containing the requested {@link CategoryDefinition}
     * object
     * @throws IOException If HTTP GET fails
     */
    public SingleDocument<CategoryDefinition> get() throws IOException
    {
        StringBuilder url = new StringBuilder();
        url.append(baseUrl()).append("/results/").append(jobId()).append("/categorydefinitions/")
// Path: prelert-engine-api-common/src/main/java/com/prelert/job/results/CategoryDefinition.java
// @JsonInclude(Include.NON_NULL)
// public class CategoryDefinition
// {
//     public static final String TYPE = "categoryDefinition";
//     public static final String CATEGORY_ID = "categoryId";
//     public static final String TERMS = "terms";
//     public static final String REGEX = "regex";
//     public static final String EXAMPLES = "examples";
// 
//     private long m_Id = 0L;
//     private String m_Terms = "";
//     private String m_Regex = "";
//     private final Set<String> m_Examples = new TreeSet<>();
// 
//     public long getCategoryId()
//     {
//         return m_Id;
//     }
// 
//     public void setCategoryId(long categoryId)
//     {
//         m_Id = categoryId;
//     }
// 
//     public String getTerms()
//     {
//         return m_Terms;
//     }
// 
//     public void setTerms(String terms)
//     {
//         m_Terms = terms;
//     }
// 
//     public String getRegex()
//     {
//         return m_Regex;
//     }
// 
//     public void setRegex(String regex)
//     {
//         m_Regex = regex;
//     }
// 
//     public List<String> getExamples()
//     {
//         return new ArrayList<>(m_Examples);
//     }
// 
//     public void setExamples(Collection<String> examples)
//     {
//         m_Examples.clear();
//         m_Examples.addAll(examples);
//     }
// 
//     public void addExample(String example)
//     {
//         m_Examples.add(example);
//     }
// 
//     @Override
//     public boolean equals(Object other)
//     {
//         if (this == other)
//         {
//             return true;
//         }
//         if (other instanceof CategoryDefinition == false)
//         {
//             return false;
//         }
//         CategoryDefinition that = (CategoryDefinition) other;
//         return Objects.equals(this.m_Id, that.m_Id)
//                 && Objects.equals(this.m_Terms, that.m_Terms)
//                 && Objects.equals(this.m_Regex, that.m_Regex)
//                 && Objects.equals(this.m_Examples, that.m_Examples);
//     }
// 
//     @Override
//     public int hashCode()
//     {
//         return Objects.hash(m_Id, m_Terms, m_Regex, m_Examples);
//     }
// }
// 
// Path: prelert-engine-api-common/src/main/java/com/prelert/rs/data/SingleDocument.java
// @JsonPropertyOrder({"exists", "type", "document"})
// @JsonInclude(Include.NON_NULL)
// public class SingleDocument<T>
// {
//     private boolean m_Exists;
//     private String m_Type;
// 
//     private T m_Document;
// 
//     /**
//      * Return true if the requested document exists
//      * @return true is document exists
//      */
//     public boolean isExists()
//     {
//         return m_Exists;
//     }
// 
//     public void setExists(boolean exists)
//     {
//         m_Exists = exists;
//     }
// 
//     /**
//      * The type of the requested document
//      * @return The document type
//      */
//     public String getType()
//     {
//         return m_Type;
//     }
// 
//     public void setType(String type)
//     {
//         m_Type = type;
//     }
// 
//     /**
//      * Get the requested document or null
//      * @return The document or <code>null</code>
//      */
//     public T getDocument()
//     {
//         return m_Document;
//     }
// 
//     /**
//      * Set the requested document.
//      * If the doc is non-null {@link #isExists() Exists} is set to true
//      * else it is false
//      * @param doc the requested document
//      */
//     public void setDocument(T doc)
//     {
//         m_Document = doc;
//         m_Exists = (doc != null) ? true : false;
//     }
// }


// Path: prelert-engine-api-client/src/main/java/com/prelert/rs/client/CategoryDefinitionRequestBuilder.java
import com.prelert.rs.data.SingleDocument;
import java.io.IOException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.prelert.job.results.CategoryDefinition;

/****************************************************************************
 *                                                                          *
 * Copyright 2015-2016 Prelert Ltd                                          *
 *                                                                          *
 * Licensed under the Apache License, Version 2.0 (the "License");          *
 * you may not use this file except in compliance with the License.         *
 * You may obtain a copy of the License at                                  *
 *                                                                          *
 *    http://www.apache.org/licenses/LICENSE-2.0                            *
 *                                                                          *
 * Unless required by applicable law or agreed to in writing, software      *
 * distributed under the License is distributed on an "AS IS" BASIS,        *
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
 * See the License for the specific language governing permissions and      *
 * limitations under the License.                                           *
 *                                                                          *
 ***************************************************************************/

package com.prelert.rs.client;



public class CategoryDefinitionRequestBuilder extends BaseJobRequestBuilder<CategoryDefinition>
{
    private final String m_CategoryId;

    /**
     * @param client The engine API client
     * @param jobId The Job's unique Id
     * @param categoryId The category's unique ID
     */
    public CategoryDefinitionRequestBuilder(EngineApiClient client, String jobId, String categoryId)
    {
        super(client, jobId);
        m_CategoryId = categoryId;
    }

    /**
     * Returns a single document with the category definition that was requested
     *
     * @return A {@link SingleDocument} object containing the requested {@link CategoryDefinition}
     * object
     * @throws IOException If HTTP GET fails
     */
    public SingleDocument<CategoryDefinition> get() throws IOException
    {
        StringBuilder url = new StringBuilder();
        url.append(baseUrl()).append("/results/").append(jobId()).append("/categorydefinitions/")
                .append(m_CategoryId);