|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectischool.info340.teamE.Tag
public class Tag
Represents a tag for a place that exists in a storage medium (reprented by a TagManager). Tag objects should directly mirror an item in this medium, but this cannot be guaranteed in environments with multiple theads or instances of the program running.
| Constructor Summary | |
|---|---|
Tag(java.lang.String name,
java.lang.String desc,
int id,
int parentId,
int creatorId,
TagManager manager)
Creates a new instance of Tag with creator and parent loaded when needed |
|
Tag(java.lang.String name,
java.lang.String desc,
int parentId,
int creatorId,
TagManager manager)
Creates a new instance of a Tag, inserting it into the storage medium. |
|
Tag(java.lang.String name,
java.lang.String desc,
int id,
Tag parent,
User creator,
TagManager manager)
Creates a new instance of Tag, automatically adds itself as one of its parents children if it is not one already. |
|
Tag(java.lang.String name,
java.lang.String desc,
Tag parent,
User creator,
TagManager manager)
Creates a new instance of a Tag, inserting it into the storage medium. |
|
| Method Summary | |
|---|---|
boolean |
equals(java.lang.Object other)
|
boolean |
exists()
Returns whether or not this tag exists in the storage medium and can be used. |
java.util.Collection |
getChildren()
|
User |
getCreator()
|
int |
getCreatorId()
|
java.lang.String |
getDesc()
|
int |
getId()
|
java.lang.String |
getName()
|
Tag |
getParent()
|
int |
getParentId()
|
boolean |
hasParent()
|
boolean |
remove()
Removes this tag from the storage medium and prevents it from being used (unless restored) |
boolean |
restore()
Restores a previously removed tag back into the storage medium and marks it as usable again. |
boolean |
update(java.lang.String nName,
java.lang.String nDesc,
int nParentId,
int nCreatorId)
Updates this Tag and saves them to the database |
boolean |
update(java.lang.String nName,
java.lang.String nDesc,
Tag nParent,
User nCreator)
Updates this Tag and saves them to the database |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Tag(java.lang.String name,
java.lang.String desc,
int id,
Tag parent,
User creator,
TagManager manager)
name - Name of the tagdesc - Optional textual description of the tagid - Unique identifier for the tag in the storage mediumcreator - The creator of this tagparent - The parent of this tag if it is not a root tag null otherwisemanager - Manager that connects to the medium this tag is stored in
java.lang.IllegalArgumentException - if name, manager, or creator is null, or if id is less than 0
public Tag(java.lang.String name,
java.lang.String desc,
int id,
int parentId,
int creatorId,
TagManager manager)
name - Name of the tagdesc - Optional textual description of the tagid - Unique identifier for the tag in the storage mediumcreatorId - Id of the creator of this tagparentId - Id of the parent of this tag, -1 if it has no parentmanager - TagManager responsible for dynamically loading parent and creator
java.lang.IllegalArgumentException - if name or manager is null,
or if id or creatorId is less than 0 or if parentId is less than -1
public Tag(java.lang.String name,
java.lang.String desc,
int parentId,
int creatorId,
TagManager manager)
name - Name of the tagdesc - Optional textual description of the tagcreatorId - Id of the creator of this tagparentId - Id of the parent of this tag, -1 if it has no parentmanager - TagManager responsible for dynamically loading parent and creator
and insert this record
java.lang.IllegalArgumentException - if name or manager is null,
or if creatorId is less than 0 or if parentId is less than -1
public Tag(java.lang.String name,
java.lang.String desc,
Tag parent,
User creator,
TagManager manager)
name - Name of the tagdesc - Optional textual description of the tagcreator - The creator of this tagparent - The parent of this tag if it is not a root tag null otherwisemanager - TagManager responsible for dynamically loading parent and creator
and insert this record
java.lang.IllegalArgumentException - if name, creator, or manager is null| Method Detail |
|---|
public boolean equals(java.lang.Object other)
equals in class java.lang.Objectpublic java.lang.String getName()
public java.lang.String getDesc()
public int getId()
public int getCreatorId()
public int getParentId()
public boolean hasParent()
public User getCreator()
public Tag getParent()
public java.util.Collection getChildren()
public boolean exists()
public boolean remove()
public boolean restore()
java.lang.IllegalStateException - if this tag has not been deleted
public boolean update(java.lang.String nName,
java.lang.String nDesc,
int nParentId,
int nCreatorId)
nName - The new name for this tagnDesc - The new description for this tag (null for none)nParentId - The new parent id for this tag (-1 for no parent)nCreatorId - The new creator id for this tag
java.lang.IllegalArgumentException - if nName is null, or if nParentId < -1 or
if nCreatorId < 0
public boolean update(java.lang.String nName,
java.lang.String nDesc,
Tag nParent,
User nCreator)
nName - The new name for this tagnDesc - The new description for this tag (null for none)nParent - The new parent for this tag (null for none)nCreator - The new creator for this tag
java.lang.IllegalArgumentException - if nName, or nCreator is null
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||