org.qsos.data
Class Element

java.lang.Object
  extended by org.qsos.data.Element
All Implemented Interfaces:
IElement

public class Element
extends java.lang.Object
implements IElement

This class is the reference implementation of the IElement interface. It basicly act as a Java Bean for the model of an O3S sheet line. This model is that each line as four datas : meta, text, name and title. Meta is the xml tag, name and title are attributes and text is the text inside a tag. This leads to the point that one Element, the root Element contains all the others just like in a xml file.

For technical purpore this object has more property. It has a id property which his id in the datasource( if any)

Aside from this technical property, the JavaBean, has a reference to his container, which is an another IElement which contains this Element, and a list of sub-IElement which it contains itself.

see O3S Documentation.

Author:
Romain Pelisse , Arthur Clerfeuille

Constructor Summary
Element()
           Allows to initialize the class.
Element(java.lang.Long id, java.lang.String meta, java.lang.String name, java.lang.String title, java.lang.String text, java.util.List<IElement> list, IElement elem)
          Allow to construct the value of every attribute of the class.
 
Method Summary
 IElement addElement(IElement item)
          Allow to add item to the list of sub element
 void delElement(IElement item)
          Allow to delete an item from the list of sub element delete all the children
 java.lang.String getComment()
           
 IElement getContainer()
          Return an IElement which represents the parent of the current Element.
 java.lang.String getDesc()
           
 java.lang.String getDesc0()
           
 java.lang.String getDesc1()
           
 java.lang.String getDesc2()
           
 java.util.List<IElement> getElements()
          Return a List of IElement which represents all the children of the current Element.
 java.lang.Long getId()
          Returns the id of the Element.
 java.lang.String getMeta()
          Return the meta in the Element.
 java.lang.String getName()
          Return the name in the Element.
 java.lang.String getScore()
           
 java.lang.String getText()
          Return the text in the Element.
 java.lang.String getTitle()
          Return the name in the Element.
 void setComment(java.lang.String comment)
           
 void setContainer(IElement element)
          Allow to set the container (the parent of an Element).
 void setDesc(java.lang.String desc)
           
 void setDesc0(java.lang.String desc0)
           
 void setDesc1(java.lang.String desc1)
           
 void setDesc2(java.lang.String desc2)
           
 void setElements(java.util.List<IElement> elements)
          Allow to set the children of the current Element.
 void setId(java.lang.Long id)
          Allows to set the id of the Element.
 void setMeta(java.lang.String meta)
          Allows to set the meta of the Element.
 void setName(java.lang.String name)
          Allows to set the name of the Element.
 void setScore(java.lang.String score)
           
 void setText(java.lang.String text)
          Allows to set the text of the Element.
 void setTitle(java.lang.String title)
          Allows to set the title of the Element.
 java.lang.String toString()
           Returns a string representation of the Element
 java.lang.String tree()
          Return a string version of the Element and its childs.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Element

public Element()

Allows to initialize the class.


Element

public Element(java.lang.Long id,
               java.lang.String meta,
               java.lang.String name,
               java.lang.String title,
               java.lang.String text,
               java.util.List<IElement> list,
               IElement elem)

Allow to construct the value of every attribute of the class.

Parameters:
id - the id to set.
meta - the meta to set.
name - the name to set.
title - the title to set.
text - the text to set.
list - the list to set as elements.
elem - the elem toset as container.
Method Detail

getId

public java.lang.Long getId()

Returns the id of the Element.

Specified by:
getId in interface IElement
Returns:
Returns a Long which is the id.

setId

public void setId(java.lang.Long id)

Allows to set the id of the Element.

Specified by:
setId in interface IElement
Parameters:
id - The id to set.

getMeta

public java.lang.String getMeta()
Return the meta in the Element.

Specified by:
getMeta in interface IElement
Returns:
Returns a String which is the meta.

setMeta

public void setMeta(java.lang.String meta)

Allows to set the meta of the Element.

Specified by:
setMeta in interface IElement
Parameters:
meta - the meta to set.

getName

public java.lang.String getName()
Return the name in the Element.

Specified by:
getName in interface IElement
Returns:
Returns a String which is the name.

setName

public void setName(java.lang.String name)

Allows to set the name of the Element.

Specified by:
setName in interface IElement
Parameters:
name - the name to set.

getTitle

public java.lang.String getTitle()
Return the name in the Element.

Specified by:
getTitle in interface IElement
Returns:
Returns a String which is the name.

setTitle

public void setTitle(java.lang.String title)

Allows to set the title of the Element.

Specified by:
setTitle in interface IElement
Parameters:
title - the title to set.

getText

public java.lang.String getText()
Return the text in the Element.

Specified by:
getText in interface IElement
Returns:
Returns a String which is the text.

setText

public void setText(java.lang.String text)

Allows to set the text of the Element.

Specified by:
setText in interface IElement
Parameters:
text - the text to set.

getElements

public java.util.List<IElement> getElements()

Return a List of IElement which represents all the children of the current Element.

Specified by:
getElements in interface IElement
Returns:
Returns the list of the sub elements.

setElements

public void setElements(java.util.List<IElement> elements)

Allow to set the children of the current Element.

Specified by:
setElements in interface IElement
Parameters:
elements - The List of Elements to set.

getContainer

public IElement getContainer()

Return an IElement which represents the parent of the current Element.

Specified by:
getContainer in interface IElement
Returns:
Returns the container.

setContainer

public void setContainer(IElement element)

Allow to set the container (the parent of an Element).

Specified by:
setContainer in interface IElement
Parameters:
element - the IElement to set as container of the current Element.

setDesc

public void setDesc(java.lang.String desc)
Specified by:
setDesc in interface IElement

getDesc

public java.lang.String getDesc()
Specified by:
getDesc in interface IElement

setDesc0

public void setDesc0(java.lang.String desc0)
Specified by:
setDesc0 in interface IElement

getDesc0

public java.lang.String getDesc0()
Specified by:
getDesc0 in interface IElement

setDesc1

public void setDesc1(java.lang.String desc1)
Specified by:
setDesc1 in interface IElement

getDesc1

public java.lang.String getDesc1()
Specified by:
getDesc1 in interface IElement

setDesc2

public void setDesc2(java.lang.String desc2)
Specified by:
setDesc2 in interface IElement

getDesc2

public java.lang.String getDesc2()
Specified by:
getDesc2 in interface IElement

setComment

public void setComment(java.lang.String comment)
Specified by:
setComment in interface IElement

getComment

public java.lang.String getComment()
Specified by:
getComment in interface IElement

setScore

public void setScore(java.lang.String score)
              throws java.io.IOException
Specified by:
setScore in interface IElement
Throws:
java.io.IOException

getScore

public java.lang.String getScore()
Specified by:
getScore in interface IElement

addElement

public IElement addElement(IElement item)

Allow to add item to the list of sub element

Specified by:
addElement in interface IElement
Parameters:
item - the IElement to add to the children of this object.
Returns:
the added element.

delElement

public void delElement(IElement item)

Allow to delete an item from the list of sub element delete all the children

Specified by:
delElement in interface IElement
Parameters:
item - the IElement to delete to the children of this object.

toString

public java.lang.String toString()

Returns a string representation of the Element

Specified by:
toString in interface IElement
Overrides:
toString in class java.lang.Object
Returns:
Returns a string representation of the Element.

tree

public java.lang.String tree()

Return a string version of the Element and its childs. This method is designed to ease unit test and debug and is not to be used for anything else.

Specified by:
tree in interface IElement
Returns:
string version of the Element.