Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
671
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.03 KB | None | 0 0
  1. public class Main {
  2.  
  3. private FairCenter fc;
  4.  
  5. public Main(FairCenter fc) {
  6. this.fc = fc;
  7. }
  8.  
  9.  
  10.  
  11. private static final String XML_FILE_NAME = "FairCenter.xml";
  12. private static final String BIN_FILE_NAME = "FairCenter.bin";
  13.  
  14. /**
  15. * @param args the command line arguments
  16. */
  17. public static void main(String[] args) {
  18.  
  19. try {
  20. FairCenter fc = new FairCenter();
  21.  
  22. cenasParaTirar(fc);
  23.  
  24. String fN = "C:\\Users\\david\\Desktop\\DataImport\\csv\\exposicao1_v0.1.csv";
  25. String fName2 = "C:\\Users\\david\\Desktop\\DataImport\\csv\\exposicao1_stands_v0.1.csv";
  26.  
  27.  
  28.  
  29.  
  30.  
  31. // fc.exportObjectToXMLFile(fc, XML_FILE_NAME);
  32.  
  33. // FairCenter nf = (FairCenter)fc.importContentFromXMLtoObject(XML_FILE_NAME);
  34.  
  35.  
  36.  
  37.  
  38. MainWindow mainWindow = new MainWindow(fc);
  39. // System.out.println(nf);
  40. // try {
  41. // // Se já existir o documento .bin esse ficheiro que é lido.
  42. // if (new File(BIN_FILE_NAME).exists()) {
  43. //
  44. //// fc = FairCenter.persistenceMecanismoOutput(BIN_FILE_NAME);
  45. //
  46. // }
  47. //
  48. // } catch (Exception e) {
  49. //
  50. // e.printStackTrace();
  51. //
  52. // } finally {
  53. // cenasParaTirar(fc);
  54. // System.out.println("ola");
  55. // new MainWindow(fc);
  56. //
  57. // }
  58. //
  59. } catch (NullPointerException ex) {
  60. Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
  61. }
  62. }
  63.  
  64. private static void cenasParaTirar(FairCenter fc) {
  65. try {
  66. User u = new User("name", "email@123.pt", "po", "Password1@.", "Lisbon", "English"); //organizer
  67. User u1 = new User("name1", "email2p@123.pt", "jo", "Password1.", "Brasilia", ""); // fae
  68. User u2 = new User("name2", "email22@123.pt", "joanes", "Password1.", "Brasilia", ""); // fae
  69. User u3 = new User("name3", "emaill2@123.pt", "tu", "Password1.");
  70. User u4 = new User("name4", "emailll2@123.pt", "te", "Password1.");
  71. User u5 = new User("name5", "emalil2@123.pt", "tp", "Password1.");
  72.  
  73. User u7 = new User("em", "lll@123.pt", "em", "Password1.");
  74.  
  75. FAE fae1 = new FAE(u);
  76. FAE fae = new FAE(u1);
  77. FAE fae2 = new FAE(u2);
  78.  
  79. fc.getUsersRegistry().registerUser(u);
  80. fc.getUsersRegistry().registerUser(u1);
  81. fc.getUsersRegistry().registerUser(u2);
  82. fc.getUsersRegistry().registerUser(u3);
  83. fc.getUsersRegistry().registerUser(u4);
  84. fc.getUsersRegistry().registerUser(u5);
  85.  
  86. fc.getUsersRegistry().registerUser(u7);
  87.  
  88. fc.confirmUserRegistry(u);
  89. fc.confirmUserRegistry(u1);
  90. fc.confirmUserRegistry(u2);
  91. fc.confirmUserRegistry(u7);
  92. EventManager eM = new EventManager(u7);
  93.  
  94. fc.getEventManagerRegistry().addGestor(eM);
  95. Organizer o = new Organizer(u);
  96.  
  97. Organizer o2 = new Organizer(u2);
  98.  
  99. Date d1 = Date.dataAtual(); // 2017/06/22
  100. Date d2 = new Date(2018, 7, 22);
  101. Date d3 = new Date(2018, 8, 22);
  102.  
  103. Congress e = new Congress(o, o2, "Google Apps", "googleDesc", d1, d3, "Porto", d2);
  104. Congress e1 = new Congress(o2, o, "Critical Software Apps", "Cdesc", d1, d3, "Porto", d2);
  105. Congress e2 = new Congress(o, o2, "Mindera Apps", "Mdesc", d1, d3, "Porto", d2);
  106. Exhibition e3 = new Exhibition(o, o2, "Apple Apps", "greenDesc", d1, d3, "Porto", d2);
  107.  
  108. Stand s = new Stand(10);
  109. Stand s1 = new Stand(11);
  110. Stand s2 = new Stand(12);
  111. Stand s3 = new Stand(13);
  112. Stand s4 = new Stand(14);
  113. Stand s5 = new Stand(15);
  114. Stand s6 = new Stand(16);
  115. Stand s7 = new Stand(17);
  116. Stand s8 = new Stand(18);
  117. Stand s9 = new Stand(19);
  118.  
  119. StandsList event3SandList = e3.getlStands();
  120.  
  121. event3SandList.addStand(s);
  122. event3SandList.addStand(s1);
  123. event3SandList.addStand(s2);
  124. event3SandList.addStand(s3);
  125. event3SandList.addStand(s4);
  126. event3SandList.addStand(s5);
  127. event3SandList.addStand(s6);
  128. event3SandList.addStand(s7);
  129. event3SandList.addStand(s8);
  130. event3SandList.addStand(s9);
  131.  
  132. e3.getlFAE().registFAE(fae);
  133. e3.getlFAE().registFAE(fae2);
  134.  
  135. List<Keyword> lista = new ArrayList<>();
  136. lista.add(new Keyword("Bonecos"));
  137. lista.add(new Keyword("Animais"));
  138. lista.add(new Keyword("Minderas"));
  139. lista.add(new Keyword("Kimeras"));
  140. lista.add(new Keyword("Carverna"));
  141. lista.add(new Keyword("XXX"));
  142. lista.add(new Keyword("Super"));
  143. lista.add(new Keyword("maga"));
  144.  
  145. List<Keyword> lista1 = new ArrayList<>();
  146. lista1.add(new Keyword("paulo1"));
  147. lista1.add(new Keyword("paulo2"));
  148. lista1.add(new Keyword("jorge1"));
  149. lista1.add(new Keyword("jorge"));
  150. lista1.add(new Keyword("jorge4"));
  151. lista1.add(new Keyword("maga1"));
  152. lista1.add(new Keyword("maga2"));
  153. lista1.add(new Keyword("maga3"));
  154.  
  155. Application app = new Application("Google", "ghdfsaasf@live.com.pt", 911797032, 2, 32, lista1, "Representative", "Description", new ArrayList<Product>());
  156. Application app1 = new Application("Liga Portuguesa", "ghdasf@live.com.pt", 911797032, 2, 7032, lista, o.getUser().getUsername(), "Description", new ArrayList<Product>());
  157. Application app2 = new Application("app2", "app2@live.com.pt", 911797032, 2, 32, lista1, "Representative", "Description", new ArrayList<Product>());
  158.  
  159. Ratings ratings1 = new Ratings(3, 3, 3, 3);
  160. Ratings ratings2 = new Ratings(3, 3, 3, 3);
  161. Ratings ratings3 = new Ratings(5, 5, 5, 5);
  162.  
  163. Decision dec1 = new Decision(app, fae, true, "justificativeText", ratings1);
  164. Decision dec2 = new Decision(app1, fae1, true, "justificativeText", ratings2);
  165. Decision dec3 = new Decision(app2, fae1, false, "justificativeText", ratings3);
  166.  
  167. e.getlFAE().getFaeList().add(fae);
  168. e.getlFAE().getFaeList().add(fae1);
  169. e.getlFAE().getFaeList().add(fae2);
  170.  
  171. e1.getlFAE().getFaeList().add(fae);
  172. e1.getlFAE().getFaeList().add(fae1);
  173. e1.getlFAE().getFaeList().add(fae2);
  174.  
  175. Atribution a = new Atribution(fae, app);
  176. Atribution a1 = new Atribution(fae, app1);
  177. Atribution a2 = new Atribution(fae1, app1);
  178. Atribution a3 = new Atribution(fae2, app);
  179. Atribution a4 = new Atribution(fae1, app1);
  180. Atribution a5 = new Atribution(fae, app2);
  181.  
  182. e.getAtributionList().getlAtribution().add(a);
  183. e.getAtributionList().getlAtribution().add(a1);
  184. e.getAtributionList().getlAtribution().add(a2);
  185. e.getAtributionList().getlAtribution().add(a3);
  186. e.getAtributionList().getlAtribution().add(a4);
  187. e.getAtributionList().getlAtribution().add(a5);
  188.  
  189. e1.getAtributionList().getlAtribution().add(a);
  190. e1.getAtributionList().getlAtribution().add(a1);
  191. e1.getAtributionList().getlAtribution().add(a2);
  192. e1.getAtributionList().getlAtribution().add(a3);
  193. e1.getAtributionList().getlAtribution().add(a4);
  194. e1.getAtributionList().getlAtribution().add(a5);
  195.  
  196. app.setDecision(dec1);
  197. app1.setDecision(dec2);
  198. app2.setDecision(dec3);
  199.  
  200. app.registerDecision();
  201. app1.registerDecision();
  202. app2.registerDecision();
  203.  
  204. e.getApplicationsList().addApplication(app);
  205. e.getApplicationsList().addApplication(app1);
  206. e.getApplicationsList().addApplication(app2);
  207. e1.getApplicationsList().addApplication(app);
  208. e1.getApplicationsList().addApplication(app1);
  209. e1.getApplicationsList().addApplication(app2);
  210.  
  211. fc.getEventRegistry().getEventList().add(e);
  212. fc.getEventRegistry().getEventList().add(e1);
  213. fc.getEventRegistry().getEventList().add(e2);
  214. fc.getEventRegistry().getEventList().add(e3);
  215.  
  216. // new UC32_ImportEventDataFromFileController(fc, u7);
  217. // FairCenter fairCenter = (FairCenter) fc.importContentFromXMLtoObject(XML_FILE_NAME);
  218. // List<User> ul = fairCenter.getUsersRegistry().getlNonResistedUsers();
  219. // try {
  220. // Exhibition importedEx = Exhibition.importContentFromCSVtoObject("exposicao1_v0.1.csv");
  221. // System.out.println(importedEx);
  222. // }catch (Exception ex) {
  223. // Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
  224. // }
  225. //
  226. // new MainWindow(fc);
  227. // fc.exportObjectToXMLFile(fc, XML_FILE_NAME);
  228. // try {
  229. // // Se já existir o documento .xml esse ficheiro que é lido.
  230. // if (new File(XML_FILE_NAME).exists()) {
  231. //
  232. // fc = (FairCenter) fc.importContentFromXMLtoObject();
  233. //
  234. // }
  235. //
  236. // } catch (Exception e) {
  237. //
  238. // e.printStackTrace();
  239. //
  240. // } finally {
  241. // System.out.println("ola");
  242. // new MainWindow(fc);
  243. //
  244. // }
  245. //
  246. } catch (Exception ex) {
  247. Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
  248. }
  249. }
  250.  
  251. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement