model
Class Folder

java.lang.Object
  extended by model.Folder

public class Folder
extends java.lang.Object

Folder class represents a folder that can contain other folders and feeds. There is a special case when a folder can contain articles (the trash folder). How that is implemented is likely to change dramatically.

Author:
pgroudas

Field Summary
private  int id
           
private  int parentid
           
private  java.lang.String title
           
 
Constructor Summary
Folder(int id, int parentid, java.lang.String title)
          Constructor for creating a folder from the database, when the ID of its parent and the ID of itself and its title are all known.
Folder(java.lang.String title)
          "Small" constructor used by the GUI to add folders.
 
Method Summary
 int getId()
          Gets the folder's id, if it was generated with an id; otherwise throws an error.
 int getParentId()
          Gets the id of the folder's parent, if it available.
 java.lang.String getTitle()
          Gets the folder's title.
(package private) static boolean isSame(Folder f1, Folder f2)
          Tests if two folders represent the same folder.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

id

private int id

parentid

private int parentid

title

private java.lang.String title
Constructor Detail

Folder

public Folder(int id,
              int parentid,
              java.lang.String title)
Constructor for creating a folder from the database, when the ID of its parent and the ID of itself and its title are all known. If title should happen to be null (quite odd), sets to "".

Parameters:
id -
parentid -
title -

Folder

public Folder(java.lang.String title)
"Small" constructor used by the GUI to add folders. Here the title is the only explicitly set parameter; id and parentid default to 0.

Parameters:
title -
Method Detail

isSame

static boolean isSame(Folder f1,
                      Folder f2)
Tests if two folders represent the same folder. Folders which have the same id are "the same" (name equivelance is not sufficient, since two folders with the same name can exist if they have different parents.) Note that this can only be used reliably on two folders created by the database, since otherwise two folders created with the "small" constructor might have the same id (0).

Parameters:
f1 - Folder
f2 - Folder
Returns:
boolean

getTitle

public java.lang.String getTitle()
Gets the folder's title. This should never be null (only "" if a null title was supplied).

Returns:
String title

getId

public int getId()
Gets the folder's id, if it was generated with an id; otherwise throws an error.

Returns:
int ID
Throws:
java.lang.IllegalAccessError - If the folder has no id (it was made and not taken from the database), throws an illegal access error.

getParentId

public int getParentId()
Gets the id of the folder's parent, if it available.

Returns:
int parentid
Throws:
java.lang.IllegalAccessError - If the folder has no parentid (it was made and not taken from the database), throws an illegal access error.