daily pastebin goal
62%
SHARE
TWEET

Untitled

a guest Oct 17th, 2017 385 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package ejbs;
  2.  
  3. import javax.annotation.PostConstruct;
  4. import javax.ejb.EJB;
  5. import javax.ejb.EJBException;
  6. import javax.ejb.Singleton;
  7. import javax.ejb.Startup;
  8.  
  9. @Singleton
  10. @Startup
  11. public class ConfigBean {
  12.  
  13.     @EJB
  14.     private CourseBean courseBean;
  15.     @EJB
  16.     private SubjectBean subjectBean;
  17.     @EJB
  18.     private StudentBean studentBean;
  19.     @EJB
  20.     private AdministratorBean administratorBean;
  21.     @EJB
  22.     private TeacherBean teacherBean;
  23.  
  24.     @PostConstruct
  25.     public void populateBD() {
  26.  
  27.         try {
  28.  
  29.             courseBean.create(1, "EI");
  30.             courseBean.create(2, "IS");
  31.             courseBean.create(3, "JDM");
  32.             courseBean.create(4, "SIS");
  33.             courseBean.create(5, "MEI-CM");
  34.             courseBean.create(6, "MGSIM");
  35.  
  36.             studentBean.create("1111111", "Manuel", "Manuel", "dae.ei.ipleiria@gmail.com", 1);
  37.             studentBean.create("2222222", "Antonio", "António", "dae.ei.ipleiria@gmail.com", 1);
  38.             studentBean.create("3333333", "Ana", "Ana", "dae.ei.ipleiria@gmail.com", 2);
  39.             studentBean.create("4444444", "Jose", "José", "dae.ei.ipleiria@gmail.com", 2);
  40.             studentBean.create("5555555", "Maria", "Maria", "dae.ei.ipleiria@gmail.com", 3);
  41.             studentBean.create("6666666", "Joaquim", "Joaquim", "dae.ei.ipleiria@gmail.com", 3);
  42.             studentBean.create("7777777", "Alzira", "Alzira", "dae.ei.ipleiria@gmail.com", 4);
  43.             studentBean.create("8888888", "Pedro", "Pedro", "dae.ei.ipleiria@gmail.com", 4);
  44.  
  45.             subjectBean.create(1, "P1", 1, 1, "2015/2016");
  46.             subjectBean.create(2, "PA", 1, 2, "2015/2016");
  47.             subjectBean.create(3, "IA", 1, 2, "2015/2016");
  48.             subjectBean.create(4, "DAE", 1, 3, "2015/2016");
  49.  
  50.             subjectBean.create(5, "ComputProg", 2, 1, "2015/2016");
  51.             subjectBean.create(6, "ComplProg", 2, 1, "2015/2016");
  52.             subjectBean.create(7, "PA", 2, 2, "2015/2016");
  53.  
  54.             studentBean.enrollStudentInSubject("1111111", 1);
  55.             studentBean.enrollStudentInSubject("1111111", 2);
  56.             studentBean.enrollStudentInSubject("2222222", 3);
  57.             studentBean.enrollStudentInSubject("2222222", 4);
  58.  
  59.             studentBean.enrollStudentInSubject("3333333", 5);
  60.             studentBean.enrollStudentInSubject("3333333", 6);
  61.             studentBean.enrollStudentInSubject("4444444", 6);
  62.             studentBean.enrollStudentInSubject("4444444", 7);
  63.  
  64. //            teacherBean.create("t1", "t1", "t1", "t1@ipleiria.pt", "O1");
  65. //            teacherBean.create("t2", "t2", "t2", "t2@ipleiria.pt", "O2");
  66. //            teacherBean.create("t3", "t3", "t3", "t3@ipleiria.pt", "O3");
  67. //            
  68. //            administratorBean.create("a1", "a1", "a1", "a1@ipleiria.pt");
  69. //            administratorBean.create("a2", "a2", "a2", "a2@ipleiria.pt");
  70. //            administratorBean.create("a3", "a3", "a3", "a3@ipleiria.pt");
  71.            
  72. //            teacherBean.addSubjectTeacher(1, "t1");
  73. //            teacherBean.addSubjectTeacher(2, "t2");
  74. //            teacherBean.addSubjectTeacher(1, "t3");
  75.            
  76.         } catch (EJBException e) {
  77.             System.out.println("Erro: " + e.getMessage());
  78.         }
  79.     }
  80. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top