Package net.stinfoservices.pacifiq.server.model

Examples of net.stinfoservices.pacifiq.server.model.Program


            // 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());
                }
            }
        }

        if (program != null) {
            // in fact you save here consumptionList and Consumption inside (Consumption = item + category)
            applyDiffProgramGc4Launch(program, document);
            // itemConsumption is CASCADE.ALL so must run fully ok with DELETE also.
            Program programWithConsumptionIds = programDAO.save(program);

            // note that id order is not important as we are in transaction and that id are just simply recycled if bad ordered...
            List<Long> consumptionIds = new ArrayList<Long>();
            for (Consumption consumption : programWithConsumptionIds.getItemConsumptions()) {
                consumptionIds.add(consumption.getId());
            }

            // save does not merge program.dsp5s.item influence.
            alertManagement.alert(user);
View Full Code Here


        if (program == null) {
            return (null);
        }

        try {
            Program p = entityManager.merge(program);

            entityManager.persist(p);
            p = entityManager.find(Program.class, p.getId());
            LOGGER.info(MessageFormat.format(ResourceBundle.getBundle("system").getString("OBJECT_SAVED"), this.getClass().getSimpleName(),
                    p.getName()));

            return (p);
        } catch (Exception ex) {
            throw new CustomException(ex);
        }
View Full Code Here

        if (program == null) {
            return;
        }

        try {
            Program nprogram = entityManager.merge(program);

            entityManager.remove(nprogram);
            LOGGER.info(MessageFormat.format(ResourceBundle.getBundle("system").getString("OBJECT_DELETED"), this.getClass().getSimpleName(),
                    nprogram.getName()));
        } catch (Exception ex) {
            throw new CustomException(ex);
        }
    }
View Full Code Here

        SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm");

        if ((objects != null) && !(objects.isEmpty())) {
            int lineNumber = 0;
            for (Object o : objects) {
                Program program = (Program) o;

                // index from 0,0... cell A1 is cell(0,0)
                HSSFRow row1 = worksheet.createRow(lineNumber);

                HSSFCell cellA1 = row1.createCell(0);
                cellA1.setCellValue(getResourceBundle().getString("PROGRAM_NAME"));
                HSSFCellStyle cellStyle = workbook.createCellStyle();
                cellStyle.setFillForegroundColor(HSSFColor.LIGHT_GREEN.index);
                cellStyle.setFillPattern(CellStyle.SOLID_FOREGROUND);
                cellA1.setCellStyle(cellStyle);

                HSSFCell cellB1 = row1.createCell(1);
                cellB1.setCellValue(getResourceBundle().getString("PROGRAM_LAUNCH_DATE"));
                cellStyle = workbook.createCellStyle();
                cellStyle.setFillForegroundColor(HSSFColor.LIGHT_BLUE.index);
                cellStyle.setFillPattern(CellStyle.SOLID_FOREGROUND);
                cellB1.setCellStyle(cellStyle);

                HSSFRow row2 = worksheet.createRow(++lineNumber);

                HSSFCell cellA2 = row2.createCell(0);
                cellA2.setCellValue(program.getName());

                HSSFCell cellB2 = row2.createCell(1);
                cellStyle = workbook.createCellStyle();
                cellStyle.setDataFormat(HSSFDataFormat.getBuiltinFormat("dd/MM/yyyy HH:mm"));
                cellB2.setCellValue(sdf.format(program.getLaunchDate()));
                cellB2.setCellStyle(cellStyle);

                lineNumber = lineNumber + 2;
            }
        }
View Full Code Here

    @DatabaseSetup(value = DATASET_DOCUMENT_PROGRAM)
    @ExpectedDatabase(value = DATASET_DOCUMENT_PROGRAM, assertionMode = DatabaseAssertionMode.NON_STRICT)
    @DatabaseTearDown(value = DATASET_DOCUMENT_PROGRAM, type = DatabaseOperation.DELETE)
    @Test
    public void testClone() throws Exception {
        Program prog = programDAO.find(1L);
        assertNotNull(prog);

        ProgramDTO dto = new ProgramDTO(prog, DTOPath.PROGRAM_DOC);
        ProgramDTO dtoClone = dto.clone();
        assertEquals(dtoClone.getName(), dto.getName());
View Full Code Here

                        list.add(dsp5);
                    } else if ("TAA".equals(type)) {
                        AbstractTAA taa = taaDAO.find(Long.parseLong(id));
                        list.add(taa);
                    } else if ("Program".equals(type)) {
                        Program program = programDAO.find(Long.parseLong(id));
                        list.add(program);
                    }
                } catch (Exception ex) {
                    CustomExceptionMessageHelper.log(getClass(), Level.SEVERE, ex);
                }
View Full Code Here

    @DatabaseTearDown(value = UPDATE_DATASET, type = DatabaseOperation.DELETE)
    @Override
    public void testFind() throws Exception {
        Uzer uzer = uzerDAO.find(1L);
        Uzer uzerc = new Uzer();
        Program program = new Program();
        Profile profile = new Profile();

        program.setId(1L);
        program.setName(PROGRAM_NAME);
        program.setVersion(1);
        profile.setId(1L);
        profile.setAdministrator(false);
        profile.setLicensesConsultation(false);
        profile.setLicensesEdition(false);
        profile.setProgramsConsultation(false);
View Full Code Here

    @DatabaseTearDown(value = UPDATE_DATASET, type = DatabaseOperation.DELETE)
    @Override
    public void testFindAll() throws Exception {
        List<Uzer> uzers = uzerDAO.findAll();
        Uzer uzer = new Uzer();
        Program program = new Program();
        Profile profile = new Profile();

        program.setId(1L);
        program.setName(PROGRAM_NAME);
        program.setVersion(1);
        profile.setId(1L);
        profile.setAdministrator(false);
        profile.setLicensesConsultation(false);
        profile.setLicensesEdition(false);
        profile.setProgramsConsultation(false);
View Full Code Here

    @DatabaseTearDown(value = UPDATE_DATASET, type = DatabaseOperation.DELETE)
    @Override
    public void testFindEntries() throws Exception {
        List<Uzer> uzers = uzerDAO.findEntries(1, 1);
        Uzer uzer = new Uzer();
        Program program = new Program();
        Profile profile = new Profile();

        program.setId(1L);
        program.setName(PROGRAM_NAME);
        program.setVersion(1);
        profile.setId(1L);
        profile.setAdministrator(false);
        profile.setLicensesConsultation(false);
        profile.setLicensesEdition(false);
        profile.setProgramsConsultation(false);
View Full Code Here

            DatabaseConnection connection = new DatabaseConnection(dataSource.getConnection());
            IDataSet expectedDataSet = new FlatXmlDataSetBuilder().build(this.getClass().getResource("/dbunit/dao/admin/uzer-create_no-id.xml")
                    .openStream());
            Uzer uzer = new Uzer();
            Uzer nuzer;
            Program program = new Program();
            Profile profile = new Profile();

            program.setName(PROGRAM_NAME);
            program.setVersion(1);
            profile.setId(1L);
            profile.setAdministrator(false);
            profile.setLicensesConsultation(false);
            profile.setLicensesEdition(false);
            profile.setProgramsConsultation(false);
View Full Code Here

TOP

Related Classes of net.stinfoservices.pacifiq.server.model.Program

Copyright © 2018 www.massapicom. 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.