Package org.libreplan.business.labels.entities

Examples of org.libreplan.business.labels.entities.Label


    public List<Label> getAllLabels() {
        return workingArrangementsPerOrderModel.getAllLabels();
    }

    public void onSelectLabel() {
        Label label = (Label) bdLabels.getSelectedElement();
        if (label == null) {
            throw new WrongValueException(bdLabels, _("please, select a label"));
        }
        boolean result = workingArrangementsPerOrderModel
                .addSelectedLabel(label);
View Full Code Here


    }

    public Label createValidLabel() {
        LabelType labelType = LabelType.create(UUID.randomUUID().toString());
        labelTypeDAO.save(labelType);
        Label label = Label.create(UUID.randomUUID().toString());
        label.setType(labelType);
        return label;
    }
View Full Code Here

    }

    @Test
    @Transactional
    public void testSaveLabel() {
        Label label = createValidLabel();
        labelDAO.save(label);
        assertTrue(label.getId() != null);
    }
View Full Code Here

    }

    @Test
    @Transactional
    public void testRemoveLabel() throws InstanceNotFoundException {
        Label label = createValidLabel();
        labelDAO.save(label);
        labelDAO.remove(label.getId());
        assertFalse(labelDAO.exists(label.getId()));
    }
View Full Code Here

    @Test
    @Transactional
    public void testListLabels() {
        int previous = labelDAO.list(Label.class).size();
        Label label = createValidLabel();
        labelDAO.save(label);
        List<Label> list = labelDAO.list(Label.class);
        assertEquals(previous + 1, list.size());
    }
View Full Code Here

        }
        return true;
    }

    private void removeLabelOnChildren(Label newLabel) {
        Label toRemove = null;

        for (Label label : labels) {
            if (label.equals(newLabel)) {
                toRemove = label;
                break;
View Full Code Here

        return labelType;

    }

    private static Label toEntity(LabelDTO labelDTO) {
        Label label = Label.create(labelDTO.code, labelDTO.name);

        return label;
    }
View Full Code Here

            if (StringUtils.isBlank(labelDTO.code)) {
                throw new ValidationException("missing code in a label");
            }

            try {
                Label label = labelType.getLabelByCode(labelDTO.code);
                label.updateUnvalidated(StringUtils.trim(labelDTO.name));
            } catch (InstanceNotFoundException e) {
                labelType.addLabel(toEntity(labelDTO));
            }
        }
View Full Code Here

    @Autowired
    private IAdHocTransactionService transactionService;

    private LabelType givenLabelTypeStored() {
        Label label1 = Label.create("label-name-1");
        Label label2 = Label.create("label-name-2");
        final LabelType labelType = LabelType.create("label-type-name"
                + UUID.randomUUID());

        labelType.addLabel(label1);
        labelType.addLabel(label2);
View Full Code Here

                labelTypeA, labelTypeA, labelTypeA);
        LabelType labelType_B = findOrCreate(labelTypeDAO, LabelType.class,
                labelTypeB, labelTypeB, labelTypeB);

        if (labelType_A.isNewObject()) {
            Label label_A1 = Label.create(labelA1, labelA1);
            Label label_A2 = Label.create(labelA2, labelA2);
            Label label_B1 = Label.create(labelB1, labelB1);

            labelType_A.addLabel(label_A1);
            labelType_A.addLabel(label_A2);
            labelType_B.addLabel(label_B1);
View Full Code Here

TOP

Related Classes of org.libreplan.business.labels.entities.Label

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.