Subversion Repositories bacoAlunos

Rev

Rev 1857 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1857 Rev 1875
Line 53... Line 53...
53
 
53
 
54
        return null;
54
        return null;
55
    }
55
    }
56
 
56
 
57
 
57
 
-
 
58
    /**
-
 
59
     * Serviço Tear 1 para substituição de Roles ou criação de Novos
-
 
60
     * @param oldRole
-
 
61
     * @param nomeRole
-
 
62
     * @param newRoleStr
-
 
63
     * @param session
-
 
64
     * @return
-
 
65
     * @throws AccessDeniedException
-
 
66
     */
-
 
67
    public ReplaceRoleResult createNewNormalizedRoleService(1.5.0/docs/api/java/lang/String.html">String oldRole,1.5.0/docs/api/java/lang/String.html">String nomeRole,1.5.0/docs/api/java/lang/String.html">String newRoleStr,UserSession session) throws AccessDeniedException {
-
 
68
        ReplaceRoleResult result;
-
 
69
 
-
 
70
        UserRoleConfigImpl newUserRoleConfig = DomainObjectFactory.createUserRoleConfigImpl();
-
 
71
        newUserRoleConfig.setRole(newRoleStr);
-
 
72
        newUserRoleConfig.setValid(true);
-
 
73
        newUserRoleConfig.setValue(nomeRole);
-
 
74
        newUserRoleConfig.setValuePt(nomeRole);
-
 
75
        newUserRoleConfig.setValueEn("");
-
 
76
        newUserRoleConfig.setValueEs("");
-
 
77
        newUserRoleConfig.setValueFr("");
-
 
78
 
-
 
79
        try {
-
 
80
 
-
 
81
            if(oldRole == null || oldRole.trim().length() == 0)
-
 
82
            {
-
 
83
                result = new  UserRoleConfigService().addUpdateRole(newUserRoleConfig,session,false);
-
 
84
            }
-
 
85
            else
-
 
86
            {
-
 
87
 
-
 
88
                result = new  UserRoleConfigService().updateOldRoleWithView(oldRole, newUserRoleConfig, session,false);
-
 
89
            }
-
 
90
 
-
 
91
 
-
 
92
            if(result.roleKeyAlreadyExist)
-
 
93
            {
-
 
94
                logger.error("Tentado CRIAR um Role que já existe e não é Administrador nem Super user");
-
 
95
                throw new AccessDeniedException("Tentado CRIAR um Role que já existe e não é Administrador nem Super user");
-
 
96
            }
-
 
97
 
-
 
98
 
-
 
99
        } catch (AccessDeniedException e) {
-
 
100
            logger.error("Tentado alterar um Role e não é Administrador nem Super user");
-
 
101
            throw e;
-
 
102
        }
-
 
103
 
-
 
104
        return result;
-
 
105
    }
-
 
106
 
58
    public ReplaceRoleResult updateOldRoleWithView(1.5.0/docs/api/java/lang/String.html">String oldRole,UserRoleConfigImpl newViewRoleConfig, UserSession sess)
107
    public ReplaceRoleResult updateOldRoleWithView(1.5.0/docs/api/java/lang/String.html">String oldRole,UserRoleConfigImpl newViewRoleConfig, UserSession sess)
59
            throws AccessDeniedException
108
            throws AccessDeniedException
60
    {
109
    {
61
        return updateOldRoleWithView(oldRole, newViewRoleConfig, sess,true);
110
        return updateOldRoleWithView(oldRole, newViewRoleConfig, sess,true);
62
    }
111
    }
Line 235... Line 284...
235
    private void replaceCourseRoles(1.5.0/docs/api/java/lang/String.html">String oldRole, 1.5.0/docs/api/java/lang/String.html">String newRole, ReplaceRoleResult result) {
284
    private void replaceCourseRoles(1.5.0/docs/api/java/lang/String.html">String oldRole, 1.5.0/docs/api/java/lang/String.html">String newRole, ReplaceRoleResult result) {
236
        List<Course> courses = DaoFactory.getCourseDaoImpl().findValidateRole(oldRole);
285
        List<Course> courses = DaoFactory.getCourseDaoImpl().findValidateRole(oldRole);
237
        result.afetectedCoursesValidatePrograms = courses.size();
286
        result.afetectedCoursesValidatePrograms = courses.size();
238
        for(Course c :courses)
287
        for(Course c :courses)
239
        {
288
        {
240
           c.setValidationRole(newRole);
289
            c.setValidationRole(newRole);
241
        }
290
        }
242
    }
291
    }
243
 
292
 
244
    private void replaceSchoolAndDepartmentRoles(1.5.0/docs/api/java/lang/String.html">String oldRole, 1.5.0/docs/api/java/lang/String.html">String newRole, ReplaceRoleResult result) {
293
    private void replaceSchoolAndDepartmentRoles(1.5.0/docs/api/java/lang/String.html">String oldRole, 1.5.0/docs/api/java/lang/String.html">String newRole, ReplaceRoleResult result) {
245
        List<CourseDepartment> departments = DaoFactory.getCourseDepartmentDaoImpl().findByDirectorRole(oldRole);
294
        List<CourseDepartment> departments = DaoFactory.getCourseDepartmentDaoImpl().findByDirectorRole(oldRole);
Line 370... Line 419...
370
        }
419
        }
371
        return totalNew;
420
        return totalNew;
372
    }
421
    }
373
 
422
 
374
    private static final 1.5.0/docs/api/java/lang/String.html">String INIT_ROLES = "user.role.all=Todos\n" +
423
    private static final 1.5.0/docs/api/java/lang/String.html">String INIT_ROLES = "user.role.all=Todos\n" +
551
 
600
 
552
 
601
 
553
 
602
 
554
 
603
 
555
 
604
 
556
                            //ESCOLAS ANTIGOS NAO USAR
605
            //ESCOLAS ANTIGOS NAO USAR
557
                            "user.role.board.school.estg=Board de Direcção da ESTG\n"+
606
            "user.role.board.school.estg=Board de Direcção da ESTG\n"+
558
                            "user.role.board.school.esae=Board de Direcção da ESAE\n"+
607
            "user.role.board.school.esae=Board de Direcção da ESAE\n"+
559
                            "user.role.board.school.esecs=Board de Direcção da ESECS\n"+
608
            "user.role.board.school.esecs=Board de Direcção da ESECS\n"+
560
                            "user.role.board.school.ess=Board de Direcção da ESS\n"+
609
            "user.role.board.school.ess=Board de Direcção da ESS\n"+
561
 
610
 
562
 
611
 
563
                            //ESAE
612
            //ESAE
564
                            "user.role.department.board.agric.recurs.nat=Departamento Direção - Agricultura e Recursos Naturais\n" +
613
            "user.role.department.board.agric.recurs.nat=Departamento Direção - Agricultura e Recursos Naturais\n" +
565
                            "user.role.department.board.cienc.tecnol.ani=Departamento Direção - Ciência e Tecnologia Animal\n" +
614
            "user.role.department.board.cienc.tecnol.ani=Departamento Direção - Ciência e Tecnologia Animal\n" +
566
                            "user.role.department.diretor.agric.recurs.nat=Departamento Diretor - Agricultura e Recursos Naturais\n" +
615
            "user.role.department.diretor.agric.recurs.nat=Departamento Diretor - Agricultura e Recursos Naturais\n" +
567
                            "user.role.department.diretor.cienc.tecnol.ani=Departamento Diretor - Ciência e Tecnologia Animal\n" +
616
            "user.role.department.diretor.cienc.tecnol.ani=Departamento Diretor - Ciência e Tecnologia Animal\n" +
568
                            //ESECS
617
            //ESECS
569
                            "user.role.department.board.comun.artes.tecn=Departamento Direção - Comunicação, Artes e Tecnologias\n" +
618
            "user.role.department.board.comun.artes.tecn=Departamento Direção - Comunicação, Artes e Tecnologias\n" +
570
                            "user.role.department.board.educac.formac=Departamento Direção - Educação e Formação\n" +
619
            "user.role.department.board.educac.formac=Departamento Direção - Educação e Formação\n" +
571
                            "user.role.department.board.inter.des.soc=Departamento Direção - Intervenção e Desenvolvimento Social\n" +
620
            "user.role.department.board.inter.des.soc=Departamento Direção - Intervenção e Desenvolvimento Social\n" +
572
                            "user.role.department.diretor.comun.artes.tecn=Departamento Diretor - Comunicação, Artes e Tecnologias\n" +
621
            "user.role.department.diretor.comun.artes.tecn=Departamento Diretor - Comunicação, Artes e Tecnologias\n" +
573
                            "user.role.department.diretor.educac.formac=Departamento Diretor - Educação e Formação\n" +
622
            "user.role.department.diretor.educac.formac=Departamento Diretor - Educação e Formação\n" +
574
                            "user.role.department.diretor.inter.des.soc=Departamento Diretor - Intervenção e Desenvolvimento Social\n" +
623
            "user.role.department.diretor.inter.des.soc=Departamento Diretor - Intervenção e Desenvolvimento Social\n" +
575
                            //ESS
624
            //ESS
576
                            "user.role.department.board.cienc.tec.saude=Departamento Direção - Ciências e Tecnologias da Saúde\n" +
625
            "user.role.department.board.cienc.tec.saude=Departamento Direção - Ciências e Tecnologias da Saúde\n" +
577
                            "user.role.department.diretor.cienc.tec.saude=Departamento Diretor - Ciências e Tecnologias da Saúde\n" +
626
            "user.role.department.diretor.cienc.tec.saude=Departamento Diretor - Ciências e Tecnologias da Saúde\n" +
578
                            //ESTG
627
            //ESTG
579
                            "user.role.department.board.cienc.empre.sh=Departamento Direção - Ciências Empresariais, Sociais e Humanas\n" +
628
            "user.role.department.board.cienc.empre.sh=Departamento Direção - Ciências Empresariais, Sociais e Humanas\n" +
580
                            "user.role.department.board.tecnolo.design=Departamento Direção - Tecnologias e Design\n" +
629
            "user.role.department.board.tecnolo.design=Departamento Direção - Tecnologias e Design\n" +
581
                            "user.role.department.diretor.cienc.empre.sh=Departamento Diretor - Ciências Empresariais, Sociais e Humanas\n" +
630
            "user.role.department.diretor.cienc.empre.sh=Departamento Diretor - Ciências Empresariais, Sociais e Humanas\n" +
582
                            "user.role.department.diretor.tecnolo.design=Departamento Diretor - Tecnologias e Design\n"
631
            "user.role.department.diretor.tecnolo.design=Departamento Diretor - Tecnologias e Design\n"
583
            ;
632
            ;
584
 
633
 
585
 
634
 
586
 
635
 
587
 
636
 
588
}
637
}
-
 
638