ischool.info340.teamE
Interface TagManager

All Known Implementing Classes:
Database

public interface TagManager

Interface for classes responsible for managing things important to Tag objects


Method Summary
 java.util.Collection getAllTags()
           
 java.util.Collection getChildren(int tagId)
          Gets all the children of this tag
 User getCreator(int userId)
          Gets this tag's creator from the storage medium
 java.util.Collection getPlacesWithTag(int tagId)
          Returns all the places with a given tag
 Tag getTag(int tagId)
           
 java.util.Collection getTagsForPlace(int placeId)
          Return all the tags that a given place has been tagged by
 int insertTag(java.lang.String name, java.lang.String desc, int creatorId, int parentId)
          Inserts a new tag into the storage medium
 boolean removeTag(int tagId)
          Removes a tag from the storage medium
 boolean updateTag(int tagId, java.lang.String name, java.lang.String desc, int creatorId, int parentId)
          Updates the value of a tag in the storage medium
 

Method Detail

getTag

Tag getTag(int tagId)
Parameters:
tagId - A unique identifier of a tag in the storage medium
Returns:
A tag from the storage medium coorisponding to tagId, null if no matching tag can be found.

getAllTags

java.util.Collection getAllTags()
Returns:
A collection of all tag objects from the storage medium, or null if there was an error

insertTag

int insertTag(java.lang.String name,
              java.lang.String desc,
              int creatorId,
              int parentId)
Inserts a new tag into the storage medium

Parameters:
name - The name for this tag
desc - Optional description for this tag, null if ommitted.
creatorId - Id of the user who created this tag
parentId - Id of the parent of this tag, or -1 for no parent.
Returns:
The id of the newly inserted tag or -1 if there was an error

updateTag

boolean updateTag(int tagId,
                  java.lang.String name,
                  java.lang.String desc,
                  int creatorId,
                  int parentId)
Updates the value of a tag in the storage medium

Parameters:
tagId - The tag to be updated
name - The new name for this tag
desc - The new description for this tag, null for no description
creatorId - The new id for user that created this tag
parentId - The new parent id for this tag (or -1 fo no parent)
Returns:
true if this operation succedes, false otherwise

removeTag

boolean removeTag(int tagId)
Removes a tag from the storage medium

Parameters:
tagId - The tag to remove
Returns:
True if the tag was successfully removed, false otherwise.

getChildren

java.util.Collection getChildren(int tagId)
Gets all the children of this tag

Parameters:
tagId - Id of the tag whose children should be retrieved
Returns:
A collection of all this tags immediate children

getCreator

User getCreator(int userId)
Gets this tag's creator from the storage medium

Parameters:
userId - The id of the user to retrieve
Returns:
The user retrieved from the storage medium

getPlacesWithTag

java.util.Collection getPlacesWithTag(int tagId)
Returns all the places with a given tag

Parameters:
tagId - the tagId to retrieve places for
Returns:
A collection of Place objects, null if there is an error

getTagsForPlace

java.util.Collection getTagsForPlace(int placeId)
Return all the tags that a given place has been tagged by

Parameters:
placeId - the place to get tags for
Returns:
a collection of Tag objects or null if there is an error