Examples of Consumption


Examples of buhi.Consumption

    @Override
    public void CreateVacation(Vacation vacation) {
        Document document = new Document();
        document.setName("consumption_vacation");
        document.setDate(vacation.getOrderDate());
        Consumption consumption = new Consumption();
        consumption.setDocumentFk(document);
        entityManagerBuhDb.persist(document);
        consumption.setTotal(vacation.getSalary());
        consumption.setTypeOfConsumption("vacation");
        entityManagerBuhDb.persist(consumption);
        entityManagerPersondb.persist(vacation);   
    }
View Full Code Here

Examples of buhi.Consumption

    @Override
    public void CreateIll(IllList ill) {
        Document document = new Document();
        document.setName("consumption_ill");
        document.setDate(ill.getOrderDate());
        Consumption consumption = new Consumption();
        consumption.setDocumentFk(document);
        entityManagerBuhDb.persist(document);
        consumption.setTotal(ill.getSalary());
        consumption.setTypeOfConsumption("ill");
        entityManagerBuhDb.persist(consumption);
        entityManagerPersondb.persist(ill);
    }
View Full Code Here

Examples of buhi.Consumption

    @Override
    public void Dismissal(Dismissal dismissal, Usracc useraccount) {
        Document document = new Document();
        document.setName("consumption_dismissal");
        document.setDate(dismissal.getOrderDate());
        Consumption consumption = new Consumption();
        consumption.setDocumentFk(document);
        entityManagerBuhDb.persist(document);
        consumption.setTotal(dismissal.getSalary());
        consumption.setTypeOfConsumption("dismissal");
        entityManagerBuhDb.persist(consumption);
       
        entityManagerAccountDb.remove(useraccount);
        entityManagerPersondb.persist(dismissal);
       
View Full Code Here

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

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

        try {
            Consumption c = entityManager.merge(consumption);

            entityManager.persist(c);
            c = entityManager.find(Consumption.class, c.getId());
            // Consumption are lazy written (program.itemConsumptions)
            // so this function is never used, so no log4j-database is needed here

            return (c);
        } catch (Exception ex) {
View Full Code Here

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

        if (consumption == null) {
            return;
        }

        try {
            Consumption nconsumption = entityManager.merge(consumption);

            entityManager.remove(nconsumption);
            // Consumption are lazy written (program.itemConsumptions)
            // so this function is never used, so no log4j-database is needed here
        } catch (Exception ex) {
View Full Code Here

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

     */
    private void applyDiffProgramGc4Launch(Program program, ProgramDTO dto) throws Exception {
        Set<Consumption> itemConsumptions = new HashSet<Consumption>();
        for (ConsumptionDTO consumptionDTO : dto.getItemsConsumption()) {
            // do we save empty Category lines ?
            Consumption consumption = consumptionDAO.find(consumptionDTO.getId());
            if (consumption == null) {
                consumption = new Consumption();
            }
            consumption.setCategory(consumptionDTO.getCategory());
            consumption.setProgram(program);
            consumption.setQuantity(consumptionDTO.getQuantity());
            if (consumptionDTO.getItem() != null && consumptionDTO.getItem().getId() != null) {
                // not a new empty Category line
                consumption.setItem(itemDAO.find(consumptionDTO.getItem().getId()));

                // if not item, do not save consumption (empty entries are not reloaded...)
                itemConsumptions.add(consumption);
            }
        }
View Full Code Here

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

    @Test
    @DatabaseSetup(value = UPDATE_DATASET)
    @DatabaseTearDown(value = UPDATE_DATASET, type = DatabaseOperation.DELETE)
    @Override
    public void testFind() throws Exception {
        Consumption consumption = consumptionDAO.find(1L);
        Consumption consumptionc = new Consumption();
        Program program = new Program();
        Item item = new Item();
        DSP5 dsp5 = new DSP5();

        consumptionc.setId(1L);
        consumptionc.setQuantity(5);
        program.setId(1L);
        program.setName(PROGRAM_NAME);
        program.setVersion(1);
        consumptionc.setProgram(program);
        dsp5.setId(1L);
        dsp5.setLicenseNumber(DSP5_LICENSE_NUMBER);
        dsp5.setVersion(1);
        item.setId(1L);
        item.setQuantity(5);
        item.setDsp5(dsp5);
        item.setVersion(1);
        consumptionc.setItem(item);
        consumptionc.setVersion(2);
        assertNotNull(consumption);
        assertSame(2, consumption.getVersion());
        assertEquals(consumptionc.getQuantity(), consumption.getQuantity());
        assertEquals(consumptionc, consumption);
        assertNull(consumptionDAO.find(2L));
        assertNull(consumptionDAO.find(0L));
    }
View Full Code Here

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

    @DatabaseSetup(value = UPDATE_DATASET)
    @DatabaseTearDown(value = UPDATE_DATASET, type = DatabaseOperation.DELETE)
    @Override
    public void testFindAll() throws Exception {
        List<Consumption> consumptions = consumptionDAO.findAll();
        Consumption consumption = new Consumption();
        Program program = new Program();
        Item item = new Item();
        DSP5 dsp5 = new DSP5();

        consumption.setId(1L);
        consumption.setQuantity(5);
        program.setId(1L);
        program.setName(PROGRAM_NAME);
        program.setVersion(1);
        consumption.setProgram(program);
        dsp5.setId(1L);
        dsp5.setLicenseNumber(DSP5_LICENSE_NUMBER);
        dsp5.setVersion(1);
        item.setId(1L);
        item.setQuantity(5);
        item.setDsp5(dsp5);
        item.setVersion(1);
        consumption.setItem(item);
        consumption.setVersion(2);
        assertSame(1, consumptions.size());
        assertNotNull(consumptions.get(0));
        assertEquals(consumptions.get(0), consumption);
    }
View Full Code Here

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

    @DatabaseSetup(value = UPDATE_DATASET)
    @DatabaseTearDown(value = UPDATE_DATASET, type = DatabaseOperation.DELETE)
    @Override
    public void testFindEntries() throws Exception {
        List<Consumption> consumptions = consumptionDAO.findEntries(0, 1);
        Consumption consumption = new Consumption();
        Program program = new Program();
        Item item = new Item();
        DSP5 dsp5 = new DSP5();

        consumption.setId(1L);
        consumption.setQuantity(5);
        program.setId(1L);
        program.setName(PROGRAM_NAME);
        program.setVersion(1);
        consumption.setProgram(program);
        dsp5.setId(1L);
        dsp5.setLicenseNumber(DSP5_LICENSE_NUMBER);
        dsp5.setVersion(1);
        item.setId(1L);
        item.setQuantity(5);
        item.setDsp5(dsp5);
        item.setVersion(1);
        consumption.setItem(item);
        consumption.setVersion(2);
        assertSame(1, consumptions.size());
        assertNotNull(consumptions.get(0));
        assertEquals(consumptions.get(0), consumption);
        consumptions = consumptionDAO.findEntries(0, 0);
        assertSame(0, consumptions.size());
View Full Code Here

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

        HSSFSheet worksheet = workbook.createSheet(getResourceBundle().getString("MAIN_WORKSHEET"));

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

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

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

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

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

                HSSFCell cellD1 = row1.createCell(3);
                cellD1.setCellValue(getResourceBundle().getString("ITEM_DSP5_LICENSE_NUMBER"));
                cellStyle = workbook.createCellStyle();
                cellStyle.setFillForegroundColor(HSSFColor.CORAL.index);
                cellStyle.setFillPattern(CellStyle.SOLID_FOREGROUND);
                cellD1.setCellStyle(cellStyle);

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

                HSSFCell cellA2 = row2.createCell(0);
                cellA2.setCellValue(consumpt.getQuantity());

                HSSFCell cellB2 = row2.createCell(1);
                cellB2.setCellValue(consumpt.getCategory());

                HSSFCell cellC2 = row2.createCell(2);
                cellC2.setCellValue(consumpt.getProgram().getName());

                HSSFCell cellD2 = row2.createCell(3);
                cellD2.setCellValue(consumpt.getItem().getDsp5().getLicenseNumber());

                lineNumber = lineNumber + 2;
            }
        }
    }
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.