Examples of UzerDTO


Examples of net.stinfoservices.pacifiq.shared.dto.inner.UzerDTO

            ServiceSecurityHelper.hasAuthority(ProfileHelper.ADMINISTRATOR, getSession());
            isAdmin = true;
        } catch (Exception aae1) {
            isAdmin = false;
        }
        UzerDTO user = (UzerDTO) getSession().getAttribute("user");
        boolean haveToDisableSaveButton = false;
        // ProgramManager cannot edit after launch validation.
        if (!isAdmin) {
            boolean canValidateGC4Launch = false;
            for (ProgramDTO program : user.getEcmManaged()) {
                if (program.getId() == id) {
                    canValidateGC4Launch = true;
                    break;
                }
            }
            for (ProgramDTO program : user.getProgramsManaged()) {
                if (program.getId() == id) {
                    canValidateGC4Launch = true;
                    haveToDisableSaveButton = true;
                    break;
                }
View Full Code Here

Examples of net.stinfoservices.pacifiq.shared.dto.inner.UzerDTO

        if (hasRights) {
            programDAO.remove(programDAO.find(id));
        }

        if (hasSpecificRights) {
            UzerDTO user = (UzerDTO) getSession().getAttribute("user");

            Set<ProgramDTO> specPrograms = new HashSet<ProgramDTO>();
            specPrograms.addAll(user.getProgramsWithConsultationRights());
            specPrograms.addAll(user.getProgramsWithEditionRights());

            List<Long> programsId = new ArrayList<Long>();
            for (ProgramDTO program : specPrograms) {
                programsId.add(program.getId());
            }

            if (programsId.contains(id)) {
                programDAO.remove(programDAO.find(id));
            }
        }
        UzerDTO user = (UzerDTO) getSession().getAttribute("user");
        alertManagement.alert(user);
    }
View Full Code Here

Examples of net.stinfoservices.pacifiq.shared.dto.inner.UzerDTO

        boolean readOnly = false;
        boolean readOnlySpecific = false;

        boolean isAdmin = false;

        UzerDTO user = (UzerDTO) getSession().getAttribute("user");

        try {
            ServiceSecurityHelper.hasAuthority(ProfileHelper.ADMINISTRATOR, getSession());
            isAdmin = true;
            hasRights = true;
        } catch (Exception e1) {
            try {
                ServiceSecurityHelper.hasAuthority(ProfileHelper.PROGRAMS_CONSULTATION, getSession());
                hasRights = true;
            } catch (Exception e2) {
                ServiceSecurityHelper.hasAuthority(ProfileHelper.SPECIFIC_PROGRAMS_CONSULTATION, getSession());
                hasSpecificRights = true;
            }
        }

        try {
            ServiceSecurityHelper.hasAuthority(ProfileHelper.PROGRAMS_EDITION, getSession());
        } catch (Exception e) {
            readOnly = true;
            try {
                ServiceSecurityHelper.hasAuthority(ProfileHelper.SPECIFIC_PROGRAMS_EDITION, getSession());
            } catch (Exception e2) {
                readOnlySpecific = true;
            }
        }

        if (hasRights && !readOnly) {
            // no problem, you are a boss
            ProgramDTO programDTO = new ProgramDTO(programDAO.find(id), DTOPath.PROGRAM_DOC);
            if (isAdmin || (programDTO.getEcmManager() != null && programDTO.getEcmManager().getId() == user.getId())
                    || (programDTO.getProgramManager() != null && programDTO.getProgramManager().getId() == user.getId())) {
                programDTO.enableGC4LaunchButton();
            }
            return programDTO;
        } else if (hasRights && readOnly && readOnlySpecific) {
            // simple pure reader
            ProgramDTO programDTO = new ProgramDTO(programDAO.find(id), DTOPath.PROGRAM_DOC);
            programDTO.freeze();
            if (isAdmin || (programDTO.getEcmManager() != null && programDTO.getEcmManager().getId() == user.getId())
                    || (programDTO.getProgramManager() != null && programDTO.getProgramManager().getId() == user.getId())) {
                programDTO.enableGC4LaunchButton();
            }
            return programDTO;
        }

        if (hasSpecificRights || !readOnlySpecific) {

            Set<ProgramDTO> specProgramsConsultation = new HashSet<ProgramDTO>();
            Set<ProgramDTO> specProgramsEdition = new HashSet<ProgramDTO>();
            specProgramsConsultation.addAll(user.getProgramsWithConsultationRights());
            specProgramsEdition.addAll(user.getProgramsWithEditionRights());

            List<Long> programsIdConsultation = new ArrayList<Long>();
            List<Long> programsIdEdition = new ArrayList<Long>();
            for (ProgramDTO program : specProgramsConsultation) {
                programsIdConsultation.add(program.getId());
            }
            for (ProgramDTO program : specProgramsEdition) {
                programsIdEdition.add(program.getId());
            }

            if (programsIdEdition.contains(id)) {
                ProgramDTO programDTO = new ProgramDTO(programDAO.find(id), DTOPath.PROGRAM_DOC);
                if (isAdmin || (programDTO.getEcmManager() != null && programDTO.getEcmManager().getId() == user.getId())
                        || (programDTO.getProgramManager() != null && programDTO.getProgramManager().getId() == user.getId())) {
                    programDTO.enableGC4LaunchButton();
                }
                return programDTO;
            }
            if (specProgramsConsultation.contains(id)) {
                ProgramDTO programDTO = new ProgramDTO(programDAO.find(id), DTOPath.PROGRAM_DOC);
                programDTO.freeze();
                if (isAdmin || (programDTO.getEcmManager() != null && programDTO.getEcmManager().getId() == user.getId())
                        || (programDTO.getProgramManager() != null && programDTO.getProgramManager().getId() == user.getId())) {
                    programDTO.enableGC4LaunchButton();
                }
                return programDTO;
            }
        }
View Full Code Here

Examples of net.stinfoservices.pacifiq.shared.dto.inner.UzerDTO

                // do enable Save button even if program is validated...
                program.doForceDisplayGC4LaunchSaveButton();
            }
        } else {
            // Uzer has already somes PROGRAM_NAME lists
            UzerDTO user = (UzerDTO) getSession().getAttribute("user");

            if (user != null) {
                for (ProgramDTO dto : user.getProgramsManaged()) {
                    if (dto.getId().equals(programId)) {
                        // convert from PROGRAM_NAME to PROGRAM_GC_FOR_LAUNCH
                        Program programFound = programDAO.find(programId);
                        program = new ProgramDTO(programFound, DTOPath.PROGRAM_GC_FOR_LAUNCH);
                        // do not enable Save button even if program is validated...
                        break;
                    }
                }
                for (ProgramDTO dto : user.getEcmManaged()) {
                    if (dto.getId().equals(programId)) {
                        // convert from PROGRAM_NAME to PROGRAM_GC_FOR_LAUNCH
                        Program programFound = programDAO.find(programId);
                        program = new ProgramDTO(programFound, DTOPath.PROGRAM_GC_FOR_LAUNCH);
                        // do enable Save button even if program is validated...
View Full Code Here

Examples of net.stinfoservices.pacifiq.shared.dto.inner.UzerDTO

        if (hasRights) {
            Program program = (document.getId() == null ? new Program() : programDAO.find(document.getId()));
            applyDiffProgram(program, document);
            Program programWithId = programDAO.save(program);
            UzerDTO user = (UzerDTO) getSession().getAttribute("user");
            alertManagement.alert(user);
            ProgramDTO programIdAndEnableGC4LaunchButton = new ProgramDTO();
            programIdAndEnableGC4LaunchButton.setId(programWithId.getId());

            if (isAdmin || (programWithId.getEcmManager() != null && programWithId.getEcmManager().getId() == user.getId())
                    || (programWithId.getProgramManager() != null && programWithId.getProgramManager().getId() == user.getId())) {
                programIdAndEnableGC4LaunchButton.enableGC4LaunchButton();
            }
            return programIdAndEnableGC4LaunchButton;
        }

        if (hasSpecificRights) {
            UzerDTO user = (UzerDTO) getSession().getAttribute("user");

            Set<ProgramDTO> specPrograms = new HashSet<ProgramDTO>();
            specPrograms.addAll(user.getProgramsWithConsultationRights());
            specPrograms.addAll(user.getProgramsWithEditionRights());

            List<Long> programsId = new ArrayList<Long>();
            for (ProgramDTO program : specPrograms) {
                programsId.add(program.getId());
            }

            if (programsId.contains(document.getId())) {
                Program program = programDAO.find(document.getId());
                applyDiffProgram(program, document);
                Program programWithId = programDAO.save(program);
                // programDAO.getSessionFactory().getCurrentSession().flush();
                alertManagement.alert(user);
                ProgramDTO programIdAndEnableGC4LaunchButton = new ProgramDTO();
                programIdAndEnableGC4LaunchButton.setId(programWithId.getId());
                if (isAdmin || (programWithId.getEcmManager() != null && programWithId.getEcmManager().getId() == user.getId())
                        || (programWithId.getProgramManager() != null && programWithId.getProgramManager().getId() == user.getId())) {
                    programIdAndEnableGC4LaunchButton.enableGC4LaunchButton();
                }
                return programIdAndEnableGC4LaunchButton;
            }
        }
View Full Code Here

Examples of net.stinfoservices.pacifiq.shared.dto.inner.UzerDTO

            ServiceSecurityHelper.hasAuthority(ProfileHelper.ADMINISTRATOR, getSession());
            isAdmin = true;
        } catch (Exception aae1) {
            isAdmin = false;
        }
        UzerDTO user = (UzerDTO) getSession().getAttribute("user");

        // ProgramManager cannot edit after launch validation.
        if (document.getGcForLaunchsValidated() && !isAdmin && (document.getEcmManager() == null || document.getEcmManager().getId() != user.getId())) {
            // cannot edit a launched program
            throw new CannotEditLaunchedProgramException(MessageFormat.format(LocaleManager.getInstance(getSession()).getMessageResource(getClass())
                    .getString("EXCEPTION_ACCESS_DENIED_BECAUSE_OF_RIGHTS_PROGRAM_VALIDATION"), document.getName()));
        }

        Program program = null;
        if (isAdmin) {
            program = programDAO.find(document.getId());
        } else {
            if (user != null) {
                if ((document.getEcmManager() != null && document.getEcmManager().getId() == user.getId())
                        || (document.getProgramManager() != null && document.getProgramManager().getId() == user.getId())) {
                    program = programDAO.find(document.getId());
                }
            }
        }
View Full Code Here

Examples of net.stinfoservices.pacifiq.shared.dto.inner.UzerDTO

     *            The path.
     */
    public UzerProfileDTO(UzerProfile uzerProfile, DTOPath path) {
        setProfile(new ProfileDTO(uzerProfile.getProfile(), path));
        if (uzerProfile.getUzer() != null) {
            setUzer(new UzerDTO(uzerProfile.getUzer(), path));
        }
    }
View Full Code Here

Examples of net.stinfoservices.pacifiq.shared.dto.inner.UzerDTO

    @DatabaseTearDown(value = DATASET_SERVICE_ADMIN_DOCUMENT_X1_UPDATEDOWNER, type = DatabaseOperation.DELETE)
    public void testUpdateOwnerViaUpdate() throws Exception {
        List<DocumentDTO> documents = documentService.findAllByName("document 1");
        DocumentDTO document;
        ProfileDTO profile = new ProfileDTO();
        UzerDTO uzer = new UzerDTO();

        profile.setId(1L);
        uzer.setId(1L);
        assertNotNull(documents);
        assertSame(1, documents.size());
        document = documents.get(0);
        assertNotNull(document);
        assertNotNull(documents);
        assertSame(1, documents.size());
        document = documents.get(0);
        assertNotNull(document);
        profile.setAdministrator(true);
        profile.setLicensesConsultation(true);
        profile.setLicensesEdition(true);
        profile.setProgramsConsultation(true);
        profile.setProgramsEdition(true);
        profile.setName("Ahdmin");
        uzer.setProfile(profile);
        uzer.setEmail("a@a.a");
        uzer.setFirstname("ah");
        uzer.setName("Ah!");
        uzer.setPassword("a");
        uzer.setPhone("0123456789");
        document.setOwner(uzer);
        documentService.update(document);
    }
View Full Code Here

Examples of net.stinfoservices.pacifiq.shared.dto.inner.UzerDTO

    @DatabaseTearDown(value = DATASET_SERVICE_ADMIN_DOCUMENT_X1_UPDATED, type = DatabaseOperation.DELETE)
    public void testUpdate() throws Exception {
        List<DocumentDTO> documents = documentService.findAllByName("document 1");
        DocumentDTO document;
        ProfileDTO profile = new ProfileDTO();
        UzerDTO uzer = new UzerDTO();

        profile.setId(1L);
        uzer.setId(1L);
        assertNotNull(documents);
        assertSame(1, documents.size());
        document = documents.get(0);
        assertNotNull(document);
        profile.setAdministrator(true);
        profile.setLicensesConsultation(true);
        profile.setLicensesEdition(true);
        profile.setProgramsConsultation(true);
        profile.setProgramsEdition(true);
        profile.setName("Ahdmin");
        uzer.setProfile(profile);
        uzer.setEmail("a@a.a");
        uzer.setFirstname("ah");
        uzer.setName("Ah!");
        uzer.setPassword("a");
        uzer.setPhone("0123456789");
        document.setDate(DOCUMENT_DATE);
        document.setName("doc1");
        document.setDescription("description");
        document.setOwner(uzer);
        documentService.update(document);
View Full Code Here

Examples of net.stinfoservices.pacifiq.shared.dto.inner.UzerDTO

    @DatabaseSetup(value = DATASET_SERVICE_ADMIN_EMPTY)
    @DatabaseTearDown(value = DATASET_SERVICE_ADMIN_DSP5_X1, type = DatabaseOperation.DELETE)
    public void testSaveDocument() throws Exception {
        DocumentDTO document = new DocumentDTO();
        ProfileDTO profile = new ProfileDTO();
        UzerDTO owner = new UzerDTO();

        profile.setId(1L);
        owner.setId(1L);
        profile.setAdministrator(true);
        profile.setLicensesConsultation(true);
        profile.setLicensesEdition(true);
        profile.setProgramsConsultation(true);
        profile.setProgramsEdition(true);
        profile.setName("Ahdmin");
        owner.setEmail("a@a.a");
        owner.setPassword("a");
        owner.setFirstname("ah");
        owner.setName("Ah!");
        owner.setPhone("0123456789");
        owner.setProfile(profile);
        document.setName("document 1");
        document.setOwner(owner);
        documentService.saveDocument(document);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.