org.activemath.webapp.user
Class UserGroup

java.lang.Object
  extended by org.activemath.webapp.user.UserGroup
All Implemented Interfaces:
Comparable
Direct Known Subclasses:
AbstractLearnerModel, UserGroupDefault

public class UserGroup
extends Object
implements Comparable

A user group. This object describes settings for a specific group of users, which can be used to override application behavior.

A group can have a parent, from which it can inherit certain settings.


Field Summary
protected  List<String> allowedBookIds
          Books and Groupings configured for this group, or null.
protected  List<String> allowedGroupingIds
           
protected  Set<String> allowedSurveys
          Surveys configured for this group, or null
protected  Set<String> availableTests
           
protected  boolean controlGroup
           
protected  String exerciseStrategy
           
protected  String exerciseStrategyDefault
           
protected  String field
           
protected  boolean hidden
           
protected  String id
           
protected  String learnerModel
           
protected static Logger log
           
protected  String name
           
protected  UserGroup parent
           
protected  String parentId
           
protected  String skin
           
protected  Map<String,Boolean> testCompulsoryMap
           
protected  Map<String,Integer> testTimeouts
           
protected  List<String> tutorIds
          Tutors allowed to access this group, or null.
 
Constructor Summary
protected UserGroup()
           
  UserGroup(String id)
           
 
Method Summary
 void addTutor(String userId)
          Add a user to the tutor list.
protected  List<String> buildAllowedBookIds(String configStr)
          Build list of available book ids from CVS string.
protected  List<String> buildAllowedGroupingIds(String configStr)
          Build list of available grouping ids from CVS string.
 int compareTo(Object o)
          Compare by name
protected  Set<String> filterBooks(List<Book> recBooks, List<String> allowedBooksList)
           
protected  Set<String> filterGroupings(List<Grouping> groupings, List<String> allowedGroupingsList)
           
 String getAllowedBookIds()
           
 String getAllowedGroupingIds()
           
 List<Grouping> getAllowedGroupings()
           
 List<Book> getAllowedRecBooks()
           
 Set<String> getAllowedSurveyNames()
           
 String getAllowedSurveys()
           
 List<Book> getAvailableTests()
           
 Set<String> getAvailableTestsIds()
           
 Set<String> getCompulsoryTests()
           
 String getExerciseStrategy()
           
 String getField()
           
 Set<String> getGroupSpecificAndInheritedGroupingIds()
           
 Set<String> getGroupSpecificAndInheritedRecBookIds()
           
 Set<String> getGroupSpecificAndInheritedSurveys()
           
 Set<String> getGroupSpecificGroupingIds()
           
 Set<String> getGroupSpecificRecBookIds()
           
 Set<String> getGroupSpecificSurveys()
           
 String getId()
           
 Set<String> getInheritedGroupingIds()
           
 Set<String> getInheritedRecBookIds()
           
 Set<String> getInheritedSurveys()
           
 String getLearnerModel()
           
 String getName()
           
 UserGroup getParent()
           
 String getParentId()
           
 Set<String> getParentIds()
           
 String getProperty(String name)
           
 List<Book> getRecBooks()
          Deprecated. Use getAllowedRecBooks() instead
 String getSkin()
           
 Collection<String> getTargetCompetencies()
           
 Map<String,Boolean> getTestCompulsoryMap()
           
 int getTestTimeout(String testId)
           
 Map<String,Integer> getTestTimeouts()
           
 List<String> getTutors()
           
 String getTutorsCSV()
           
 List<String> getUserIds()
           
 boolean isActive()
           
 boolean isAllowedGrouping(String groupingId)
           
 boolean isAllowedSurvey(String surveyName)
           
 boolean isAllowedTutor(String userId)
           
 boolean isCompulsoryTest(String testId)
           
 boolean isControlGroup()
           
 boolean isDefaultGroup()
           
 boolean isHidden()
           
 boolean removeTutor(String userId)
          Remove a user from the tutor list.
 void setAllowedBookIds(String allowedBookIds)
           
 void setAllowedGroupingIds(String allowedGroupingIds)
           
 void setAllowedSurveys(String allowedSurveys)
           
 void setControlGroup(boolean isControlGroup)
           
 void setExerciseStrategy(String exerciseStrategy)
           
 void setField(String field)
           
 void setHidden(boolean isHidden)
           
 void setId(String groupId)
           
 void setIsCompulsoryTest(String testId, boolean isCompulsory)
           
 void setLearnerModel(String learnerModel)
           
 void setName(String name)
           
 void setParentId(String parentId)
           
 void setSkin(String skin)
           
 void setTestCompulsoryMap(Map<String,Boolean> testIsCompulsory)
           
 void setTestTimeout(String testId, int timeOut)
           
 void setTestTimeouts(Map<String,Integer> testTimeouts)
           
 void setTutors(List<String> ids)
           
 void setTutorsCSV(String ids)
           
 Set<String> splitString(String csvString)
          Split CSV string into Set, checking for empty string.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

log

protected static Logger log

id

protected String id

name

protected String name

hidden

protected boolean hidden

parentId

protected String parentId

parent

protected UserGroup parent

skin

protected String skin

learnerModel

protected String learnerModel

exerciseStrategy

protected String exerciseStrategy

exerciseStrategyDefault

protected String exerciseStrategyDefault

field

protected String field

controlGroup

protected boolean controlGroup

tutorIds

protected List<String> tutorIds
Tutors allowed to access this group, or null.


allowedBookIds

protected List<String> allowedBookIds
Books and Groupings configured for this group, or null.


allowedGroupingIds

protected List<String> allowedGroupingIds

allowedSurveys

protected Set<String> allowedSurveys
Surveys configured for this group, or null


availableTests

protected Set<String> availableTests

testTimeouts

protected Map<String,Integer> testTimeouts

testCompulsoryMap

protected Map<String,Boolean> testCompulsoryMap
Constructor Detail

UserGroup

protected UserGroup()

UserGroup

public UserGroup(String id)
Method Detail

isDefaultGroup

public boolean isDefaultGroup()

buildAllowedBookIds

protected List<String> buildAllowedBookIds(String configStr)
Build list of available book ids from CVS string.

Parameters:
configStr -
Returns:
Book ids configured for this group, or null

buildAllowedGroupingIds

protected List<String> buildAllowedGroupingIds(String configStr)
Build list of available grouping ids from CVS string.

Parameters:
configStr -
Returns:
Grouping ids configured for this group, or null

splitString

public Set<String> splitString(String csvString)
Split CSV string into Set, checking for empty string.


isAllowedGrouping

public boolean isAllowedGrouping(String groupingId)

isAllowedSurvey

public boolean isAllowedSurvey(String surveyName)

toString

public String toString()
Overrides:
toString in class Object

isActive

public boolean isActive()

isHidden

public boolean isHidden()

getId

public String getId()

getName

public String getName()

isControlGroup

public boolean isControlGroup()

getParentId

public String getParentId()

getParent

public UserGroup getParent()
Returns:
parent UserGroup, or null.

getParentIds

public Set<String> getParentIds()
Returns:
The parent's ids (excluding the default group)

getSkin

public String getSkin()
Returns:
skin id from this group, parent, or default group

getExerciseStrategy

public String getExerciseStrategy()
Returns:
exercise strategy from this group, parent, or default group

getField

public String getField()
Returns:
field from this group, parent, or default group, or "" if not set.

getLearnerModel

public String getLearnerModel()
Returns:
learner model id from this group, parent, or default group

getProperty

public String getProperty(String name)
Returns:
Value of property from this group, parent, or default group

getRecBooks

public List<Book> getRecBooks()
Deprecated. Use getAllowedRecBooks() instead

Backwards-compatibility


getAllowedSurveyNames

public Set<String> getAllowedSurveyNames()

getGroupSpecificSurveys

public Set<String> getGroupSpecificSurveys()

getInheritedSurveys

public Set<String> getInheritedSurveys()

getGroupSpecificAndInheritedSurveys

public Set<String> getGroupSpecificAndInheritedSurveys()

getAvailableTests

public List<Book> getAvailableTests()

getAvailableTestsIds

public Set<String> getAvailableTestsIds()

setTestTimeout

public void setTestTimeout(String testId,
                           int timeOut)

getTestTimeout

public int getTestTimeout(String testId)

getTestTimeouts

public Map<String,Integer> getTestTimeouts()

setTestTimeouts

public void setTestTimeouts(Map<String,Integer> testTimeouts)

setIsCompulsoryTest

public void setIsCompulsoryTest(String testId,
                                boolean isCompulsory)

isCompulsoryTest

public boolean isCompulsoryTest(String testId)

getTestCompulsoryMap

public Map<String,Boolean> getTestCompulsoryMap()

setTestCompulsoryMap

public void setTestCompulsoryMap(Map<String,Boolean> testIsCompulsory)

getCompulsoryTests

public Set<String> getCompulsoryTests()

getAllowedGroupings

public List<Grouping> getAllowedGroupings()

getGroupSpecificGroupingIds

public Set<String> getGroupSpecificGroupingIds()

getInheritedGroupingIds

public Set<String> getInheritedGroupingIds()

getGroupSpecificAndInheritedGroupingIds

public Set<String> getGroupSpecificAndInheritedGroupingIds()

getAllowedRecBooks

public List<Book> getAllowedRecBooks()

getGroupSpecificRecBookIds

public Set<String> getGroupSpecificRecBookIds()

getInheritedRecBookIds

public Set<String> getInheritedRecBookIds()

getGroupSpecificAndInheritedRecBookIds

public Set<String> getGroupSpecificAndInheritedRecBookIds()

getUserIds

public List<String> getUserIds()

filterGroupings

protected Set<String> filterGroupings(List<Grouping> groupings,
                                      List<String> allowedGroupingsList)

filterBooks

protected Set<String> filterBooks(List<Book> recBooks,
                                  List<String> allowedBooksList)

compareTo

public int compareTo(Object o)
Compare by name

Specified by:
compareTo in interface Comparable

setId

public void setId(String groupId)

setTutorsCSV

public void setTutorsCSV(String ids)
Parameters:
ids - CSV string of tutors allowed access to this group

getTutorsCSV

public String getTutorsCSV()
Returns:
CSV string of allowed tutor IDs

setTutors

public void setTutors(List<String> ids)
Parameters:
ids - - list of tutors allowed access to this group

getTutors

public List<String> getTutors()
Returns:
list of allowed tutor IDs

addTutor

public void addTutor(String userId)
Add a user to the tutor list.


removeTutor

public boolean removeTutor(String userId)
Remove a user from the tutor list.

Returns:
true iff user was in tutor list.

isAllowedTutor

public boolean isAllowedTutor(String userId)

setAllowedBookIds

public void setAllowedBookIds(String allowedBookIds)
Parameters:
allowedBookIds - CSV string of allowed books

setAllowedGroupingIds

public void setAllowedGroupingIds(String allowedGroupingIds)
Parameters:
allowedGroupingIds - CSV string of allowed Groupings

setAllowedSurveys

public void setAllowedSurveys(String allowedSurveys)
Parameters:
allowedSurveys - CSV string of allowed surveys

getAllowedBookIds

public String getAllowedBookIds()
Returns:
CSV string of allowed book IDs

getAllowedGroupingIds

public String getAllowedGroupingIds()
Returns:
CSV string of allowed grouping IDs

getAllowedSurveys

public String getAllowedSurveys()
Returns:
CSV string of allowed book IDs

setExerciseStrategy

public void setExerciseStrategy(String exerciseStrategy)

setField

public void setField(String field)

setControlGroup

public void setControlGroup(boolean isControlGroup)

setHidden

public void setHidden(boolean isHidden)

setLearnerModel

public void setLearnerModel(String learnerModel)

setName

public void setName(String name)

setParentId

public void setParentId(String parentId)

setSkin

public void setSkin(String skin)

getTargetCompetencies

public Collection<String> getTargetCompetencies()