Class ScoreDAO
- java.lang.Object
-
- org.silverpeas.core.questioncontainer.score.dao.ScoreDAO
-
public class ScoreDAO extends Object
Score Data Access Object layer
-
-
Field Summary
Fields Modifier and Type Field Description static String
SCORECOLUMNNAMES
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
addScore(Connection con, ScoreDetail scoreDetail)
static void
deleteAllScoresByInstanceId(Connection con, String instanceId)
Deletes the scores of all the questions in the specified component instance.static void
deleteScore(Connection con, ScorePK scorePK)
detele score identified by given scorePk parameterstatic void
deleteScoreByFatherPK(Connection con, String fatherId)
static Collection<ScoreDetail>
getAllScores(Connection con, ScorePK scorePK)
static float
getAverageScoreByFatherId(Connection con, ScorePK scorePK, String fatherId)
static Collection<ScoreDetail>
getBestScoresByFatherId(Connection con, ScorePK scorePK, int nbBestScores, String fatherId)
static int
getNbVotersByFatherId(Connection con, ScorePK scorePK, String fatherId)
static Collection<ScoreDetail>
getScoresByFatherId(Connection con, ScorePK scorePK, String fatherId)
Method declarationstatic int
getUserNbParticipationsByFatherId(Connection con, ScorePK scorePK, String fatherId, String userId)
static int
getUserPositionByFatherIdAndParticipationId(Connection con, ScorePK scorePK, String fatherId, String userId, int participationId)
static ScoreDetail
getUserScoreByFatherIdAndParticipationId(Connection con, ScorePK scorePK, String fatherId, String userId, int participationId)
static Collection<ScoreDetail>
getUserScores(Connection con, ScorePK scorePK, String userId)
static Collection<ScoreDetail>
getUserScoresByFatherId(Connection con, ScorePK scorePK, String fatherId, String userId)
static Collection<ScoreDetail>
getWorstScoresByFatherId(Connection con, ScorePK scorePK, int nbWorstScores, String fatherId)
static void
updateScore(Connection con, ScoreDetail scoreDetail)
-
-
-
Field Detail
-
SCORECOLUMNNAMES
public static final String SCORECOLUMNNAMES
- See Also:
- Constant Field Values
-
-
Method Detail
-
addScore
public static void addScore(Connection con, ScoreDetail scoreDetail) throws SQLException
- Parameters:
con
- the database connectionscoreDetail
-- Throws:
SQLException
-
updateScore
public static void updateScore(Connection con, ScoreDetail scoreDetail) throws SQLException
- Parameters:
con
- the database connectionscoreDetail
-- Throws:
SQLException
-
deleteScore
public static void deleteScore(Connection con, ScorePK scorePK) throws SQLException
detele score identified by given scorePk parameter- Parameters:
con
- the database connectionscorePK
- the score identifier- Throws:
SQLException
-
deleteScoreByFatherPK
public static void deleteScoreByFatherPK(Connection con, String fatherId) throws SQLException
- Parameters:
con
- the database connectionfatherId
- the father idenfifier- Throws:
SQLException
-
deleteAllScoresByInstanceId
public static void deleteAllScoresByInstanceId(Connection con, String instanceId) throws SQLException
Deletes the scores of all the questions in the specified component instance.- Parameters:
con
- a connection to the data source into which are stored the scores.instanceId
- the unique identifier of the component instance.- Throws:
SQLException
- if an error occurs while deleting the scores.
-
getAllScores
public static Collection<ScoreDetail> getAllScores(Connection con, ScorePK scorePK) throws SQLException
- Parameters:
con
- the database connectionscorePK
- the score identifier- Returns:
- Throws:
SQLException
-
getUserScores
public static Collection<ScoreDetail> getUserScores(Connection con, ScorePK scorePK, String userId) throws SQLException
- Parameters:
con
- the database connectionscorePK
- the score identifieruserId
- the user identifier- Returns:
- Throws:
SQLException
-
getUserScoresByFatherId
public static Collection<ScoreDetail> getUserScoresByFatherId(Connection con, ScorePK scorePK, String fatherId, String userId) throws SQLException
- Parameters:
con
- the database connectionscorePK
- the score identifierfatherId
- the father idenfifieruserId
- the user identifier- Returns:
- Throws:
SQLException
-
getScoresByFatherId
public static Collection<ScoreDetail> getScoresByFatherId(Connection con, ScorePK scorePK, String fatherId) throws SQLException
Method declaration- Parameters:
con
- the database connectionscorePK
- the score identifierfatherId
- the father idenfifier- Returns:
- Throws:
SQLException
-
getBestScoresByFatherId
public static Collection<ScoreDetail> getBestScoresByFatherId(Connection con, ScorePK scorePK, int nbBestScores, String fatherId) throws SQLException
- Parameters:
con
- the database connectionscorePK
- the score identifiernbBestScores
-fatherId
- the father idenfifier- Returns:
- Throws:
SQLException
-
getWorstScoresByFatherId
public static Collection<ScoreDetail> getWorstScoresByFatherId(Connection con, ScorePK scorePK, int nbWorstScores, String fatherId) throws SQLException
- Parameters:
con
- the database connectionscorePK
- the score identifiernbWorstScores
-fatherId
- the father idenfifier- Returns:
- Throws:
SQLException
-
getNbVotersByFatherId
public static int getNbVotersByFatherId(Connection con, ScorePK scorePK, String fatherId) throws SQLException
- Parameters:
con
- the database connectionscorePK
- the score identifierfatherId
- the father idenfifier- Returns:
- Throws:
SQLException
-
getAverageScoreByFatherId
public static float getAverageScoreByFatherId(Connection con, ScorePK scorePK, String fatherId) throws SQLException
- Parameters:
con
- the database connectionscorePK
- the score identifierfatherId
- the father idenfifier- Returns:
- Throws:
SQLException
-
getUserScoreByFatherIdAndParticipationId
public static ScoreDetail getUserScoreByFatherIdAndParticipationId(Connection con, ScorePK scorePK, String fatherId, String userId, int participationId) throws SQLException
- Parameters:
con
- the database connectionscorePK
- the score identifierfatherId
- the father idenfifieruserId
- the user identifierparticipationId
-- Returns:
- Throws:
SQLException
-
getUserNbParticipationsByFatherId
public static int getUserNbParticipationsByFatherId(Connection con, ScorePK scorePK, String fatherId, String userId) throws SQLException
- Parameters:
con
- the database connectionscorePK
- the score identifierfatherId
- the father idenfifieruserId
- the user identifier- Returns:
- Throws:
SQLException
-
getUserPositionByFatherIdAndParticipationId
public static int getUserPositionByFatherIdAndParticipationId(Connection con, ScorePK scorePK, String fatherId, String userId, int participationId) throws SQLException
- Parameters:
con
- the database connectionscorePK
- the score identifierfatherId
-userId
- the user identifierparticipationId
-- Returns:
- Throws:
SQLException
-
-