diff -r f907866f0e4b -r 6fceb66e1ad7 trunk/com/so/news/storage/Group.java
--- a/trunk/com/so/news/storage/Group.java Tue Jan 20 10:21:03 2009 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,142 +0,0 @@
-/*
- * StarOffice News Server
- * see AUTHORS for the list of contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-package com.so.news.storage;
-
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.List;
-import com.so.news.Debug;
-
-/**
- * Represents a logical Group within this newsserver.
- * @author Christian Lins
- */
-public class Group
-{
- private long id;
- private String name;
-
- /**
- * Private constructor.
- * @param name
- * @param id
- */
- Group(String name, long id)
- {
- this.id = id;
- this.name = name;
- }
-
- /**
- * Returns a Group identified by its full name.
- * @param name
- * @return
- */
- public static Group getByName(String name)
- {
- try
- {
- return Database.getInstance().getGroup(name);
- }
- catch(SQLException ex)
- {
- System.err.println(ex.getLocalizedMessage());
- ex.printStackTrace(Debug.getInstance().getStream());
- return null;
- }
- }
-
- /**
- * Returns a list of all groups this server handles.
- * @return
- */
- public static ArrayList getAll()
- {
- ArrayList buffer = new ArrayList();
-
- try
- {
- ResultSet rs = Database.getInstance().getGroups();
-
- while(rs.next())
- {
- String name = rs.getString("name");
- long id = rs.getLong("group_id");
-
- Group group = new Group(name, id);
- buffer.add(group);
- }
- }
- catch(SQLException ex)
- {
- ex.printStackTrace(Debug.getInstance().getStream());
- System.err.println(ex.getLocalizedMessage());
- }
-
- return buffer;
- }
-
- public List getAllArticles()
- throws SQLException
- {
- return getAllArticles(getFirstArticle(), getLastArticle());
- }
-
- public List getAllArticles(int first, int last)
- {
- return null;
- }
-
- public int getFirstArticle()
- throws SQLException
- {
- return Database.getInstance().getFirstArticleNumber(this);
- }
-
- public long getID()
- {
- return id;
- }
-
- public int getLastArticle()
- throws SQLException
- {
- return Database.getInstance().getLastArticleNumber(this);
- }
-
- public String getName()
- {
- return name;
- }
-
- public void setName(String name)
- {
- this.name = name;
- }
-
- public int getEstimatedArticleCount()
- throws SQLException
- {
- if (getLastArticle() < getFirstArticle())
- return 0;
- return getLastArticle() - getFirstArticle() + 1;
- }
-
-}