class MessageServiceImpl extends RemoteServiceServlet implements MessageService {

	@Override
	public void delete(long[] ids) throws ServerException {
		ServiceUtil.validateSession(getThreadLocalRequest());
		Context context = Context.get();
		SystemMessageDAO dao = (SystemMessageDAO) context.getBean(SystemMessageDAO.class);
		for (long id : ids) {
			boolean deleted = false;
			try {
				deleted = dao.delete(id);
			} catch (PersistenceException e) {
				deleted = false;
				log.error(e.getMessage(), e);
			}
			if (!deleted)
				throw new ServerException("Messages have not been deleted");
		}
	}

}