|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectde.uka.ipd.consensus.foundation.AbstractConsensusFoundationModule
de.uka.ipd.consensus.impl.SQLRatingManagerImpl
TODO
| Field Summary | |
static String |
NEUTRAL
|
static String |
NO
|
static String |
YES
|
| Constructor Summary | |
SQLRatingManagerImpl()
|
|
| Method Summary | |
void |
addRating(Association rated,
Rating rating)
Adds the given rating to the given association. |
void |
addRating(Attribute rated,
Rating rating)
Adds the given rating to the given attribute. |
void |
addRating(Topic rated,
Rating rating)
Adds the given rating to the given topic. |
void |
addRating(User rated,
Rating rating)
Adds the given rating to the given user. |
void |
addRatingListener(RatingListener listener)
Registers a new RatingListener. |
protected void |
changeRatingComment(SQLRatingImpl rating,
String comment)
|
protected void |
changeRatingValue(SQLRatingImpl rating,
double newval,
double oldval,
long newdate,
long olddate,
long newrateddate,
long oldrateddate,
String oldcomment)
|
boolean |
changesAllowed()
With this method the RatingManager signals if ratings, once added, can be changed afterwards. |
Rating |
createRating(User creator,
double value)
Creates a new rating with the given user as the creator ("owner" of the rating). |
void |
deleteRatings(Association association)
If an association is deleted permanently from the ontology, this method can be used to remove the ratings that were added to the association, too (including historical values). |
void |
deleteRatings(Attribute attribute)
If an attribute is deleted permanently from the ontology, this method can be used to remove the ratings that were added to the attribute, too (including historical values). |
void |
deleteRatings(Topic topic)
If a topic is deleted permanently from the ontology, this method can be used to remove the ratings that were added to the topic, too (including historical values). |
void |
deleteRatings(User user)
If a user is deleted permanently from the ontology and user database, this method can be used to remove the ratings that were added to the user, too (including historical values). |
double |
getAverageRatingValue(Association association)
Returns the average (arithmetic mean) of all ratings for the given association. |
double |
getAverageRatingValue(Attribute attribute)
Returns the average (arithmetic mean) of all ratings for the given attribute. |
double |
getAverageRatingValue(Topic topic)
Returns the average (arithmetic mean) of all ratings for the given topic. |
double |
getAverageRatingValue(User user)
Returns the average (arithmetic mean) of all ratings that other users have added to the given user. |
protected Collection |
getHistory(SQLRatingImpl rating)
|
Rating |
getRating(Association association,
User rater)
Returns the rating object that the given user has added to the given association (or null if the user hasn't rated the association yet). |
Rating |
getRating(Attribute attribute,
User rater)
Returns the rating object that the given user has added to the given attribute (or null if the user hasn't rated the attribute yet). |
Rating |
getRating(Topic topic,
User rater)
Returns the rating object that the given user has added to the given topic (or null if the user hasn't rated the topic yet). |
Rating |
getRating(User user,
User rater)
Returns the rating object that the given user (parameter "rater") has added to another user (parameter "user") - or null if the user hasn't rated the other user yet. |
Collection |
getRatings(Association association)
Returns a collection of all Rating objects that have been added to the given association. |
Collection |
getRatings(Attribute attribute)
Returns a collection of all Rating objects that have been added to the given attribute. |
Collection |
getRatings(Topic topic)
Returns a collection of all Rating objects that have been added to the given topic. |
Collection |
getRatings(User user)
Returns a collection of all Rating objects that have been added by other users to the given user. |
int |
getRatingsCount(Association association)
Returns the number of ratings that have been added to the given association. |
int |
getRatingsCount(Attribute attribute)
Returns the number of ratings that have been added to the given attribute. |
int |
getRatingsCount(Topic topic)
Returns the number of ratings that have been added to the given topic. |
int |
getRatingsCount(User user)
Returns the number of ratings that have been added by other users to the given user. |
double |
getUsersAverageOwnRatingsValue(User user)
Returns the average (arithmetic mean) of all ratings that the given user has added to other rateable elements. |
Collection |
getUsersOwnRatings(User user)
returns all (TODO) user's ratings, newest first |
int |
getUsersOwnRatingsCount(User user)
Returns the number of ratings that the given user has added to other rateable elements. |
String |
getVersion()
Returns a version string of the implementation of this module. |
void |
init(Properties config,
LoggingManager logging,
UserManager users,
OntologyManager ontology)
This method is called by the ConsensusFoundation constructor to initialize the RatingManager. |
void |
initCompleted(Properties config,
ConsensusFoundationManager cfm)
This method is called by the ConsensusFoundation constructor after all available modules have
been initialized (i.e. their init() method has been called). |
String |
ratingValueToString(double value)
As applications will have to store rating values as strings (e.g. in the presentation layer), this method converts a rating value into a string. |
void |
removeRating(User remover,
Rating rating)
Removes a rating and its history if it is assigned to a rateable element (otherwise this call is ignored). |
void |
removeRatingListener(RatingListener listener)
Removes a RatingListener, if it is registered with the RatingManager (otherwise this call is ignored). |
void |
shutdown()
Called by ConsensusFoundation.shutdown() when the application shuts down.
|
double |
stringToRatingValue(String str)
Converts a string returned by ratingValueToString() back into a rating value.
|
| Methods inherited from class de.uka.ipd.consensus.foundation.AbstractConsensusFoundationModule |
finalize, getConsensusFoundationManager, getDynamicRightsManager, getEvolutionManager, getIncentiveManager, getLoggingManager, getOntologyManager, getRatingManager, getUserManager |
| Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface de.uka.ipd.consensus.foundation.ConsensusFoundationModule |
getConsensusFoundationManager |
| Field Detail |
public static final String NO
public static final String YES
public static final String NEUTRAL
| Constructor Detail |
public SQLRatingManagerImpl()
| Method Detail |
public void init(Properties config,
LoggingManager logging,
UserManager users,
OntologyManager ontology)
throws Exception
RatingManagerThis method is called by the ConsensusFoundation constructor to initialize the RatingManager.
init in interface RatingManagerconfig - all entries from ConsensusFoundation.propertieslogging - the successfully initialized LoggingManager instanceusers - the the successfully initialized UserManager instanceontology - the the successfully initialized OntologyManager instance
Exception - if any error occurs (startup of the application is aborted in this case)ConsensusFoundation.ConsensusFoundation()
public void initCompleted(Properties config,
ConsensusFoundationManager cfm)
throws Exception
ConsensusFoundationModuleConsensusFoundation constructor after all available modules have
been initialized (i.e. their init() method has been called). Here a module can perform some final
initialization that is dependant on other modules.
initCompleted in interface ConsensusFoundationModuleinitCompleted in class AbstractConsensusFoundationModuleExceptionpublic void shutdown()
ConsensusFoundationModuleConsensusFoundation.shutdown() when the application shuts down.
When implementing this method make sure that the shutdown code is executed only once even if this method is called multiple times.
shutdown in interface ConsensusFoundationModuleshutdown in class AbstractConsensusFoundationModulepublic boolean changesAllowed()
RatingManager
changesAllowed in interface RatingManagertrue if existing ratings can be changed, false otherwisepublic String ratingValueToString(double value)
RatingManagerThe values are intended to be valid until application shutdown only and may not be compatible between different implementations of the RatingManager interface!
return the given rating value converted to a suitable string
ratingValueToString in interface RatingManagerRating.getValue(),
RatingManager.stringToRatingValue(String)public double stringToRatingValue(String str)
RatingManagerratingValueToString() back into a rating value.
If an unknown string is given, Rating.NEUTRAL should be returned.
stringToRatingValue in interface RatingManagerstr - the string to be converted
Rating.setValue(double),
Rating.NEUTRAL,
RatingManager.ratingValueToString(double)
public Rating createRating(User creator,
double value)
throws RatingManagerException,
DynamicRightsManagerException
RatingManageraddRating() methods
or - better - the Rateable interface.
createRating in interface RatingManagercreator - the user who wants to create the ratingvalue - the value for the newly created rating (-1..1, including both values)
RatingManagerException - if the rating could not be created
DynamicRightsManagerException - if the user is not allowed to create ratingsRateable.addRating(User, double),
DynamicRightsManager.mayCreateRating(User)protected Collection getHistory(SQLRatingImpl rating)
protected void changeRatingValue(SQLRatingImpl rating,
double newval,
double oldval,
long newdate,
long olddate,
long newrateddate,
long oldrateddate,
String oldcomment)
protected void changeRatingComment(SQLRatingImpl rating,
String comment)
public Collection getUsersOwnRatings(User user)
getUsersOwnRatings in interface RatingManageruser - the user from whom the ratings are returned
nullRating,
User.getOwnRatings()public double getUsersAverageOwnRatingsValue(User user)
RatingManagerOnly current ratings are taken into account, not historical ones.
getUsersAverageOwnRatingsValue in interface RatingManageruser - the user from whose ratings the average rating value shall be computed
Rating.NEUTRAL if the user hasn't rated other elements yetRating.NEUTRAL,
User.getAverageOwnRatingsValue()public int getUsersOwnRatingsCount(User user)
RatingManagerOnly current ratings are taken into account, not historical ones.
getUsersOwnRatingsCount in interface RatingManageruser - the user from whom the number of ratings shall be returned
User.getOwnRatingsCount()
public void removeRating(User remover,
Rating rating)
throws RatingManagerException,
DynamicRightsManagerException
RatingManager
removeRating in interface RatingManagerremover - the user who wants to remove the ratingrating - the rating to be removed
RatingManagerException - if the rating could not be removed
DynamicRightsManagerException - if the user is not allowed to remove the ratingRating.getRateable(),
DynamicRightsManager.mayRemoveRating(User, Rating)
public Rating getRating(Topic topic,
User rater)
RatingManagernull if the user hasn't rated the topic yet).
getRating in interface RatingManagertopic - the topic from which the rating is returnedrater - the user who added the rating
nullRateable.getRating(User)
public Rating getRating(Attribute attribute,
User rater)
RatingManagernull if the user hasn't rated the attribute yet).
getRating in interface RatingManagerattribute - the attribute from which the rating is returnedrater - the user who added the rating
nullRateable.getRating(User)
public Rating getRating(Association association,
User rater)
RatingManagernull if the user hasn't rated the association yet).
getRating in interface RatingManagerassociation - the association from which the rating is returnedrater - the user who added the rating
nullRateable.getRating(User)
public Rating getRating(User user,
User rater)
RatingManagernull if the user hasn't rated the other user yet.
getRating in interface RatingManageruser - the user from which the rating is returnedrater - the user who added the rating
nullRateable.getRating(User)public Collection getRatings(Topic topic)
RatingManagerOnly current ratings are taken into account, not historical ones.
getRatings in interface RatingManagertopic - the topic for which the ratings are returned
nullRating,
Rateable.getRatings()public Collection getRatings(Attribute attribute)
RatingManagerOnly current ratings are taken into account, not historical ones.
getRatings in interface RatingManagerattribute - the attribute for which the ratings are returned
nullRating,
Rateable.getRatings()public Collection getRatings(Association association)
RatingManagerOnly current ratings are taken into account, not historical ones.
getRatings in interface RatingManagerassociation - the association for which the ratings are returned
nullRating,
Rateable.getRatings()public Collection getRatings(User user)
RatingManagerOnly current ratings are taken into account, not historical ones.
getRatings in interface RatingManageruser - the user for whom the ratings are returned
nullRating,
Rateable.getRatings()public int getRatingsCount(Association association)
RatingManagerOnly current ratings are taken into account, not historical ones.
getRatingsCount in interface RatingManagerassociation - the association for which the number of ratings shall be returned
Rateable.getRatingsCount()public int getRatingsCount(Attribute attribute)
RatingManagerOnly current ratings are taken into account, not historical ones.
getRatingsCount in interface RatingManagerattribute - the attribute for which the number of ratings shall be returned
Rateable.getRatingsCount()public int getRatingsCount(Topic topic)
RatingManagerOnly current ratings are taken into account, not historical ones.
getRatingsCount in interface RatingManagertopic - the topic for which the number of ratings shall be returned
Rateable.getRatingsCount()public int getRatingsCount(User user)
RatingManagerOnly current ratings are taken into account, not historical ones.
getRatingsCount in interface RatingManageruser - the user for whom the number of ratings shall be returned
Rateable.getRatingsCount()public double getAverageRatingValue(Association association)
RatingManagerOnly current ratings are taken into account, not historical ones.
getAverageRatingValue in interface RatingManagerassociation - the association for which the average rating value shall be computed
Rating.NEUTRAL if the association isn't rated yetRating.NEUTRAL,
Rateable.getAverageRatingValue()public double getAverageRatingValue(Attribute attribute)
RatingManagerOnly current ratings are taken into account, not historical ones.
getAverageRatingValue in interface RatingManagerattribute - the attribute for which the average rating value shall be computed
Rating.NEUTRAL if the attribute isn't rated yetRating.NEUTRAL,
Rateable.getAverageRatingValue()public double getAverageRatingValue(Topic topic)
RatingManagerOnly current ratings are taken into account, not historical ones.
getAverageRatingValue in interface RatingManagertopic - the topic for which the average rating value shall be computed
Rating.NEUTRAL if the topic isn't rated yetRating.NEUTRAL,
Rateable.getAverageRatingValue()public double getAverageRatingValue(User user)
RatingManagerOnly current ratings are taken into account, not historical ones.
getAverageRatingValue in interface RatingManageruser - the user for whom the average rating value shall be computed
Rating.NEUTRAL if the user isn't rated yetRating.NEUTRAL,
Rateable.getAverageRatingValue()
public void addRating(Topic rated,
Rating rating)
throws RatingManagerException,
DynamicRightsManagerException
RatingManagerThe implementation must ensure that each rating can be added to one rateable element only, that each user can rate each topic only once and that historical ratings cannot be added at all.
addRating in interface RatingManagerrated - the topic to which the rating will be addedrating - the rating to be added
DynamicRightsManagerException - if the user is not allowed to add the rating
RatingManagerException - if the rating cannot be added to the given topicRating.isHistorical(),
DynamicRightsManager.mayAddRating(Rating, Rateable),
Rateable.addRating(User, double)
public void addRating(Attribute rated,
Rating rating)
throws RatingManagerException,
DynamicRightsManagerException
RatingManagerThe implementation must ensure that each rating can be added to one rateable element only, that each user can rate each attribute only once and that historical ratings cannot be added at all.
addRating in interface RatingManagerrated - the attribute to which the rating will be addedrating - the rating to be added
DynamicRightsManagerException - if the user is not allowed to add the rating
RatingManagerException - if the rating cannot be added to the given attributeRating.isHistorical(),
DynamicRightsManager.mayAddRating(Rating, Rateable),
Rateable.addRating(User, double)
public void addRating(Association rated,
Rating rating)
throws RatingManagerException,
DynamicRightsManagerException
RatingManagerThe implementation must ensure that each rating can be added to one rateable element only, that each user can rate each association only once and that historical ratings cannot be added at all.
addRating in interface RatingManagerrated - the association to which the rating will be addedrating - the rating to be added
RatingManagerException - if the rating cannot be added to the given association
DynamicRightsManagerException - if the user is not allowed to add the ratingRating.isHistorical(),
DynamicRightsManager.mayAddRating(Rating, Rateable),
Rateable.addRating(User, double)
public void addRating(User rated,
Rating rating)
throws RatingManagerException,
DynamicRightsManagerException
RatingManagerThe implementation must ensure that each rating can be added to one rateable element only, that each user can rate each other user only once and that historical ratings cannot be added at all.
addRating in interface RatingManagerrated - the user to which the rating will be addedrating - the rating to be added
RatingManagerException - if the rating cannot be added to the given user
DynamicRightsManagerException - if the user (who created the rating) is not allowed to add the rating to the given userRating.isHistorical(),
DynamicRightsManager.mayAddRating(Rating, Rateable),
Rateable.addRating(User, double)
public void deleteRatings(Topic topic)
throws RatingManagerException
RatingManagerThis method will be used by the EvolutionManager.
deleteRatings in interface RatingManagertopic - the topic object for which the corresponding ratings shall be deleted
RatingManagerException - if the ratings could not be deletedEvolutionManager.deleteTopic(User, Topic),
EvolutionManager.deleteTopicAndSubtopics(User, Topic)
public void deleteRatings(Attribute attribute)
throws RatingManagerException
RatingManagerThis method will be used by the EvolutionManager.
deleteRatings in interface RatingManagerattribute - the attribute object for which the corresponding ratings shall be deleted
RatingManagerException - if the ratings could not be deletedEvolutionManager.deleteAttribute(User, Topic, Attribute)
public void deleteRatings(Association association)
throws RatingManagerException
RatingManagerThis method will be used by the EvolutionManager.
deleteRatings in interface RatingManagerassociation - the association object for which the corresponding ratings shall be deleted
RatingManagerException - if the ratings could not be deletedEvolutionManager.deleteAssociation(User, Association)
public void deleteRatings(User user)
throws RatingManagerException
RatingManagerThis method will be used by the UserManager.
deleteRatings in interface RatingManageruser - the user object for which the corresponding ratings shall be deleted
RatingManagerException - if the ratings could not be deletedUserManager.deleteUser(User, String)public void addRatingListener(RatingListener listener)
RatingManager
addRatingListener in interface RatingManagerlistener - the RatingListener to be addedpublic void removeRatingListener(RatingListener listener)
RatingManager
removeRatingListener in interface RatingManagerlistener - the RatingListener to be removedpublic String getVersion()
ConsensusFoundationModule
getVersion in interface ConsensusFoundationModule
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||