Package org.libreplan.business.resources.entities

Examples of org.libreplan.business.resources.entities.Machine


    public RowRenderer getMachinesRenderer() {
        return new RowRenderer() {

            @Override
            public void render(Row row, Object data) {
                final Machine machine = (Machine) data;
                row.setValue(machine);

                row.addEventListener(Events.ON_CLICK,
                        new EventListener() {
                            @Override
                    public void onEvent(Event event) {
                                goToEditForm(machine);
                            }
                        });

                row.appendChild(new Label(machine.getName()));
                row.appendChild(new Label(machine.getDescription()));
                row.appendChild(new Label(machine.getCode()));
                row.appendChild(new Label((Boolean.TRUE.equals(machine
                        .isLimitingResource())) ? _("yes") : _("no")));

                Hbox hbox = new Hbox();
                hbox.appendChild(Util.createEditButton(new EventListener() {
                    @Override
View Full Code Here


        Validate.notNull(configurationUnit);
        Validate.noNullElements(dayAssignments);
        DerivedAllocation result = DerivedAllocation.create(derivedFrom,
                configurationUnit);
        List<Resource> foundResources = findResources(finder, configurationUnit);
        final Machine machine = configurationUnit.getMachine();
        BigDecimal alpha = configurationUnit.getAlpha();
        result.resetAssignmentsTo(createAssignments(result, alpha,
                foundResources, onlyFor(machine, dayAssignments)));
        return result;
    }
View Full Code Here

        String code = UUID.randomUUID().toString();
        return createValidMachine(code);
    }

    private Machine createValidMachine(String code) {
        Machine machine = Machine.create();
        machine.setCode(code);
        machine.setName("name");
        machine.setDescription("description");
        return machine;
    }
View Full Code Here

    }

    @Test
    @Transactional
    public void testSaveMachine() {
        Machine machine = createValidMachine();
        machineDAO.save(machine);
        assertTrue(machine.getId() != null);
    }
View Full Code Here

    }

    @Test
    @Transactional
    public void testRemoveMachine() throws InstanceNotFoundException {
        Machine machine = createValidMachine();
        machineDAO.save(machine);
        machineDAO.remove(machine.getId());
        assertFalse(machineDAO.exists(machine.getId()));
    }
View Full Code Here

    @Test
    @Transactional
    public void testListMachines() {
        int previous = machineDAO.list(Machine.class).size();
        Machine machine = createValidMachine();
        machineDAO.save(machine);
        List<Machine> list = machineDAO.list(Machine.class);
        assertEquals(previous + 1, list.size());
    }
View Full Code Here

        assertEquals(previous + 1, list.size());
    }

    @Test
    public void testSaveConfigurationUnits() throws InstanceNotFoundException {
        final Machine machine = createValidMachine();
        MachineWorkersConfigurationUnit configurationUnit = MachineWorkersConfigurationUnit
                .create(machine, "Operation", new BigDecimal(1));
        final Criterion criterion = CriterionDAOTest.createValidCriterion();
        configurationUnit.addRequiredCriterion(criterion);
        machine.addMachineWorkersConfigurationUnit(configurationUnit);
        transactionService.runOnTransaction(new IOnTransaction<Void>() {
            @Override
            public Void execute() {
                criterionTypeDAO.save(criterion.getType());
                criterionDAO.save(criterion);
                machineDAO.save(machine);
                return null;
            }
        });
        assertTrue(machine.getId() != null);
        assertTrue(machine.getConfigurationUnits().size() != 0);
        assertTrue(machine.getConfigurationUnits().iterator().next()
                .getRequiredCriterions().size() != 0);
    }
View Full Code Here

TOP

Related Classes of org.libreplan.business.resources.entities.Machine

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.