// Path: core/src/main/java/org/meruvian/yama/core/role/Role.java
// @Entity
// @Table(name = "yama_workflow_role")
// public class Role extends DefaultPersistence {
// 	private String name;
// 	private String description;
// 	private List<UserRole> users = new ArrayList<UserRole>();
// 	
// 	@NotNull
// 	@Column(nullable = false, unique = true)
// 	public String getName() {
// 		return name;
// 	}
// 
// 	public void setName(String name) {
// 		this.name = name;
// 	}
// 
// 	public String getDescription() {
// 		return description;
// 	}
// 
// 	public void setDescription(String description) {
// 		this.description = description;
// 	}
// 
// 	@JsonIgnore
// 	@OneToMany(mappedBy = "role", cascade = { CascadeType.REMOVE }, fetch = FetchType.LAZY)
// 	public List<UserRole> getUsers() {
// 		return users;
// 	}
// 
// 	public void setUsers(List<UserRole> users) {
// 		this.users = users;
// 	}
// }
// 
// Path: core/src/main/java/org/meruvian/yama/core/role/RoleRepository.java
// @Repository
// public interface RoleRepository extends DefaultRepository<Role> {
// 	Role findByName(String name);
// 	
// 	@Query("SELECT r FROM Role r WHERE (r.name LIKE ?1% OR r.description LIKE ?2%) AND r.logInformation.activeFlag = ?3")
// 	Page<Role> findByNameOrDescription(String name, String description, int activeFlag, Pageable pageable);
// }


import javax.inject.Inject;
import javax.ws.rs.BadRequestException;
import org.apache.commons.lang3.StringUtils;
import org.meruvian.yama.core.LogInformation;
import org.meruvian.yama.core.role.Role;
import org.meruvian.yama.core.role.RoleRepository;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
 * Copyright 2014 Meruvian
 *
 * 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 org.meruvian.yama.webapi.service;



/**
 * @author Dian Aditya
 *
 */
@Service
@Transactional(readOnly = true)
public class RestRoleService implements RoleService {
	@Inject
// Path: core/src/main/java/org/meruvian/yama/core/role/Role.java
// @Entity
// @Table(name = "yama_workflow_role")
// public class Role extends DefaultPersistence {
// 	private String name;
// 	private String description;
// 	private List<UserRole> users = new ArrayList<UserRole>();
// 	
// 	@NotNull
// 	@Column(nullable = false, unique = true)
// 	public String getName() {
// 		return name;
// 	}
// 
// 	public void setName(String name) {
// 		this.name = name;
// 	}
// 
// 	public String getDescription() {
// 		return description;
// 	}
// 
// 	public void setDescription(String description) {
// 		this.description = description;
// 	}
// 
// 	@JsonIgnore
// 	@OneToMany(mappedBy = "role", cascade = { CascadeType.REMOVE }, fetch = FetchType.LAZY)
// 	public List<UserRole> getUsers() {
// 		return users;
// 	}
// 
// 	public void setUsers(List<UserRole> users) {
// 		this.users = users;
// 	}
// }
// 
// Path: core/src/main/java/org/meruvian/yama/core/role/RoleRepository.java
// @Repository
// public interface RoleRepository extends DefaultRepository<Role> {
// 	Role findByName(String name);
// 	
// 	@Query("SELECT r FROM Role r WHERE (r.name LIKE ?1% OR r.description LIKE ?2%) AND r.logInformation.activeFlag = ?3")
// 	Page<Role> findByNameOrDescription(String name, String description, int activeFlag, Pageable pageable);
// }


// Path: webapi/src/main/java/org/meruvian/yama/webapi/service/RestRoleService.java
import javax.inject.Inject;
import javax.ws.rs.BadRequestException;
import org.apache.commons.lang3.StringUtils;
import org.meruvian.yama.core.LogInformation;
import org.meruvian.yama.core.role.Role;
import org.meruvian.yama.core.role.RoleRepository;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * Copyright 2014 Meruvian
 *
 * 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 org.meruvian.yama.webapi.service;



/**
 * @author Dian Aditya
 *
 */
@Service
@Transactional(readOnly = true)
public class RestRoleService implements RoleService {
	@Inject
	private RoleRepository roleRepository;