// Path: src/main/java/info/interactivesystems/gamificationengine/entities/Role.java
// @Entity
// @JsonIgnoreProperties({ "belongsTo" })
// public class Role implements Serializable {
// 
// 	private static final long serialVersionUID = 1L;
// 
// 	@Id
// 	@GeneratedValue(strategy = GenerationType.IDENTITY)
// 	private int id;
// 
// 	@NotNull
// 	@ManyToOne
// 	private Organisation belongsTo;
// 
// 	private String name;
// 
// 	// GETTER & SETTER
// 	/**
// 	 * Gets the id of a role.
// 	 * 
// 	 * @return int of the id
// 	 */
// 	public int getId() {
// 		return id;
// 	}
// 
// 	/**
// 	 * Sets the id of a role.
// 	 * 
// 	 * @param id
// 	 *            The id of the role.
// 	 */
// 	public void setId(int id) {
// 		this.id = id;
// 	}
// 
// 	/**
// 	 * Gets the name of a role.
// 	 * 
// 	 * @return the name of the role as String.
// 	 */
// 	public String getName() {
// 		return name;
// 	}
// 
// 	/**
// 	 * Sets the name of a role.
// 	 * 
// 	 * @param name
// 	 *            The name for a role.
// 	 */
// 	public void setName(String name) {
// 		this.name = name;
// 	}
// 
// 	/**
// 	 * Gets the organisation which the role belongs to and in which a player can
// 	 * have this role.
// 	 * 
// 	 * @return an organisation object.
// 	 */
// 	public Organisation getBelongsTo() {
// 		return belongsTo;
// 	}
// 
// 	/**
// 	 * Sets the organisation which the role belongs to and in which a player can
// 	 * have this role.
// 	 * 
// 	 * @param belongsTo
// 	 *            The organisation object which is associated with the role.
// 	 */
// 	public void setBelongsTo(Organisation belongsTo) {
// 		this.belongsTo = belongsTo;
// 	}
// 
// 	/**
// 	 * This method checks if the API key of a role is equal to the organisation's one, which 
// 	 * means the role belongs to this organisation. If the role's API key is equal to the organiton's one
// 	 * it returns true otherwise false.
// 	 * 
// 	 * @param organisation
// 	 *            The Organisation with thate the API key of the role should be compared. This Organisation 
// 	 *            object may not be null.
// 	 * @return boolean
// 	 * 			  If both API keys are equal the mehtod return true otherwise false.
// 	 */
// 	public boolean belongsTo(Organisation organisation) {
// 		return getBelongsTo().getApiKey().equals(organisation.getApiKey());
// 	}
// 
// }


import info.interactivesystems.gamificationengine.entities.Role;
import java.util.List;
import javax.ejb.Stateless;
import javax.inject.Named;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
package info.interactivesystems.gamificationengine.dao;




@Named
@Stateless
public class RoleDAO {

	@PersistenceContext(unitName = PersistenceUnit.PROJECT)
	private EntityManager em;

	/**
	 * Stores a new role in the data base.
	 * 
	 * @param role
	 * 			The role which should be stored in the data base.
	 * @return The generated id of the role. 
	 */
// Path: src/main/java/info/interactivesystems/gamificationengine/entities/Role.java
// @Entity
// @JsonIgnoreProperties({ "belongsTo" })
// public class Role implements Serializable {
// 
// 	private static final long serialVersionUID = 1L;
// 
// 	@Id
// 	@GeneratedValue(strategy = GenerationType.IDENTITY)
// 	private int id;
// 
// 	@NotNull
// 	@ManyToOne
// 	private Organisation belongsTo;
// 
// 	private String name;
// 
// 	// GETTER & SETTER
// 	/**
// 	 * Gets the id of a role.
// 	 * 
// 	 * @return int of the id
// 	 */
// 	public int getId() {
// 		return id;
// 	}
// 
// 	/**
// 	 * Sets the id of a role.
// 	 * 
// 	 * @param id
// 	 *            The id of the role.
// 	 */
// 	public void setId(int id) {
// 		this.id = id;
// 	}
// 
// 	/**
// 	 * Gets the name of a role.
// 	 * 
// 	 * @return the name of the role as String.
// 	 */
// 	public String getName() {
// 		return name;
// 	}
// 
// 	/**
// 	 * Sets the name of a role.
// 	 * 
// 	 * @param name
// 	 *            The name for a role.
// 	 */
// 	public void setName(String name) {
// 		this.name = name;
// 	}
// 
// 	/**
// 	 * Gets the organisation which the role belongs to and in which a player can
// 	 * have this role.
// 	 * 
// 	 * @return an organisation object.
// 	 */
// 	public Organisation getBelongsTo() {
// 		return belongsTo;
// 	}
// 
// 	/**
// 	 * Sets the organisation which the role belongs to and in which a player can
// 	 * have this role.
// 	 * 
// 	 * @param belongsTo
// 	 *            The organisation object which is associated with the role.
// 	 */
// 	public void setBelongsTo(Organisation belongsTo) {
// 		this.belongsTo = belongsTo;
// 	}
// 
// 	/**
// 	 * This method checks if the API key of a role is equal to the organisation's one, which 
// 	 * means the role belongs to this organisation. If the role's API key is equal to the organiton's one
// 	 * it returns true otherwise false.
// 	 * 
// 	 * @param organisation
// 	 *            The Organisation with thate the API key of the role should be compared. This Organisation 
// 	 *            object may not be null.
// 	 * @return boolean
// 	 * 			  If both API keys are equal the mehtod return true otherwise false.
// 	 */
// 	public boolean belongsTo(Organisation organisation) {
// 		return getBelongsTo().getApiKey().equals(organisation.getApiKey());
// 	}
// 
// }


// Path: src/main/java/info/interactivesystems/gamificationengine/dao/RoleDAO.java
import info.interactivesystems.gamificationengine.entities.Role;
import java.util.List;
import javax.ejb.Stateless;
import javax.inject.Named;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

package info.interactivesystems.gamificationengine.dao;




@Named
@Stateless
public class RoleDAO {

	@PersistenceContext(unitName = PersistenceUnit.PROJECT)
	private EntityManager em;

	/**
	 * Stores a new role in the data base.
	 * 
	 * @param role
	 * 			The role which should be stored in the data base.
	 * @return The generated id of the role. 
	 */
	public int insert(Role role) {