com.atlassian.confluence.labels
Class Label

java.lang.Object
  extended by com.atlassian.core.bean.EntityObject
      extended by com.atlassian.confluence.labels.Label
All Implemented Interfaces:
Addressable, ContentTypeAware, DisplayableLabel, Serializable, Cloneable, Comparable

public class Label
extends com.atlassian.core.bean.EntityObject
implements Comparable, Addressable, Serializable, DisplayableLabel

See Also:
Serialized Form

Constructor Summary
Label()
           
Label(String name)
           
Label(String name, Namespace namespace)
           
Label(String name, Namespace namespace, String owner)
           
Label(String name, String namespace, String owner)
           
 
Method Summary
 int compareTo(Object o)
           
 boolean equals(Object o)
          Equals implementation is a value based implementation.
 String getDisplayTitle()
           
 String getName()
          Returns the label's name only.
 Namespace getNamespace()
           
 String getOwner()
           
 String getRealTitle()
          Return the title as a combination of the namespace and the label name.
 String getType()
           
 String getUrlPath()
          Generates the url path for a label.
 String getUrlPath(String spaceKey)
          Generates the url path for a label in the context of a given space i.e.
 int hashCode()
           
 boolean isNew()
           
 boolean isPersistent()
          This label is persistent iff the id is not 0.
 boolean isRealTitleSafeForUrl()
          Returns true if the label's title is safe to pass in the URL.
 boolean isTeamLabel()
           
 boolean isVisibleTo(String username)
          Determines whether the label should be made visible to a particular user.
 String toString()
           
 String toStringWithNamespace()
           
 String toStringWithOwnerPrefix()
           
 
Methods inherited from class com.atlassian.core.bean.EntityObject
clone, getCreationDate, getCurrentDate, getId, getLastModificationDate, setClock, setCreationDate, setId, setLastModificationDate
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.atlassian.confluence.core.Addressable
getId
 

Constructor Detail

Label

public Label()

Label

public Label(String name)

Label

public Label(String name,
             Namespace namespace)

Label

public Label(String name,
             String namespace,
             String owner)

Label

public Label(String name,
             Namespace namespace,
             String owner)
Method Detail

getName

public String getName()
Description copied from interface: DisplayableLabel
Returns the label's name only.

eg. label name for label my:foo is "foo".

Specified by:
getName in interface DisplayableLabel

getOwner

public String getOwner()

getNamespace

public Namespace getNamespace()

getType

public String getType()
Specified by:
getType in interface ContentTypeAware
Returns:
the content type

equals

public boolean equals(Object o)
Equals implementation is a value based implementation. It does not take into account the 'persistence' state of this label instance.

Overrides:
equals in class com.atlassian.core.bean.EntityObject
Returns:
true if the specified object is considered value equivalent.

hashCode

public int hashCode()
Overrides:
hashCode in class com.atlassian.core.bean.EntityObject

compareTo

public int compareTo(Object o)
Specified by:
compareTo in interface Comparable

getRealTitle

public String getRealTitle()
Description copied from interface: DisplayableLabel
Return the title as a combination of the namespace and the label name.

Specified by:
getRealTitle in interface DisplayableLabel

getDisplayTitle

public String getDisplayTitle()
Specified by:
getDisplayTitle in interface Addressable
Returns:
the title of the addressable object, suitable for display in a list

isRealTitleSafeForUrl

public boolean isRealTitleSafeForUrl()
Description copied from interface: DisplayableLabel
Returns true if the label's title is safe to pass in the URL.

eg. my:foo is safe, perc% is not safe. chicken+cheese is safe in a "combined" label.

Specified by:
isRealTitleSafeForUrl in interface DisplayableLabel
Returns:
true if the label's title is safe to pass in the URL.

getUrlPath

public String getUrlPath()
Description copied from interface: DisplayableLabel
Generates the url path for a label.

Specified by:
getUrlPath in interface Addressable
Specified by:
getUrlPath in interface DisplayableLabel

getUrlPath

public String getUrlPath(String spaceKey)
Description copied from interface: DisplayableLabel
Generates the url path for a label in the context of a given space i.e. the user is taken to a page that contains content for that space only. If no space if provided, DisplayableLabel.getUrlPath() is called.

Specified by:
getUrlPath in interface DisplayableLabel

isNew

public boolean isNew()

isPersistent

public boolean isPersistent()
This label is persistent iff the id is not 0.

Returns:
true if this instance is a persisted label.

isVisibleTo

public boolean isVisibleTo(String username)
Determines whether the label should be made visible to a particular user. This does not check the permissions on labelled content, you will need to do that separately

Parameters:
username - the username of the user who wishes to see the label
Returns:
true if the user is permitted to see it, false otherwise

toStringWithOwnerPrefix

public String toStringWithOwnerPrefix()

toString

public String toString()
Overrides:
toString in class Object

toStringWithNamespace

public String toStringWithNamespace()

isTeamLabel

public boolean isTeamLabel()


Copyright © 2003-2011 Atlassian. All Rights Reserved.