// Path: src/main/java/yourwebproject2/framework/data/BaseService.java
// public interface BaseService<T extends Entity, ID extends Serializable> {
//     /**
//      * Method to setup the service with basic
//      * required data. Called after Spring initialization.
//      */
//     public void setupService();
// 
//     /**
//      * Service to insert the new object
//      *
//      * @param object
//      *         The newly object
//      */
//     public T insert(T object) throws Exception;
// 
//     /**
//      * Service to update an existing object
//      *
//      * @param object
//      *         The existing object
//      */
//     public T update(T object) throws Exception;
// 
//     /**
//      * Service to delete an existing object
//      *
//      * @param object
//      *         The existing object
//      */
//     public void delete(T object) throws Exception;
// 
//     /**
//      * Service to find an existing object by its given id and query name
//      *
//      * @param id
//      *         Id of the resource
//      */
//     public T findById(ID id) throws Exception;
// 
// 
//     /**
//      * Service to find a collection of entities by pages
//      *
//      * @param pageNum
//      * @param countPerPage
//      * @param order
//      *
//      * @return
//      *
//      * @throws Exception
//      */
//     public Collection<T> findAllByPage(int pageNum, int countPerPage, Order order) throws Exception;
// }
// 
// Path: src/main/java/yourwebproject2/framework/exception/NotFoundException.java
// public class NotFoundException extends Exception {
//     public NotFoundException(String message) {
//         super(message);
//     }
// }
// 
// Path: src/main/java/yourwebproject2/model/entity/Category.java
// @Entity
// @Table(indexes = {  @Index(name="name_idx", columnList = "name", unique = true),
//         @Index(name="priority_idx", columnList = "priority"),
//         @Index(name="parentCategory_idx", columnList = "parent_category")})
// public class Category extends JPAEntity<Long> {
//     private String name;
//     private Integer priority;
//     private Category parentCategory;
// 
//     @NotNull @NotBlank
//     @Column
//     public String getName() {
//         return name;
//     }
// 
//     public void setName(String name) {
//         this.name = name;
//     }
// 
//     @NotNull
//     @Column
//     public Integer getPriority() {
//         return priority;
//     }
// 
//     public void setPriority(Integer priority) {
//         this.priority = priority;
//     }
// 
//     @ManyToOne(fetch = FetchType.EAGER)
//     public Category getParentCategory() {
//         return parentCategory;
//     }
// 
//     public void setParentCategory(Category parentCategory) {
//         this.parentCategory = parentCategory;
//     }
// 
//     @Override
//     public String toString() {
//         return "Category{" +
//                 "name='" + name + '\'' +
//                 ", priority=" + priority +
//                 ", parentCategory=" + parentCategory +
//                 '}';
//     }
// }


import yourwebproject2.framework.data.BaseService;
import yourwebproject2.framework.exception.NotFoundException;
import yourwebproject2.model.entity.Category;
import java.util.List;
package yourwebproject2.service;



/**
 * Brings in the basic CRUD service ops from BaseService. Insert additional ops here.
 *
 * Created by Y.Kamesh on 8/2/2015.
 */
public interface CategoryService extends BaseService<Category, Long> {
    /**
     * Validates whether the given category already
     * exists in the system.
     *
     * @param categoryName
     *
     * @return
     */
    public boolean isCategoryPresent(String categoryName);

    /**
     * Validates whether the given category priority already
     * exists in the system.
     *
     * @param priorityId
     *
     * @return
     */
    public boolean isPriorityPresent(Integer priorityId);

    /**
     * Find category by name
     *
     * @param categoryName
     * @return
     */
// Path: src/main/java/yourwebproject2/framework/data/BaseService.java
// public interface BaseService<T extends Entity, ID extends Serializable> {
//     /**
//      * Method to setup the service with basic
//      * required data. Called after Spring initialization.
//      */
//     public void setupService();
// 
//     /**
//      * Service to insert the new object
//      *
//      * @param object
//      *         The newly object
//      */
//     public T insert(T object) throws Exception;
// 
//     /**
//      * Service to update an existing object
//      *
//      * @param object
//      *         The existing object
//      */
//     public T update(T object) throws Exception;
// 
//     /**
//      * Service to delete an existing object
//      *
//      * @param object
//      *         The existing object
//      */
//     public void delete(T object) throws Exception;
// 
//     /**
//      * Service to find an existing object by its given id and query name
//      *
//      * @param id
//      *         Id of the resource
//      */
//     public T findById(ID id) throws Exception;
// 
// 
//     /**
//      * Service to find a collection of entities by pages
//      *
//      * @param pageNum
//      * @param countPerPage
//      * @param order
//      *
//      * @return
//      *
//      * @throws Exception
//      */
//     public Collection<T> findAllByPage(int pageNum, int countPerPage, Order order) throws Exception;
// }
// 
// Path: src/main/java/yourwebproject2/framework/exception/NotFoundException.java
// public class NotFoundException extends Exception {
//     public NotFoundException(String message) {
//         super(message);
//     }
// }
// 
// Path: src/main/java/yourwebproject2/model/entity/Category.java
// @Entity
// @Table(indexes = {  @Index(name="name_idx", columnList = "name", unique = true),
//         @Index(name="priority_idx", columnList = "priority"),
//         @Index(name="parentCategory_idx", columnList = "parent_category")})
// public class Category extends JPAEntity<Long> {
//     private String name;
//     private Integer priority;
//     private Category parentCategory;
// 
//     @NotNull @NotBlank
//     @Column
//     public String getName() {
//         return name;
//     }
// 
//     public void setName(String name) {
//         this.name = name;
//     }
// 
//     @NotNull
//     @Column
//     public Integer getPriority() {
//         return priority;
//     }
// 
//     public void setPriority(Integer priority) {
//         this.priority = priority;
//     }
// 
//     @ManyToOne(fetch = FetchType.EAGER)
//     public Category getParentCategory() {
//         return parentCategory;
//     }
// 
//     public void setParentCategory(Category parentCategory) {
//         this.parentCategory = parentCategory;
//     }
// 
//     @Override
//     public String toString() {
//         return "Category{" +
//                 "name='" + name + '\'' +
//                 ", priority=" + priority +
//                 ", parentCategory=" + parentCategory +
//                 '}';
//     }
// }


// Path: src/main/java/yourwebproject2/service/CategoryService.java
import yourwebproject2.framework.data.BaseService;
import yourwebproject2.framework.exception.NotFoundException;
import yourwebproject2.model.entity.Category;
import java.util.List;

package yourwebproject2.service;



/**
 * Brings in the basic CRUD service ops from BaseService. Insert additional ops here.
 *
 * Created by Y.Kamesh on 8/2/2015.
 */
public interface CategoryService extends BaseService<Category, Long> {
    /**
     * Validates whether the given category already
     * exists in the system.
     *
     * @param categoryName
     *
     * @return
     */
    public boolean isCategoryPresent(String categoryName);

    /**
     * Validates whether the given category priority already
     * exists in the system.
     *
     * @param priorityId
     *
     * @return
     */
    public boolean isPriorityPresent(Integer priorityId);

    /**
     * Find category by name
     *
     * @param categoryName
     * @return
     */
    public Category findByCategoryName(String categoryName) throws NotFoundException;