1 package com.edf.gde.ejb;
3 import com.edf.gde.dao.MetadataDao;
4 import com.edf.gde.transferables.AttributeGroupTO;
5 import com.edf.gde.transferables.AttributeTO;
6 import javax.ejb.Stateless;
7 import javax.ejb.LocalBean;
8 import javax.persistence.EntityManager;
9 import javax.persistence.PersistenceContext;
17 public class MetadataEJB {
19 @PersistenceContext(unitName = "GDE-ejbPU")
20 private EntityManager em;
23 public AttributeTO createAttribute(AttributeTO ato) {
24 MetadataDao dao = new MetadataDao(em);
25 return dao.createAttribute(ato);
28 public void deleteAttribute(AttributeTO ato) {
29 MetadataDao dao = new MetadataDao(em);
30 dao.deleteAttribute(ato);
33 public AttributeTO updateAttribute(AttributeTO ato) {
34 MetadataDao dao = new MetadataDao(em);
35 return dao.updateAttribute(ato);
38 public AttributeTO findAttribute(AttributeTO ato) {
39 MetadataDao dao = new MetadataDao(em);
40 return dao.findAttribute(ato);
43 public AttributeTO findById(long id) {
44 MetadataDao dao = new MetadataDao(em);
45 return dao.findById(id);
48 public AttributeTO findByName(String name) {
49 MetadataDao dao = new MetadataDao(em);
50 return dao.findByName(name);
53 public AttributeTO findByType(String type) {
54 MetadataDao dao = new MetadataDao(em);
55 return dao.findByType(type);
58 public AttributeTO findByValue(String value) {
59 MetadataDao dao = new MetadataDao(em);
60 return dao.findByValue(value);
63 /* Attributes Groups */
64 public AttributeGroupTO createAttributeGroup(AttributeGroupTO agto) {
65 MetadataDao dao = new MetadataDao(em);
66 return dao.createAttributeGroup(agto);
69 public void deleteAttributeGroup(AttributeGroupTO agto) {
70 MetadataDao dao = new MetadataDao(em);
71 dao.deleteAttributeGroup(agto);
74 public AttributeGroupTO updateAttributeGroup(AttributeGroupTO agto) {
75 MetadataDao dao = new MetadataDao(em);
76 return dao.updateAttributeGroup(agto);
79 public AttributeGroupTO findAttributeGroup(AttributeGroupTO agto) {
80 MetadataDao dao = new MetadataDao(em);
81 return dao.findAttributeGroup(agto);
84 public AttributeGroupTO findGroupById(long groupId) {
85 MetadataDao dao = new MetadataDao(em);
86 return dao.findGroupById(groupId);