Package org.snippr.business.exceptions

Examples of org.snippr.business.exceptions.DuplicateName


    @Override
    @Transactional
    public void save() throws DuplicateName {
        if (snippetCode.getId() == null && snippetCodeDAO.exists(snippetCode)) {
            throw new DuplicateName();
        }
        if (!snippetCode.getCode().isEmpty()) {
            snippetCodeDAO.save(snippetCode);
        }
    }
View Full Code Here


    @Override
    @Transactional
    public void save() throws DuplicateName {
        if (snippet.getId() == null && snippetDAO.exists(snippet)) {
            throw new DuplicateName();
        }
        // Both title and description are required
        if (!snippet.getTitle().isEmpty()
                && !snippet.getDescription().isEmpty()) {
            snippetDAO.save(snippet);
View Full Code Here

        snippet.setTitle("New Snippet, please fill it.");
        snippet.setDescription("Add a description here.");
        snippet.setUser(user);
        snippet.setLabel(label);
        if (snippetDAO.exists(snippet)) {
            throw new DuplicateName();
        }
        snippetDAO.save(snippet);
    }
View Full Code Here

        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

    @Override
    @Transactional
    public void save() throws DuplicateName {
        if (label.getId() == null && labelDAO.exists(label)) {
            throw new DuplicateName();
        }
        if (!label.getName().isEmpty()) {
            labelDAO.save(label);
        }
    }
View Full Code Here

    @Override
    @Transactional
    public void save() throws DuplicateName {
        if (comment.getId() == null && commentDAO.exists(comment)) {
            throw new DuplicateName();
        }
        commentDAO.save(comment);
    }
View Full Code Here

    @Override
    @Transactional
    public void save(Snippet snippet) throws DuplicateName {
        if (comment.getId() == null && commentDAO.exists(comment)) {
            throw new DuplicateName();
        }
        User user = userDAO.getCurrentUser();
        comment.setSnippet(snippet);
        comment.setUser(user);
        commentDAO.save(comment);
View Full Code Here

TOP

Related Classes of org.snippr.business.exceptions.DuplicateName

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.