Rev 1692 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1692 | Rev 1863 | ||
---|---|---|---|
1 | package pt.estgp.estgweb.services.courses; |
1 | package pt.estgp.estgweb.services.courses; |
2 | 2 | ||
3 | /** |
3 | /** |
4 | * Created by jorgemachado on 15/09/16. |
4 | * Created by jorgemachado on 15/09/16. |
5 | * |
5 | * |
6 | * to be called from ANT tasks |
6 | * to be called from ANT tasks |
7 | * |
7 | * |
8 | * |
8 | * |
9 | * UPDATE DO MYSQL PARA OS DEPARTAMENTOS |
9 | * UPDATE DO MYSQL PARA OS DEPARTAMENTOS |
10 | * |
10 | * |
11 | * 1 - FAZER O UPDATE HIBERNATE SQL - Ira criar a tabela de departamentos |
11 | * 1 - FAZER O UPDATE HIBERNATE SQL - Ira criar a tabela de departamentos |
12 | * As chaves estrangeiras não poderão ser criadas porque existem falhas de linkagem |
12 | * As chaves estrangeiras não poderão ser criadas porque existem falhas de linkagem |
13 | * 2 - Correr esta tarefa - Irá criar os departamentos ant -f inportRoutines.xml updateCourseDepartments |
13 | * 2 - Correr esta tarefa - Irá criar os departamentos ant -f inportRoutines.xml updateCourseDepartments |
14 | * 3 - Correr novamente o update hibernate sql e a chave será atualizada |
14 | * 3 - Correr novamente o update hibernate sql e a chave será atualizada |
15 | */ |
15 | */ |
16 | public class UpdateDepartmentsTask |
16 | public class UpdateDepartmentsTask |
17 | { |
17 | { |
18 | 18 | ||
19 | 19 | ||
20 | /** |
20 | /** |
21 | * Check default departments if they already exist in database |
21 | * Check default departments if they already exist in database |
22 | * ESECS |
22 | * ESECS |
23 | * a) Comunicação, Artes e Tecnologias; CAT |
23 | * a) Comunicação, Artes e Tecnologias; CAT |
24 | * b) Educação e Formação; EF |
24 | * b) Educação e Formação; EF |
25 | * c) Intervenção e Desenvolvimento Social. IDS |
25 | * c) Intervenção e Desenvolvimento Social. IDS |
26 | * |
26 | * |
27 | * ESTG |
27 | * ESTG |
28 | * a) Tecnologias e Design TD |
28 | * a) Tecnologias e Design TD |
29 | * b) Ciências Empresariais, Sociais e Humanas”. CESH |
29 | * b) Ciências Empresariais, Sociais e Humanas”. CESH |
30 | * |
30 | * |
31 | * ESAE |
31 | * ESAE |
32 | * a) Agricultura e Recursos Naturais ARN |
32 | * a) Agricultura e Recursos Naturais ARN |
33 | * b) Ciência e Tecnologia Animal CTA |
33 | * b) Ciência e Tecnologia Animal CTA |
34 | * |
34 | * |
35 | * ESSP |
35 | * ESSP |
36 | * |
36 | * |
37 | * a) Ciências e Tecnologias da Saúde |
37 | * a) Ciências e Tecnologias da Saúde |
38 | * |
38 | * |
39 | * Properties |
39 | * Properties |
40 | * institution.code.prefix.inverse.ESTG=1 |
40 | * institution.code.prefix.inverse.ESTG=1 |
41 | institution.code.prefix.inverse.ESAE=2 |
41 | institution.code.prefix.inverse.ESAE=2 |
42 | institution.code.prefix.inverse.ESECS=3 |
42 | institution.code.prefix.inverse.ESECS=3 |
43 | institution.code.prefix.inverse.ESS=4 |
43 | institution.code.prefix.inverse.ESS=4 |
44 | 44 | ||
45 | */ |
45 | */ |
46 | /* |
46 | /* |
47 | public void updateDepartmentsDefault() |
47 | public void updateDepartmentsDefault() |
48 | { |
48 | { |
49 | 49 | ||
50 | CourseDepartmentDaoImpl dao = DaoFactory.getCourseDepartmentDaoImpl(); |
50 | CourseDepartmentDaoImpl dao = DaoFactory.getCourseDepartmentDaoImpl(); |
51 | 51 | ||
52 | 52 | ||
53 | String sigla = "cat"; |
53 | String sigla = "cat"; |
54 | String nome = "Comunicação, Artes e Tecnologias"; |
54 | String nome = "Comunicação, Artes e Tecnologias"; |
55 | String nomeEn = "Comunication Arts and Technology"; |
55 | String nomeEn = "Comunication Arts and Technology"; |
56 | String nomeEs = "Comunicación, Artes y Tecnologías"; |
56 | String nomeEs = "Comunicación, Artes y Tecnologías"; |
57 | String nomeFr = "Communication, Arts et Technologies"; |
57 | String nomeFr = "Communication, Arts et Technologies"; |
58 | String institutionalCode = ConfigProperties.getProperty("institution.code.prefix.inverse.ESECS"); |
58 | String institutionalCode = ConfigProperties.getProperty("institution.code.prefix.inverse.ESECS"); |
59 | 59 | ||
60 | createDepartment(dao, sigla, nome, nomeEn, nomeEs, nomeFr, institutionalCode); |
60 | createDepartment(dao, sigla, nome, nomeEn, nomeEs, nomeFr, institutionalCode); |
61 | 61 | ||
62 | sigla = "ef"; |
62 | sigla = "ef"; |
63 | nome = "Educação e Formação"; |
63 | nome = "Educação e Formação"; |
64 | nomeEn = "Education and training"; |
64 | nomeEn = "Education and training"; |
65 | nomeEs = "Educación y formación"; |
65 | nomeEs = "Educación y formación"; |
66 | nomeFr = "Éducation et formation"; |
66 | nomeFr = "Éducation et formation"; |
67 | institutionalCode = ConfigProperties.getProperty("institution.code.prefix.inverse.ESECS"); |
67 | institutionalCode = ConfigProperties.getProperty("institution.code.prefix.inverse.ESECS"); |
68 | 68 | ||
69 | createDepartment(dao, sigla, nome, nomeEn, nomeEs, nomeFr, institutionalCode); |
69 | createDepartment(dao, sigla, nome, nomeEn, nomeEs, nomeFr, institutionalCode); |
70 | 70 | ||
71 | sigla = "ids"; |
71 | sigla = "ids"; |
72 | nome = "Intervenção e Desenvolvimento Social"; |
72 | nome = "Intervenção e Desenvolvimento Social"; |
73 | nomeEn = "Intervention and Social Development"; |
73 | nomeEn = "Intervention and Social Development"; |
74 | nomeEs = "Intervención y Desarrollo Social"; |
74 | nomeEs = "Intervención y Desarrollo Social"; |
75 | nomeFr = "Intervention et du Développement social"; |
75 | nomeFr = "Intervention et du Développement social"; |
76 | institutionalCode = ConfigProperties.getProperty("institution.code.prefix.inverse.ESECS"); |
76 | institutionalCode = ConfigProperties.getProperty("institution.code.prefix.inverse.ESECS"); |
77 | 77 | ||
78 | createDepartment(dao, sigla, nome, nomeEn, nomeEs, nomeFr, institutionalCode); |
78 | createDepartment(dao, sigla, nome, nomeEn, nomeEs, nomeFr, institutionalCode); |
79 | 79 | ||
80 | 80 | ||
81 | 81 | ||
82 | sigla = "td"; |
82 | sigla = "td"; |
83 | nome = "Tecnologias e Design"; |
83 | nome = "Tecnologias e Design"; |
84 | nomeEn = "Technology and Design"; |
84 | nomeEn = "Technology and Design"; |
85 | nomeEs = "Tecnología y Diseño"; |
85 | nomeEs = "Tecnología y Diseño"; |
86 | nomeFr = "Technologie et Design"; |
86 | nomeFr = "Technologie et Design"; |
87 | institutionalCode = ConfigProperties.getProperty("institution.code.prefix.inverse.ESTG"); |
87 | institutionalCode = ConfigProperties.getProperty("institution.code.prefix.inverse.ESTG"); |
88 | 88 | ||
89 | createDepartment(dao, sigla, nome, nomeEn, nomeEs, nomeFr, institutionalCode); |
89 | createDepartment(dao, sigla, nome, nomeEn, nomeEs, nomeFr, institutionalCode); |
90 | 90 | ||
91 | sigla = "cesh"; |
91 | sigla = "cesh"; |
92 | nome = "Ciências Empresariais, Sociais e Humanas"; |
92 | nome = "Ciências Empresariais, Sociais e Humanas"; |
93 | nomeEn = "Business Sciences, Social and Human"; |
93 | nomeEn = "Business Sciences, Social and Human"; |
94 | nomeEs = "Ciencias empresariales, Social y Humano"; |
94 | nomeEs = "Ciencias empresariales, Social y Humano"; |
95 | nomeFr = "Entreprise Sciences, Sciences sociales et humaines"; |
95 | nomeFr = "Entreprise Sciences, Sciences sociales et humaines"; |
96 | institutionalCode = ConfigProperties.getProperty("institution.code.prefix.inverse.ESTG"); |
96 | institutionalCode = ConfigProperties.getProperty("institution.code.prefix.inverse.ESTG"); |
97 | 97 | ||
98 | createDepartment(dao, sigla, nome, nomeEn, nomeEs, nomeFr, institutionalCode); |
98 | createDepartment(dao, sigla, nome, nomeEn, nomeEs, nomeFr, institutionalCode); |
99 | 99 | ||
100 | 100 | ||
101 | 101 | ||
102 | sigla = "arn"; |
102 | sigla = "arn"; |
103 | nome = "Agricultura e Recursos Naturais"; |
103 | nome = "Agricultura e Recursos Naturais"; |
104 | nomeEn = "Agriculture and Natural Resources"; |
104 | nomeEn = "Agriculture and Natural Resources"; |
105 | nomeEs = "Agricultura y Recursos Naturales"; |
105 | nomeEs = "Agricultura y Recursos Naturales"; |
106 | nomeFr = "Agriculture et ressources naturelles"; |
106 | nomeFr = "Agriculture et ressources naturelles"; |
107 | institutionalCode = ConfigProperties.getProperty("institution.code.prefix.inverse.ESAE"); |
107 | institutionalCode = ConfigProperties.getProperty("institution.code.prefix.inverse.ESAE"); |
108 | 108 | ||
109 | createDepartment(dao, sigla, nome, nomeEn, nomeEs, nomeFr, institutionalCode); |
109 | createDepartment(dao, sigla, nome, nomeEn, nomeEs, nomeFr, institutionalCode); |
110 | 110 | ||
111 | sigla = "cta"; |
111 | sigla = "cta"; |
112 | nome = "Ciência e Tecnologia Animal"; |
112 | nome = "Ciência e Tecnologia Animal"; |
113 | nomeEn = "Animal Science and Technology"; |
113 | nomeEn = "Animal Science and Technology"; |
114 | nomeEs = "Ciencia y Tecnología Animal"; |
114 | nomeEs = "Ciencia y Tecnología Animal"; |
115 | nomeFr = "Animal Science et technologie"; |
115 | nomeFr = "Animal Science et technologie"; |
116 | institutionalCode = ConfigProperties.getProperty("institution.code.prefix.inverse.ESAE"); |
116 | institutionalCode = ConfigProperties.getProperty("institution.code.prefix.inverse.ESAE"); |
117 | 117 | ||
118 | createDepartment(dao, sigla, nome, nomeEn, nomeEs, nomeFr, institutionalCode); |
118 | createDepartment(dao, sigla, nome, nomeEn, nomeEs, nomeFr, institutionalCode); |
119 | 119 | ||
120 | 120 | ||
121 | 121 | ||
122 | sigla = "cts"; |
122 | sigla = "cts"; |
123 | nome = "Ciências e Tecnologias da Saúde"; |
123 | nome = "Ciências e Tecnologias da Saúde"; |
124 | nomeEn = "Science and Health Technologies"; |
124 | nomeEn = "Science and Health Technologies"; |
125 | nomeEs = "Ciencia y Salud Tecnologías"; |
125 | nomeEs = "Ciencia y Salud Tecnologías"; |
126 | nomeFr = "Sciences et technologies de la santé"; |
126 | nomeFr = "Sciences et technologies de la santé"; |
127 | institutionalCode = ConfigProperties.getProperty("institution.code.prefix.inverse.ESS"); |
127 | institutionalCode = ConfigProperties.getProperty("institution.code.prefix.inverse.ESS"); |
128 | 128 | ||
129 | createDepartment(dao, sigla, nome, nomeEn, nomeEs, nomeFr, institutionalCode); |
129 | createDepartment(dao, sigla, nome, nomeEn, nomeEs, nomeFr, institutionalCode); |
130 | }*/ |
130 | }*/ |
131 | 131 | ||
132 | /* |
132 | /* |
133 | private void createDepartment(CourseDepartmentDaoImpl dao, String sigla, String nome, String nomeEn, String nomeEs, String nomeFr, String institutionalCode) { |
133 | private void createDepartment(CourseDepartmentDaoImpl dao, String sigla, String nome, String nomeEn, String nomeEs, String nomeFr, String institutionalCode) { |
134 | CourseDepartment courseDepartment = dao.findBySigla(sigla); |
134 | CourseDepartment courseDepartment = dao.findBySigla(sigla); |
135 | if(courseDepartment == null) |
135 | if(courseDepartment == null) |
136 | { |
136 | { |
137 | courseDepartment = DomainObjectFactory.createCourseDepartmentImpl(); |
137 | courseDepartment = DomainObjectFactory.createCourseDepartmentImpl(); |
138 | courseDepartment.setSigla(sigla); |
138 | courseDepartment.setSigla(sigla); |
139 | courseDepartment.setInstitutionalCode(institutionalCode); |
139 | courseDepartment.setInstitutionalCode(institutionalCode); |
140 | courseDepartment.setName(nome); |
140 | courseDepartment.setName(nome); |
141 | courseDepartment.setNameEn(nomeEn); |
141 | courseDepartment.setNameEn(nomeEn); |
142 | courseDepartment.setNameEs(nomeEs); |
142 | courseDepartment.setNameEs(nomeEs); |
143 | courseDepartment.setNameFr(nomeFr); |
143 | courseDepartment.setNameFr(nomeFr); |
144 | courseDepartment.setActive(true); |
144 | courseDepartment.setActive(true); |
145 | dao.save(courseDepartment); |
145 | dao.save(courseDepartment); |
146 | } |
146 | } |
147 | } |
147 | } |
148 | */ |
148 | */ |
149 | } |
149 | } |
150 | 150 |