|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectensemble.DatabaseBean
@Named(value="databaseBean") @ApplicationScoped public class DatabaseBean
This bean handles communication with the database.
Nested Class Summary | |
---|---|
static class |
DatabaseBean.Status
|
Constructor Summary | |
---|---|
DatabaseBean()
Initializes data in the bean and prepares it for use. |
Method Summary | |
---|---|
DatabaseBean.Status |
checkLogin(java.lang.String userName,
java.lang.String password)
Checks to see if a given username exists and if it matches the given password. |
void |
excludePredictions(int predID,
boolean exclude)
Sets the flag indicating whether a set of predictions should be excluded from ensembles. |
void |
excludePredictions(Prediction_set pSet,
boolean exclude)
Sets the flag indicating whether a set of predictions should be excluded from ensembles. |
void |
excludeUser(java.lang.String userName,
boolean exclude)
Sets the flag indicating whether predictions from a particular user should be excluded from ensembles. |
void |
excludeUser(User u,
java.lang.Boolean exclude)
Sets the flag indicating whether predictions from a particular user should be excluded from ensembles. |
java.lang.String |
generateDataSetName(java.lang.String dataName)
Generates a unique name for a data set. |
java.lang.String |
generatePredSetName(java.lang.String predName)
Generates a unique name for a prediction set. |
java.util.List<javax.faces.model.SelectItem> |
getDataItems()
Retrieves data sets from the database in the form of SelectItems, with each set's name as the label and its id number as the value. |
java.util.List<Data_set> |
getDataList()
Retrieves a list of all the data sets in the database. |
java.util.List<DataSet> |
getDataSets()
Returns a list of datasets built from the available XML files. |
java.util.List<Ensemble> |
getEnsembles()
Retrieves a list of all ensembles in the database. |
java.lang.String |
getIndexMessage()
Retrieves the message to be displayed on the index page. |
java.util.List<Prediction_set> |
getPredListFor(Data_set data)
Retrieves a list of all predictions for the given data set. |
java.util.List<PredictionSet> |
getPredSetsFor(DataSet data)
Retrieves prediction sets for a set of data. |
java.sql.SQLException |
getSqlEx()
Retrieves the most recently thrown SQLException for debugging purposes. |
java.util.List<User> |
getUserList()
Generates a list of all users registered in the data base. |
java.lang.Boolean |
hasNoData()
Determines if there are no data sets available. |
boolean |
isAdminRegistered()
Checks that if user "admin" has been registered, which would indicate that initial setup has taken place. |
java.lang.Boolean |
isUpdated()
Determines whether any data or predictions have been added since the last time the method was called. |
boolean |
isUserExcluded(java.lang.String userName)
Determines if a particular user's contributions have been excluded by the admin. |
void |
registerDataset(java.lang.String setName,
java.lang.String userName,
java.lang.String desc)
Attempts to register a new data set in the database using the given information. |
void |
registerEnsemble(Ensemble e)
Adds an ensemble to the database. |
void |
registerPredictions(java.lang.String predName,
int dataID,
java.lang.String userName,
java.lang.String desc)
Attempts to register a set of predictions in the database using the given information. |
DatabaseBean.Status |
registerUser(java.lang.String userName,
java.lang.String password)
Attempts to register a new user in the database using the given information. |
void |
removeData(Data_set data)
Deletes a data set and all predictions for it from the database, and deletes their XML files. |
void |
removeEnsemble(Ensemble e)
Deletes an ensemble from the database, and deletes its XML file. |
void |
removePred(Prediction_set ps)
Deletes a set of predictions from the database, and deletes its XML file. |
void |
setIndexMessage(java.lang.String indexMessage)
Set the message to be displayed on the index page. |
void |
setSqlEx(java.sql.SQLException ex)
Sets the SQLExceptoion whose message should be displayed on the dbError page. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DatabaseBean() throws java.sql.SQLException, java.io.IOException
java.sql.SQLException
java.io.IOException
Method Detail |
---|
public boolean isAdminRegistered() throws java.sql.SQLException, java.io.IOException
java.sql.SQLException
java.io.IOException
public DatabaseBean.Status checkLogin(java.lang.String userName, java.lang.String password) throws java.sql.SQLException, java.io.IOException
userName
- The name given by the userpassword
- The password given by the user
java.sql.SQLException
java.io.IOException
public DatabaseBean.Status registerUser(java.lang.String userName, java.lang.String password) throws java.sql.SQLException, java.io.IOException
userName
- The new user's namepassword
- The new user's password
java.sql.SQLException
java.io.IOException
public void registerDataset(java.lang.String setName, java.lang.String userName, java.lang.String desc) throws java.sql.SQLException, java.io.IOException
setName
- The name of the new data setuserName
- The name of the user who submitted the data setdesc
- A description of the data set
java.sql.SQLException
java.io.IOException
public void registerPredictions(java.lang.String predName, int dataID, java.lang.String userName, java.lang.String desc) throws java.sql.SQLException, java.io.IOException
setName
- The name of the new data setdataID
- An ID number identifying the data set the predictions are foruserName
- The name of the user who submitted the data setdesc
- A description of the data set
java.sql.SQLException
java.io.IOException
public void registerEnsemble(Ensemble e) throws java.sql.SQLException, java.io.IOException
e
- The ensemble to add
java.sql.SQLException
java.io.IOException
public java.util.List<javax.faces.model.SelectItem> getDataItems() throws java.sql.SQLException, java.io.IOException
java.sql.SQLException
java.io.IOException
public java.util.List<Data_set> getDataList() throws java.sql.SQLException, java.io.IOException
java.sql.SQLException
java.io.IOException
public java.util.List<Prediction_set> getPredListFor(Data_set data) throws java.sql.SQLException, java.io.IOException
java.sql.SQLException
java.io.IOException
public java.util.List<PredictionSet> getPredSetsFor(DataSet data) throws java.sql.SQLException, java.io.IOException
data
- The DataSet to retrieve predictions for
java.sql.SQLException
java.io.IOException
public java.util.List<DataSet> getDataSets() throws java.sql.SQLException, java.io.IOException
java.sql.SQLException
java.io.IOException
public java.util.List<Ensemble> getEnsembles() throws java.sql.SQLException, java.io.IOException
java.sql.SQLException
java.io.IOException
public void removePred(Prediction_set ps) throws java.sql.SQLException, java.io.IOException
ps
- The predictions set to delete
java.sql.SQLException
java.io.IOException
public void removeData(Data_set data) throws java.sql.SQLException, java.io.IOException
data
- The data set to delete
java.sql.SQLException
java.io.IOException
public void removeEnsemble(Ensemble e) throws java.sql.SQLException, java.io.IOException
e
- The ensemble to delete
java.sql.SQLException
java.io.IOException
public boolean isUserExcluded(java.lang.String userName) throws java.sql.SQLException, java.io.IOException
userName
- The name of the user to check
java.sql.SQLException
java.io.IOException
public void excludeUser(java.lang.String userName, boolean exclude) throws java.sql.SQLException, java.io.IOException
userName
- the name of a userexclude
- True to exclude the user, false to include them
java.sql.SQLException
java.io.IOException
public void excludeUser(User u, java.lang.Boolean exclude) throws java.sql.SQLException, java.io.IOException
u
- A userexclude
- True to exclude the user, false to include them
java.sql.SQLException
java.io.IOException
public void excludePredictions(Prediction_set pSet, boolean exclude) throws java.sql.SQLException, java.io.IOException
pSet
- A set of predictionsexclude
- True to exclude the set, false to include it
java.sql.SQLException
java.io.IOException
public void excludePredictions(int predID, boolean exclude) throws java.sql.SQLException, java.io.IOException
predID
- The database id of the prediction setexclude
- True to exclude the set, false to include it
java.sql.SQLException
java.io.IOException
public java.util.List<User> getUserList() throws java.sql.SQLException, java.io.IOException
java.sql.SQLException
java.io.IOException
public java.lang.Boolean hasNoData() throws java.sql.SQLException, java.io.IOException
java.sql.SQLException
java.io.IOException
public java.sql.SQLException getSqlEx()
public void setSqlEx(java.sql.SQLException ex)
ex
- An SQLExceptionpublic java.lang.String getIndexMessage()
public void setIndexMessage(java.lang.String indexMessage)
indexMessage
- public java.lang.Boolean isUpdated()
public java.lang.String generateDataSetName(java.lang.String dataName) throws java.sql.SQLException, java.io.IOException
dataName
- Name of the data set.
java.sql.SQLException
java.io.IOException
public java.lang.String generatePredSetName(java.lang.String predName) throws java.sql.SQLException, java.io.IOException
dataName
- Name of the data set.
java.sql.SQLException
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |