Subversion Repositories bacoAlunos

Rev

Rev 1306 | Blame | Compare with Previous | Last modification | View Log | RSS feed

package pt.estgp.estgweb.services.blogs;

import jomm.utils.StringsUtils;
import pt.estgp.estgweb.domain.BlogImpl;
import pt.estgp.estgweb.domain.dao.DaoFactory;
import pt.estgp.estgweb.services.expceptions.ServiceException;
import pt.utl.ist.berserk.logic.serviceManager.IService;

import java.util.List;

/**
 * @author Jorge Machado
 * @date 2/Jun/2008
 * @time 11:03:00
 * @see pt.estgp.estgweb.web
 */

public class CheckBlogNameService implements IService
{
    public boolean run(1.5.0/docs/api/java/lang/String.html">String name, long blogId) throws ServiceException
    {
        if(!StringsUtils.checkLetters09AZazHiffenUnderScore(name))
            return false;
       
        List<BlogImpl> bs = DaoFactory.getBlogDaoImpl().findByName(name);
        return bs.size() <= 0 || bs.get(0).getId() == blogId;
    }
}