com.atlassian.confluence.labels
Class LabelParser

java.lang.Object
  extended by com.atlassian.confluence.labels.LabelParser

public class LabelParser
extends Object

The Label parser understands the formatting of label strings. The following are considered valid label strings.


Field Summary
static char[] INVALID_CHARACTERS
           
static int MAX_LABEL_NAME_LENGTH
           
static int MAX_LABEL_PREFIX_LENGTH
           
static String NAMESPACE_DELIMITER
           
static String PERSONAL_LABEL_PREFIX
           
static String TEAM_LABEL_PREFIX
           
static String USER_LABEL_PREFIX
           
 
Constructor Summary
LabelParser()
           
 
Method Summary
static ParsedLabelName create(Label label)
           
static ParsedLabelName create(String labelName, String userName)
           
static String getInvalidCharactersAsString()
           
static boolean isLabelOwnedByUser(String labelString, com.atlassian.user.User user)
          Returns true if the label is a personal label and is owned by the specified user, false otherwise.
static boolean isPersonalLabel(String labelString)
          Returns true if the label is a personal label, false otherwise.
static boolean isValidLabelLength(ParsedLabelName labelName)
           
static boolean isValidNameLength(ParsedLabelName labelName)
           
static boolean isValidPrefixLength(ParsedLabelName labelName)
           
static ParsedLabelName parse(String labelString)
           
static String render(Label label)
           
static String render(ParsedLabelName parsedLabelName)
           
static String render(ParsedLabelName parsedLabelName, boolean ignoreCurrentUser)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INVALID_CHARACTERS

public static final char[] INVALID_CHARACTERS

MAX_LABEL_NAME_LENGTH

public static final int MAX_LABEL_NAME_LENGTH
See Also:
Constant Field Values

MAX_LABEL_PREFIX_LENGTH

public static final int MAX_LABEL_PREFIX_LENGTH
See Also:
Constant Field Values

PERSONAL_LABEL_PREFIX

public static final String PERSONAL_LABEL_PREFIX
See Also:
Constant Field Values

TEAM_LABEL_PREFIX

public static final String TEAM_LABEL_PREFIX
See Also:
Constant Field Values

NAMESPACE_DELIMITER

public static final String NAMESPACE_DELIMITER
See Also:
Constant Field Values

USER_LABEL_PREFIX

public static final String USER_LABEL_PREFIX
See Also:
Constant Field Values
Constructor Detail

LabelParser

public LabelParser()
Method Detail

isValidLabelLength

public static boolean isValidLabelLength(ParsedLabelName labelName)

isValidNameLength

public static boolean isValidNameLength(ParsedLabelName labelName)

isValidPrefixLength

public static boolean isValidPrefixLength(ParsedLabelName labelName)

isPersonalLabel

public static boolean isPersonalLabel(String labelString)
Returns true if the label is a personal label, false otherwise.

Parameters:
labelString - a string representation of exactly one label, optionally including a namespace. E.g. "my:favourite", "team:confluence" or "blah". Should not be null.
Returns:
true if the label is a personal label, false otherwise.

isLabelOwnedByUser

public static boolean isLabelOwnedByUser(String labelString,
                                         com.atlassian.user.User user)
Returns true if the label is a personal label and is owned by the specified user, false otherwise. Returns false, if the specified labelString is not a personal or user label (as no other label types have user ownership).

Parameters:
labelString - must be user label or personal label
user - user to check against
Returns:
true if the label is a personal label and is owned by the specified user, false otherwise.

parse

public static ParsedLabelName parse(String labelString)

getInvalidCharactersAsString

public static String getInvalidCharactersAsString()

create

public static ParsedLabelName create(String labelName,
                                     String userName)

create

public static ParsedLabelName create(Label label)

render

public static String render(Label label)

render

public static String render(ParsedLabelName parsedLabelName)

render

public static String render(ParsedLabelName parsedLabelName,
                            boolean ignoreCurrentUser)


Copyright © 2003-2011 Atlassian. All Rights Reserved.