Package org.snippr.business.entities

Examples of org.snippr.business.entities.Label


    @Override
    @Transactional
    public void addNewLabel() throws DuplicateName {
        User user = userDAO.getCurrentUser();
        Label label = new Label();
        label.setName("<No name>");
        label.setUser(user);
        if (labelDAO.exists(label)) {
            throw new DuplicateName();
        }
        labelDAO.save(label);
    }
View Full Code Here


     * Create a new Label for this user
     * @access public
     */
    @Override
    public void addNewLabel() {
        Label label = new Label();
        user.addLabel(label);
    }
View Full Code Here

     */
    @Transactional(readOnly = true)
    public Set<Snippet> getSnippetsWithLabel(String labelname){
        Set<Snippet> snippets = this.getSnippets();

        Label label = labelDAO.getByLabelname(labelname);
        long labelid = label.getId();

        Set<Snippet> results = new HashSet<Snippet>();
        for (Snippet each:snippets) {
            if (each.getId() == labelid)    {
                results.add(each);
View Full Code Here

        }
    }

    @Override
    public void prepareForCreate() {
        label = new Label();
    }
View Full Code Here

    @Override
    @Transactional(readOnly = true)
    public Label getByLabelname(String labelname) {
        Criteria criteria = getSession().createCriteria(Label.class);
        criteria.add(Restrictions.eq("name", labelname));
        Label label = null;
        if (!criteria.list().isEmpty()) {
            label = (Label) criteria.list().get(0);
        }
        return label;
    }
View Full Code Here

    public Collection<Label> getLabels() {
        return cLabels;
    }

    private void loadCatalog() {
        Label labelGit = new Label("git");
        labelGit.setId(nextId++);
        Label labelJava = new Label("java");
        labelJava.setId(nextId++);
        Label labelZk = new Label("zk");
        labelZk.setId(nextId++);
        Label labelHibernate = new Label("hibernate");
        labelHibernate.setId(nextId++);

        cLabels.add(labelGit);
        cLabels.add(labelJava);
        cLabels.add(labelZk);
        cLabels.add(labelHibernate);
View Full Code Here

            }
        }
    }

    public Label getLabel(Long labelId) {
        Label returnLabel = null;
        for (Label label : cLabels) {
            if (label.getId() == labelId) {
                returnLabel = label;
                break;
            }
View Full Code Here

TOP

Related Classes of org.snippr.business.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.