|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--de.janicke.hj.tools.servlet.AbstractVocAdmin | +--de.janicke.hj.tools.servlet.SimpleVocAdmin
Handles the vocable administration with a Database.
Constructor Summary | |
SimpleVocAdmin(Database database)
Constructor sets the Database. |
Method Summary | |
boolean |
addLanguage(User user,
java.lang.String languagename)
Adds a language to the database. |
boolean |
addUnit(User user,
java.lang.String unitname)
Adds a unit to the database. |
boolean |
addVocable(Vocable vocableSet,
User user)
Adds a vocable object in the database with the owner given by the userId of the user. |
boolean |
checkVocable(Vocable vocable,
int modus)
Checks if the vocable is in the database. |
boolean |
delLanguage(User user,
int languageId)
Deletes a language from the database. |
boolean |
delUnit(User user,
int unitId)
Deletes a unit specified by unitId from the database. |
boolean |
delVocable(Vocable vocable,
User user)
Deletes a record of the database selected by the vocId of the vocable-object. |
boolean |
editVocable(Vocable vocableSet,
boolean status,
User user)
Edits the state of a record in the database selected by the vocId of the vocable object. |
boolean |
editVocable(Vocable vocableSet,
User user)
Edits a record of the database selected by the vocId of the vocable object. |
java.util.Vector |
getAllLanguages()
Returns a vector of all languages defined in the database. |
java.util.Vector |
getAllUnitNames()
Gets all unitnames specified in the database. |
int |
getLanguageIdByLanguagename(java.lang.String languagename)
Returns the id of the language from the database. |
java.util.Vector |
getResultSet(User user,
int lang1,
int lang2,
java.lang.String date)
Returns a vector of vocable objects from the database, where userId and languages, given by the languageId, equals with the database. |
int |
getUnitIdByUnitName(java.lang.String unitName)
Gets the UnitId by looking for the unitname in the Database. |
Vocable |
getVocable(int vocId)
Returns the vocable object specified by the vocId. |
Vocable |
getVocable(User user,
int langId1,
int langId2,
int modus,
java.lang.String date,
int unitId)
Returns a vocable object from a user out of the database. |
Vocable |
getVocableFromResultSetByDateRandomly(java.util.Vector resultSet)
Returns a vocable object from a vector of vocable object, choosen randomly by an algorithmen using the date of the vocable object. |
Vocable |
getVocableFromResultSetByStateRandomly(java.util.Vector resultSet)
Returns a vocable object from a vector of vocable object, choosen randomly by an algorithmen using the state of the vocable object. |
Vocable |
getVocableFromResultSetRandomly(java.util.Vector resultSet)
Returns a vocable object from a vector of vocable object, choosen randomly. |
void |
init()
Initializes the database. |
Methods inherited from class de.janicke.hj.tools.servlet.AbstractVocAdmin |
delLanguage, delUnit, getResultSet, getResultSet, getResultSet, getVocable, getVocable |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface de.janicke.hj.tools.servlet.VocAdmin |
delLanguage, delUnit, getResultSet, getResultSet, getResultSet, getVocable, getVocable |
Constructor Detail |
public SimpleVocAdmin(Database database)
database
- The used Database.Method Detail |
public void init() throws java.lang.Exception
init
in interface VocAdmin
init
in class AbstractVocAdmin
java.lang.Exception
- if there is no connect to the database, or the precompile of SQL statements fails.public Vocable getVocable(User user, int langId1, int langId2, int modus, java.lang.String date, int unitId) throws java.lang.IllegalArgumentException, java.sql.SQLException
VocAdmin
getVocable
in interface VocAdmin
getVocable
in class AbstractVocAdmin
de.janicke.hj.tools.servlet.VocAdmin
user
- The owner of the vocables.langId1
- The source language.langId2
- The destination language to translate to.modus
- The mode that determines how to get the vocabluaries.date
- The oldest date to get the vocabluaries from.unitid
- The unit id to get the vocabluaries from.public Vocable getVocable(int vocId) throws java.sql.SQLException
getVocable
in interface VocAdmin
getVocable
in class AbstractVocAdmin
vocId
- The primary key of the vocable table in the database.user
- The owner of the vocable.java.sql.SQLException
- if data couldn't be retrieved from the database.public Vocable getVocableFromResultSetRandomly(java.util.Vector resultSet) throws java.sql.SQLException
getVocableFromResultSetRandomly
in interface VocAdmin
getVocableFromResultSetRandomly
in class AbstractVocAdmin
resultSet
- A vector of vocable objects.java.sql.SQLException
- if data couldn't be retrieved from the database.public Vocable getVocableFromResultSetByStateRandomly(java.util.Vector resultSet) throws java.sql.SQLException
getVocableFromResultSetByStateRandomly
in interface VocAdmin
getVocableFromResultSetByStateRandomly
in class AbstractVocAdmin
resultSet
- A vector of vocable objects.java.sql.SQLException
- if data couldn't be retrieved from the database.public Vocable getVocableFromResultSetByDateRandomly(java.util.Vector resultSet) throws java.sql.SQLException
getVocableFromResultSetByDateRandomly
in interface VocAdmin
getVocableFromResultSetByDateRandomly
in class AbstractVocAdmin
resultSet
- A set of vocable objects.java.sql.SQLException
- if data couldn't be retrieved from the database.public java.util.Vector getResultSet(User user, int lang1, int lang2, java.lang.String date) throws java.sql.SQLException
getResultSet
in interface VocAdmin
getResultSet
in class AbstractVocAdmin
user
- A User-Object.lang1
- LanguageId of Vocable1.lang2
- LanguageId of Vocable2.java.sql.SQLException
- if data couldn't be retrieved from the database.public boolean checkVocable(Vocable vocable, int modus) throws java.lang.IllegalArgumentException, java.sql.SQLException
checkVocable
in interface VocAdmin
checkVocable
in class AbstractVocAdmin
vocable
- The Vocable-Object to check.modus
- The current modus.InvalidArgumentException
- if the modus was invalid.java.sql.SQLException
- if data couldn't be retrieved from the database.public boolean addUnit(User user, java.lang.String unitname) throws java.sql.SQLException
addUnit
in interface VocAdmin
addUnit
in class AbstractVocAdmin
user
- To determine if user is superuser.unitname
- The name of the unit to add.java.sql.SQLException
- if data couldn't be addedd to the database.public boolean delUnit(User user, int unitId) throws java.sql.SQLException
delUnit
in interface VocAdmin
delUnit
in class AbstractVocAdmin
user
- To determine if user is superuser.unitId
- The id of the unit to delete.java.sql.SQLException
- if data couldn't be deleted from the database.public int getUnitIdByUnitName(java.lang.String unitName) throws java.sql.SQLException
getUnitIdByUnitName
in interface VocAdmin
getUnitIdByUnitName
in class AbstractVocAdmin
unitName
- The name of the choosen unit.InvalidArgumentException
- if the unitname does not exists.java.sql.SQLException
- if data couldn't be retrieved from the database.public java.util.Vector getAllUnitNames() throws java.sql.SQLException
getAllUnitNames
in interface VocAdmin
getAllUnitNames
in class AbstractVocAdmin
java.sql.SQLException
- if data couldn't be retrieved from the database.public boolean addLanguage(User user, java.lang.String languagename) throws java.sql.SQLException
addLanguage
in interface VocAdmin
addLanguage
in class AbstractVocAdmin
user
- To determine if user is superuser.languagename
- The name of the language to add.java.sql.SQLException
- if data couldn't be added to the database.public boolean delLanguage(User user, int languageId) throws java.sql.SQLException
delLanguage
in interface VocAdmin
delLanguage
in class AbstractVocAdmin
user
- To determine if user is superuser.languageId
- The id of the language to delete.InvalidArgumentException
- if the language does not exists.java.sql.SQLException
- if data couldn't be deleted from the database.public java.util.Vector getAllLanguages() throws java.sql.SQLException
getAllLanguages
in interface VocAdmin
getAllLanguages
in class AbstractVocAdmin
java.sql.SQLException
- if data couldn't be retrieved from the database.public int getLanguageIdByLanguagename(java.lang.String languagename) throws java.sql.SQLException
getLanguageIdByLanguagename
in interface VocAdmin
getLanguageIdByLanguagename
in class AbstractVocAdmin
languagename
- The language.InvalidArgumentException
- if the language does not exists.java.sql.SQLException
- if data couldn't be retrieved from the database.public boolean addVocable(Vocable vocableSet, User user) throws java.sql.SQLException
addVocable
in interface VocAdmin
addVocable
in class AbstractVocAdmin
vocableSet
- This vocable object will be added in the database.user
- The owner of the vocableSet.java.sql.SQLException
- if data couldn't be added to the database.public boolean delVocable(Vocable vocable, User user) throws java.sql.SQLException
delVocable
in interface VocAdmin
delVocable
in class AbstractVocAdmin
vocable
- This vocable object will be deleted in the database.java.sql.SQLException
- if data couldn't be deleted in the database.public boolean editVocable(Vocable vocableSet, boolean status, User user) throws java.sql.SQLException
editVocable
in interface VocAdmin
editVocable
in class AbstractVocAdmin
vocableSet
- The state of this vocable object will be updated in the database.status
- If the answer was correct then status must be true else false.user
- The owner of the vocable.java.sql.SQLException
- if data couldn't be updated in the database.public boolean editVocable(Vocable vocableSet, User user) throws java.sql.SQLException
editVocable
in interface VocAdmin
editVocable
in class AbstractVocAdmin
vocableSet
- This vocable object will be updated in the database.user
- The owner of the vocable.java.sql.SQLException
- if data couldn't be updated in the database.
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |