com.flexive.shared
Class FxPhraseTreeNode

java.lang.Object
  extended by com.flexive.shared.FxPhraseTreeNode
All Implemented Interfaces:
java.io.Serializable

public class FxPhraseTreeNode
extends java.lang.Object
implements java.io.Serializable

A phrase tree node

Since:
3.2.0
Author:
Markus Plesser (markus.plesser@ucs.at), UCS - unique computing solutions gmbh (http://www.ucs.at)
See Also:
Serialized Form

Field Summary
static long NOT_SET
           
 
Constructor Summary
FxPhraseTreeNode(long id, long mandatorId, int category, long parentNodeId, long parentNodeMandatorId, FxPhrase phrase, java.util.List<FxPhraseTreeNode> children)
           
FxPhraseTreeNode(long id, long mandatorId, int category, long parentNodeId, long parentNodeMandatorId, java.lang.String phraseKey, long phraseMandator, java.util.List<FxPhraseTreeNode> children)
           
FxPhraseTreeNode(long id, long mandatorId, long parentNodeId, long parentNodeMandatorId, FxPhrase phrase, java.util.List<FxPhraseTreeNode> children)
           
FxPhraseTreeNode(long id, long mandatorId, long parentNodeId, long parentNodeMandatorId, java.lang.String phraseKey, long phraseMandator, java.util.List<FxPhraseTreeNode> children)
           
 
Method Summary
 void assignPhrase(java.lang.String phraseKey)
          Assign a phrase of the calling users mandator to this node.
 void assignPhrase(java.lang.String phraseKey, long phraseMandator)
          Assign a phrase to this node.
static FxPhraseTreeNode createChildNode(FxPhraseTreeNode parent, FxPhrase phrase)
           
static FxPhraseTreeNode createChildNode(FxPhraseTreeNode parent, long nodeMandator, FxPhrase phrase)
           
static FxPhraseTreeNode createChildNode(FxPhraseTreeNode parent, long nodeMandator, java.lang.String phraseKey, long phraseMandator)
          Create a child node
static FxPhraseTreeNode createChildNode(FxPhraseTreeNode parent, java.lang.String phraseKey)
          Create a child node for the callers mandator (not persisted!)
static FxPhraseTreeNode createChildNode(FxPhraseTreeNode parent, java.lang.String phraseKey, long phraseMandator)
           
static FxPhraseTreeNode createRootNode(int category, java.lang.String phraseKey)
          Create a root node for the callers mandator (not persisted!)
static FxPhraseTreeNode createRootNode(long nodeMandator, int category, java.lang.String phraseKey, long phraseMandator)
          Create a new root node (not persisted!)
static FxPhraseTreeNode createRootNode(long nodeMandator, java.lang.String phraseKey, long phraseMandator)
          Create a new root node (not persisted!)
static FxPhraseTreeNode createRootNode(java.lang.String phraseKey)
          Create a root node for the callers mandator (not persisted!)
 boolean equals(java.lang.Object obj)
          
 int getCategory()
           
 java.util.List<FxPhraseTreeNode> getChildren()
           
 long getId()
           
 long getMandatorId()
           
 long getParentNodeId()
           
 long getParentNodeMandatorId()
           
 FxPhrase getPhrase()
           
 long getPos()
           
 boolean hasChildren()
           
 boolean hasParent()
           
 boolean hasPos()
           
 boolean isNew()
          Is this a new tree node?
 boolean isRootNode()
           
 FxPhraseTreeNode save()
          Save or create this node
 void setChildren(java.util.List<FxPhraseTreeNode> children)
           
 void setId(long id)
           
 FxPhraseTreeNode setPhrase(FxPhrase phrase)
          Set the phrase
 FxPhraseTreeNode setPhrase(java.lang.String phraseKey, long phraseMandator)
          Set the phrase key and mandator
 FxPhraseTreeNode setPhraseKey(java.lang.String phraseKey)
          Set the phrase key (does not change the phrase mandator!)
 FxPhraseTreeNode setPos(long pos)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NOT_SET

public static final long NOT_SET
See Also:
Constant Field Values
Constructor Detail

FxPhraseTreeNode

public FxPhraseTreeNode(long id,
                        long mandatorId,
                        long parentNodeId,
                        long parentNodeMandatorId,
                        FxPhrase phrase,
                        java.util.List<FxPhraseTreeNode> children)

FxPhraseTreeNode

public FxPhraseTreeNode(long id,
                        long mandatorId,
                        int category,
                        long parentNodeId,
                        long parentNodeMandatorId,
                        FxPhrase phrase,
                        java.util.List<FxPhraseTreeNode> children)

FxPhraseTreeNode

public FxPhraseTreeNode(long id,
                        long mandatorId,
                        long parentNodeId,
                        long parentNodeMandatorId,
                        java.lang.String phraseKey,
                        long phraseMandator,
                        java.util.List<FxPhraseTreeNode> children)
                 throws FxNotFoundException
Throws:
FxNotFoundException

FxPhraseTreeNode

public FxPhraseTreeNode(long id,
                        long mandatorId,
                        int category,
                        long parentNodeId,
                        long parentNodeMandatorId,
                        java.lang.String phraseKey,
                        long phraseMandator,
                        java.util.List<FxPhraseTreeNode> children)
                 throws FxNotFoundException
Throws:
FxNotFoundException
Method Detail

createRootNode

public static FxPhraseTreeNode createRootNode(java.lang.String phraseKey)
                                       throws FxNotFoundException
Create a root node for the callers mandator (not persisted!)

Parameters:
phraseKey - phrase key (referencing the callers mandator)
Returns:
FxPhraseTreeNode
Throws:
FxNotFoundException - if the phrase does not exist

createRootNode

public static FxPhraseTreeNode createRootNode(int category,
                                              java.lang.String phraseKey)
                                       throws FxNotFoundException
Create a root node for the callers mandator (not persisted!)

Parameters:
category - phrase category
phraseKey - phrase key (referencing the callers mandator)
Returns:
FxPhraseTreeNode
Throws:
FxNotFoundException - if the phrase does not exist

createRootNode

public static FxPhraseTreeNode createRootNode(long nodeMandator,
                                              java.lang.String phraseKey,
                                              long phraseMandator)
                                       throws FxNotFoundException
Create a new root node (not persisted!)

Parameters:
nodeMandator - node mandator
phraseKey - phrase key
phraseMandator - mandator of the phrase
Returns:
FxPhraseTreeNode
Throws:
FxNotFoundException - if the phrase does not exist

createRootNode

public static FxPhraseTreeNode createRootNode(long nodeMandator,
                                              int category,
                                              java.lang.String phraseKey,
                                              long phraseMandator)
                                       throws FxNotFoundException
Create a new root node (not persisted!)

Parameters:
nodeMandator - node mandator
category - phrase category
phraseKey - phrase key
phraseMandator - mandator of the phrase
Returns:
FxPhraseTreeNode
Throws:
FxNotFoundException - if the phrase does not exist

createChildNode

public static FxPhraseTreeNode createChildNode(FxPhraseTreeNode parent,
                                               java.lang.String phraseKey)
                                        throws FxNotFoundException
Create a child node for the callers mandator (not persisted!)

Parameters:
parent - parent node
phraseKey - phrase key (referencing the callers mandator)
Returns:
FxPhraseTreeNode
Throws:
FxNotFoundException - if the phrase does not exist

createChildNode

public static FxPhraseTreeNode createChildNode(FxPhraseTreeNode parent,
                                               java.lang.String phraseKey,
                                               long phraseMandator)
                                        throws FxNotFoundException
Throws:
FxNotFoundException

createChildNode

public static FxPhraseTreeNode createChildNode(FxPhraseTreeNode parent,
                                               FxPhrase phrase)

createChildNode

public static FxPhraseTreeNode createChildNode(FxPhraseTreeNode parent,
                                               long nodeMandator,
                                               FxPhrase phrase)

createChildNode

public static FxPhraseTreeNode createChildNode(FxPhraseTreeNode parent,
                                               long nodeMandator,
                                               java.lang.String phraseKey,
                                               long phraseMandator)
                                        throws FxNotFoundException
Create a child node

Parameters:
parent - parent node
nodeMandator - mandator of the new node
phraseKey - phrase key to use
phraseMandator - mandator of the phrase
Returns:
FxPhraseTreeNode
Throws:
FxNotFoundException - if the phrase does not exist

isNew

public boolean isNew()
Is this a new tree node?

Returns:
new tree node

setId

public void setId(long id)

getId

public long getId()
Returns:
id

getMandatorId

public long getMandatorId()
Returns:
mandator id

getCategory

public int getCategory()
Returns:
category id

setPhraseKey

public FxPhraseTreeNode setPhraseKey(java.lang.String phraseKey)
                              throws FxNotFoundException
Set the phrase key (does not change the phrase mandator!)

Parameters:
phraseKey - phrase key
Returns:
FxPhraseTreeNode
Throws:
FxNotFoundException - if the phrase does not exist

setPhrase

public FxPhraseTreeNode setPhrase(java.lang.String phraseKey,
                                  long phraseMandator)
                           throws FxNotFoundException
Set the phrase key and mandator

Parameters:
phraseKey - phrase key
phraseMandator - phrase mandator
Returns:
FxPhraseTreeNode
Throws:
FxNotFoundException - if the phrase does not exist

setPhrase

public FxPhraseTreeNode setPhrase(FxPhrase phrase)
Set the phrase

Parameters:
phrase - phrase to set
Returns:
FxPhraseTreeNode

getPhrase

public FxPhrase getPhrase()
Returns:
used phrase

getParentNodeId

public long getParentNodeId()
Returns:
parent node id unless its a root node

isRootNode

public boolean isRootNode()
Returns:
is this a root node?

hasParent

public boolean hasParent()
Returns:
does a parent node exist?

getParentNodeMandatorId

public long getParentNodeMandatorId()
Returns:
mandator of the parent node

getChildren

public java.util.List<FxPhraseTreeNode> getChildren()
Returns:
child nodes of this node (only available if loaded)

setChildren

public void setChildren(java.util.List<FxPhraseTreeNode> children)

hasChildren

public boolean hasChildren()
Returns:
do child nodes exist?

getPos

public long getPos()

setPos

public FxPhraseTreeNode setPos(long pos)

hasPos

public boolean hasPos()

save

public FxPhraseTreeNode save()
                      throws FxNoAccessException,
                             FxNotFoundException
Save or create this node

Returns:
FxPhraseTreeNode
Throws:
FxNoAccessException - if trying to save for other mandators
FxNotFoundException - if a phrase key was not found

assignPhrase

public void assignPhrase(java.lang.String phraseKey)
                  throws FxNotFoundException,
                         FxEntryExistsException,
                         FxNoAccessException
Assign a phrase of the calling users mandator to this node. If this node is new it will be created

Parameters:
phraseKey - phrase key
Throws:
FxNotFoundException - if the phrase was not found
FxEntryExistsException - if the same phrase is already assigned
FxNoAccessException - if this a new node and the calling user may not save it

assignPhrase

public void assignPhrase(java.lang.String phraseKey,
                         long phraseMandator)
                  throws FxNotFoundException,
                         FxEntryExistsException,
                         FxNoAccessException
Assign a phrase to this node. If this node is new it will be created

Parameters:
phraseKey - phrase key
phraseMandator - mandator of the phrase
Throws:
FxNotFoundException - if the phrase was not found
FxEntryExistsException - if the same phrase is already assigned
FxNoAccessException - if this a new node and the calling user may not save it

equals

public boolean equals(java.lang.Object obj)

Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object