// Path: src/main/java/org/cejug/hurraa/model/Equipment.java
// @Entity
// public class Equipment {
// 	
// 	@Id
// 	@GeneratedValue(strategy = GenerationType.IDENTITY)
// 	private Long id;
// 	
// 	@NotBlank
// 	@Column(name="serial_id")
// 	private String serialId;
// 	
// 	@NotNull
// 	@Column(name="end_of_warranty")
// 	private Date endOfWarranty;
// 
// 	@Column(name="last_maintenance")
// 	private Date lastMaintenance;
// 	
// 	@Column(name="maintenance_description")
// 	private String maintenanceDescription;
// 	
// 	@ManyToOne(optional=false)
// 	private EquipmentModel equipmentModel;
// 
// 	public Long getId() {
// 		return id;
// 	}
// 
// 	public void setId(Long id) {
// 		this.id = id;
// 	}
// 
// 	public String getSerialId() {
// 		return serialId;
// 	}
// 
// 	public void setSerialId(String serialId) {
// 		this.serialId = serialId;
// 	}
// 
// 	public Date getEndOfWarranty() {
// 		return endOfWarranty;
// 	}
// 
// 	public void setEndOfWarranty(Date endOfWarranty) {
// 		this.endOfWarranty = endOfWarranty;
// 	}
// 
// 	public Date getLastMaintenance() {
// 		return lastMaintenance;
// 	}
// 
// 	public void setLastMaintenance(Date lastMaintenance) {
// 		this.lastMaintenance = lastMaintenance;
// 	}
// 
// 	public String getMaintenanceDescription() {
// 		return maintenanceDescription;
// 	}
// 
// 	public void setMaintenanceDescription(String maintenanceDescription) {
// 		this.maintenanceDescription = maintenanceDescription;
// 	}
// 
// 	public EquipmentModel getEquipmentModel() {
// 		return equipmentModel;
// 	}
// 
// 	public void setEquipmentModel(EquipmentModel equipmentModel) {
// 		this.equipmentModel = equipmentModel;
// 	}
// 
// 	
// }
// 
// Path: src/main/java/org/cejug/hurraa/model/bean/EquipmentBean.java
// @Stateless
// public class EquipmentBean extends AbstractBean<Equipment>{
//     
// 	@PersistenceContext
//     private EntityManager entityManager;
//     
//     public EquipmentBean() {
//         super(Equipment.class);
//     }
//     
//     @Override
//     protected EntityManager getEntityManager() {
//         return entityManager;
//     }
//     
// }
// 
// Path: src/main/java/org/cejug/hurraa/model/bean/EquipmentModelBean.java
// @Stateless
// public class EquipmentModelBean extends AbstractBean<EquipmentModel> {
//     
//     @PersistenceContext
//     private EntityManager entityManager;
//     
//     public EquipmentModelBean() {
//         super(EquipmentModel.class);
//     }
// 
//     @Override
//     protected EntityManager getEntityManager() {
//         return entityManager;
//     }
//     
//     @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
//     public boolean isNameAvailable(String name){
//         TypedQuery<EquipmentModel> query = getEntityManager()
//                     .createNamedQuery( "FIND_BY_NAME", EquipmentModel.class );
//         query.setParameter("name", name);
//         return query.getResultList().isEmpty();
//     }
//     
//     @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
//     public boolean isEquipmentTypeInUse(EquipmentType equipmentType){
//         Query query = getEntityManager().createNamedQuery("EQUIPMENTTYPE_IN_USE" , EquipmentModel.class );
//         query.setParameter("equipmentType", equipmentType );
//         return query.getResultList().isEmpty();
//     }
// 
// }


import br.com.caelum.vraptor.Controller;
import br.com.caelum.vraptor.Get;
import br.com.caelum.vraptor.Path;
import br.com.caelum.vraptor.Post;
import br.com.caelum.vraptor.Result;
import br.com.caelum.vraptor.validator.SimpleMessage;
import br.com.caelum.vraptor.validator.Validator;
import java.text.DateFormat;
import java.util.ResourceBundle;
import javax.inject.Inject;
import javax.validation.Valid;
import org.cejug.hurraa.model.Equipment;
import org.cejug.hurraa.model.bean.EquipmentBean;
import org.cejug.hurraa.model.bean.EquipmentModelBean;
import org.cejug.hurraa.producer.ValidationMessages;
import org.cejug.hurraa.validation.Unique;
/*
* Hurraa is a web application conceived to manage resources
* in companies that need manage IT resources. Create issues
* and purchase IT materials. Copyright (C) 2014 CEJUG.
*
* Hurraa is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Hurraa is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Hurraa. If not, see http://www.gnu.org/licenses/gpl-3.0.html.
*
*/
package org.cejug.hurraa.controller;





@Path("equipment")
@Controller
public class EquipmentController {
	
	
	private Result result;
// Path: src/main/java/org/cejug/hurraa/model/Equipment.java
// @Entity
// public class Equipment {
// 	
// 	@Id
// 	@GeneratedValue(strategy = GenerationType.IDENTITY)
// 	private Long id;
// 	
// 	@NotBlank
// 	@Column(name="serial_id")
// 	private String serialId;
// 	
// 	@NotNull
// 	@Column(name="end_of_warranty")
// 	private Date endOfWarranty;
// 
// 	@Column(name="last_maintenance")
// 	private Date lastMaintenance;
// 	
// 	@Column(name="maintenance_description")
// 	private String maintenanceDescription;
// 	
// 	@ManyToOne(optional=false)
// 	private EquipmentModel equipmentModel;
// 
// 	public Long getId() {
// 		return id;
// 	}
// 
// 	public void setId(Long id) {
// 		this.id = id;
// 	}
// 
// 	public String getSerialId() {
// 		return serialId;
// 	}
// 
// 	public void setSerialId(String serialId) {
// 		this.serialId = serialId;
// 	}
// 
// 	public Date getEndOfWarranty() {
// 		return endOfWarranty;
// 	}
// 
// 	public void setEndOfWarranty(Date endOfWarranty) {
// 		this.endOfWarranty = endOfWarranty;
// 	}
// 
// 	public Date getLastMaintenance() {
// 		return lastMaintenance;
// 	}
// 
// 	public void setLastMaintenance(Date lastMaintenance) {
// 		this.lastMaintenance = lastMaintenance;
// 	}
// 
// 	public String getMaintenanceDescription() {
// 		return maintenanceDescription;
// 	}
// 
// 	public void setMaintenanceDescription(String maintenanceDescription) {
// 		this.maintenanceDescription = maintenanceDescription;
// 	}
// 
// 	public EquipmentModel getEquipmentModel() {
// 		return equipmentModel;
// 	}
// 
// 	public void setEquipmentModel(EquipmentModel equipmentModel) {
// 		this.equipmentModel = equipmentModel;
// 	}
// 
// 	
// }
// 
// Path: src/main/java/org/cejug/hurraa/model/bean/EquipmentBean.java
// @Stateless
// public class EquipmentBean extends AbstractBean<Equipment>{
//     
// 	@PersistenceContext
//     private EntityManager entityManager;
//     
//     public EquipmentBean() {
//         super(Equipment.class);
//     }
//     
//     @Override
//     protected EntityManager getEntityManager() {
//         return entityManager;
//     }
//     
// }
// 
// Path: src/main/java/org/cejug/hurraa/model/bean/EquipmentModelBean.java
// @Stateless
// public class EquipmentModelBean extends AbstractBean<EquipmentModel> {
//     
//     @PersistenceContext
//     private EntityManager entityManager;
//     
//     public EquipmentModelBean() {
//         super(EquipmentModel.class);
//     }
// 
//     @Override
//     protected EntityManager getEntityManager() {
//         return entityManager;
//     }
//     
//     @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
//     public boolean isNameAvailable(String name){
//         TypedQuery<EquipmentModel> query = getEntityManager()
//                     .createNamedQuery( "FIND_BY_NAME", EquipmentModel.class );
//         query.setParameter("name", name);
//         return query.getResultList().isEmpty();
//     }
//     
//     @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
//     public boolean isEquipmentTypeInUse(EquipmentType equipmentType){
//         Query query = getEntityManager().createNamedQuery("EQUIPMENTTYPE_IN_USE" , EquipmentModel.class );
//         query.setParameter("equipmentType", equipmentType );
//         return query.getResultList().isEmpty();
//     }
// 
// }


// Path: src/main/java/org/cejug/hurraa/controller/EquipmentController.java
import br.com.caelum.vraptor.Controller;
import br.com.caelum.vraptor.Get;
import br.com.caelum.vraptor.Path;
import br.com.caelum.vraptor.Post;
import br.com.caelum.vraptor.Result;
import br.com.caelum.vraptor.validator.SimpleMessage;
import br.com.caelum.vraptor.validator.Validator;
import java.text.DateFormat;
import java.util.ResourceBundle;
import javax.inject.Inject;
import javax.validation.Valid;
import org.cejug.hurraa.model.Equipment;
import org.cejug.hurraa.model.bean.EquipmentBean;
import org.cejug.hurraa.model.bean.EquipmentModelBean;
import org.cejug.hurraa.producer.ValidationMessages;
import org.cejug.hurraa.validation.Unique;

/*
* Hurraa is a web application conceived to manage resources
* in companies that need manage IT resources. Create issues
* and purchase IT materials. Copyright (C) 2014 CEJUG.
*
* Hurraa is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Hurraa is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Hurraa. If not, see http://www.gnu.org/licenses/gpl-3.0.html.
*
*/
package org.cejug.hurraa.controller;





@Path("equipment")
@Controller
public class EquipmentController {
	
	
	private Result result;
	private EquipmentBean equipmentBean;