Package org.libreplan.business.labels.entities

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


    @Autowired
    private SessionFactory sessionFactory;

    private Label givenLabelStored() {
        Label label = Label.create("label-code-" + UUID.randomUUID(),
                "labelName " + UUID.randomUUID().toString());

        LabelType labelType = LabelType.create("label-type-"
                + UUID.randomUUID());
        labelType.addLabel(label);

        labelTypeDAO.save(labelType);
        labelTypeDAO.flush();
        sessionFactory.getCurrentSession().evict(labelType);
        sessionFactory.getCurrentSession().evict(label);

        labelType.dontPoseAsTransientObjectAnymore();
        label.dontPoseAsTransientObjectAnymore();
        return label;
    }
View Full Code Here


        }
        return false;
    }

    private boolean acceptLabel(FilterPair filter, TaskElement taskElement) {
        Label filterLabel = (Label) filter.getValue();
        return existLabelInTaskElement(filterLabel, taskElement);
    }
View Full Code Here

    }

    @Transactional(readOnly = true)
    public Label createLabel(final String labelName,
            final LabelType labelType) {
        Label label = createAndSaveLabelOrGetFromDatabase(labelName, labelType);
        addLabelToConversation(label);
        return label;
    }
View Full Code Here

        return label;
    }

    private Label createAndSaveLabelOrGetFromDatabase(final String labelName,
            final LabelType labelType) {
        Label label;
        try {
            label = saveLabelOnAnotherTransaction(labelName, labelType);
            label.dontPoseAsTransientObjectAnymore();
        } catch (DataIntegrityViolationException e) {
            // Label was already created by another user while editing the order
            label = labelDAO.findByNameAndType(labelName, labelType);
            forceLoad(label);
        }
View Full Code Here

            final LabelType labelType) {
        return adHocTransactionService
                .runOnAnotherTransaction(new IOnTransaction<Label>() {
                    @Override
                    public Label execute() {
                        Label label = Label.create(labelName);
                        label.setType(labelType);
                        labelDAO.save(label);
                        return label;
                    }
                });
    }
View Full Code Here

    protected abstract void removeLabel(T element, Label label);

    @Transactional(readOnly = true)
    public Label findLabelByNameAndType(String labelName, LabelType labelType) {
        Label label = findLabelByNameAndTypeName(labelName, labelType.getName());
        if (label != null) {
            initializeLabel(label);
        }
        return label;
    }
View Full Code Here

    /**
     * Executed on pressing Assign button Adds selected label to direct labels
     * list
     */
    public void onAssignLabel() {
        Label label = (Label) bdLabels.getSelectedElement();
        if (label == null) {
            throw new WrongValueException(bdLabels, _("please, select a label"));
        }
        if (isAssigned(label)) {
            throw new WrongValueException(bdLabels, _("already assigned"));
View Full Code Here

                    _("cannot be empty"));
        }

        // Label does not exist, create
        final LabelType labelType = (LabelType) comboitem.getValue();
        Label label = getModel().findLabelByNameAndType(
                labelName, labelType);
        if (label == null) {
            label = addLabel(labelName, labelType);
        } else {
            // Label is already assigned?
View Full Code Here

        }
        clear(txtLabelName);
    }

    private Label addLabel(String labelName, LabelType labelType) {
        Label label = createLabel(labelName, labelType);
        bdLabels.addElement(label);
        return label;
    }
View Full Code Here

    private void assignItsLabels(WorkReportType workReportType) {
        Set<Label> updatedLabels = new HashSet<Label>();
        if (workReportType != null) {
            for (WorkReportLabelTypeAssigment labelTypeAssigment : workReportType
                    .getLineLabels()) {
                Label label = getLabelBy(labelTypeAssigment);
                if (label != null) {
                    updatedLabels.add(label);
                } else {
                    updatedLabels.add(labelTypeAssigment.getDefaultLabel());
                }
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.