de.folt.models.documentmodel.tbx
Class TbxDocument

java.lang.Object
  extended by java.util.Observable
      extended by de.folt.models.documentmodel.document.XmlDocument
          extended by de.folt.models.documentmodel.tbx.TbxDocument
All Implemented Interfaces:
java.io.Serializable

public class TbxDocument
extends XmlDocument

This class implements a tbx based data source

Author:
klemens
See Also:
Serialized Form

Constructor Summary
TbxDocument()
           
 
Method Summary
 boolean bGenerateIds()
           
 java.lang.String bGenerateIds(java.lang.String tbxfile)
          Generate ids for all missing ids in a tbx file
 java.lang.String bGenerateIds(java.lang.String tbxfile, java.lang.String outtbxfile)
          Generate ids for all missing ids in a tbx file
 boolean createDocument(java.lang.String xmlDocumentName)
          createDocument creates an xml document; must be overridden by subclass
 int getErrorCode()
           
 org.jdom.Element getTbxBody()
           
 org.jdom.Element getTbxHeader()
          getTbxHeader
 java.lang.String getTbxVersion()
          getTbxVersion get the TBX version of the tmx document
 java.util.List<org.jdom.Element> getTermEntryList()
          getTermEntryList
 java.lang.String getVersion()
           
 org.jdom.Document loadXmlFile(java.io.File newFile)
          loadXmlFile loads an XML file
 org.jdom.Document loadXmlFile(java.lang.String filename)
          loadXmlFile loads an XML file as a document
static void main(java.lang.String[] args)
          main
 void setErrorCode(int errorCode)
           
 void setTbxBody(org.jdom.Element tbxBody)
           
 void setTbxHeader(org.jdom.Element tbxHeader)
           
 void setVersion(java.lang.String version)
           
 MultiLingualObject termEntryToMultiLingualObject(org.jdom.Element termEntry)
          tuToMultiLingualObject converts a given tu element into a MultiLingualObject
 MonoLingualObject tigToMonoLingualObject(org.jdom.Element tig, java.lang.String language)
          tuvToMonoLingualObject converts a given tuv element into a MonoLingualObject
 
Methods inherited from class de.folt.models.documentmodel.document.XmlDocument
bIsXmlDocument, bIsXmLFile, buildElement, elementContentToString, elementContentToString, elementToString, getCatalogueDirectory, getDocument, getNamespace, getNamespacelist, getRoot, getRootElementName, getRootElementName, getsubElementFromElementAttributeNameValue, getsubElementFromElementAttributeNameValueRegExp, getXmlDocumentName, getXmlOutputter, getXmlURL, isBExpandExternalEntities, isValidElement, quoteXMLString, saveToXmlFile, saveToXmlFile, saveToXmlFile, setBExpandExternalEntities, setCatalogueDirectory, setDocument, setNamespace, setNamespacelist, setXmlDocumentName, setXmlURL
 
Methods inherited from class java.util.Observable
addObserver, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TbxDocument

public TbxDocument()
Method Detail

main

public static void main(java.lang.String[] args)
main

Parameters:
args -

bGenerateIds

public boolean bGenerateIds()

bGenerateIds

public java.lang.String bGenerateIds(java.lang.String tbxfile)
Generate ids for all missing ids in a tbx file

Parameters:
tbxfile - tbx file to generate ids for
Returns:
output tbx file generates as tbxfile + ".id.tbx"

bGenerateIds

public java.lang.String bGenerateIds(java.lang.String tbxfile,
                                     java.lang.String outtbxfile)
Generate ids for all missing ids in a tbx file

Parameters:
tbxfile - tbxfile tbx file to generate ids for
outtbxfile - output tbx file
Returns:
output tbx file

createDocument

public boolean createDocument(java.lang.String xmlDocumentName)
Description copied from class: XmlDocument
createDocument creates an xml document; must be overridden by subclass

Overrides:
createDocument in class XmlDocument
Parameters:
xmlDocumentName - the document to create
Returns:
true in case of success, otherwise false

getErrorCode

public int getErrorCode()

getTbxBody

public org.jdom.Element getTbxBody()

getTbxHeader

public org.jdom.Element getTbxHeader()
getTbxHeader

Returns:
the header of the TMX document

getTbxVersion

public java.lang.String getTbxVersion()
getTbxVersion get the TBX version of the tmx document

Returns:
the TBX version of the document

getTermEntryList

public java.util.List<org.jdom.Element> getTermEntryList()
getTermEntryList

Returns:

loadXmlFile

public org.jdom.Document loadXmlFile(java.io.File newFile)
Description copied from class: XmlDocument
loadXmlFile loads an XML file

Overrides:
loadXmlFile in class XmlDocument
Parameters:
newFile - the File of the XML File
Returns:
the document loaded / null if file does not exist or is not an xml file

loadXmlFile

public org.jdom.Document loadXmlFile(java.lang.String filename)
Description copied from class: XmlDocument
loadXmlFile loads an XML file as a document

Overrides:
loadXmlFile in class XmlDocument
Parameters:
filename - the file name of the XML file
Returns:
the Document loaded

setErrorCode

public void setErrorCode(int errorCode)

setTbxBody

public void setTbxBody(org.jdom.Element tbxBody)
Parameters:
tbxBody - the tbxBody to set

setTbxHeader

public void setTbxHeader(org.jdom.Element tbxHeader)
Parameters:
tbxHeader - the tbxHeader to set

termEntryToMultiLingualObject

public MultiLingualObject termEntryToMultiLingualObject(org.jdom.Element termEntry)
tuToMultiLingualObject converts a given tu element into a MultiLingualObject

Parameters:
tu - the tu Element
Returns:
the MultiLingualObject for the given tu

tigToMonoLingualObject

public MonoLingualObject tigToMonoLingualObject(org.jdom.Element tig,
                                                java.lang.String language)
tuvToMonoLingualObject converts a given tuv element into a MonoLingualObject

Parameters:
tuv - the tuv Element
Returns:
the MonoLingualObject for the given tuv

getVersion

public java.lang.String getVersion()

setVersion

public void setVersion(java.lang.String version)