public abstract class GroupManager extends Object
Abstract GroupManager class.
Modifier and Type | Field and Description |
---|---|
protected static HashMap<String,List<DutySchedule>> |
m_dutySchedules
The duty schedules for each group
|
Constructor and Description |
---|
GroupManager() |
Modifier and Type | Method and Description |
---|---|
void |
deleteGroup(String name)
Removes the group from the list of groups.
|
void |
deleteRole(String name)
deleteRole
|
void |
deleteUser(String name)
Removes the user from the list of groups.
|
List<Group> |
findGroupsForUser(String user)
findGroupsForUser
|
Group |
getGroup(String name)
Get a group using its name
|
List<String> |
getGroupNames()
getGroupNames
|
Map<String,Group> |
getGroups()
Get the groups
|
OnmsGroup |
getOnmsGroup(String groupName) |
OnmsGroupList |
getOnmsGroupList() |
Role |
getRole(String roleName)
getRole
|
String[] |
getRoleNames()
getRoleNames
|
Collection<Role> |
getRoles()
getRoles
|
OwnedIntervalSequence |
getRoleScheduleEntries(String roleid,
Date start,
Date end)
getRoleScheduleEntries
|
List<Schedule> |
getSchedulesForRoleAt(String roleId,
Date time)
getSchedulesForRoleAt
|
List<Schedule> |
getUserSchedulesForRole(String userId,
String roleId)
getUserSchedulesForRole
|
long |
groupNextOnDuty(String group,
Calendar time)
Determines when a group is next on duty.
|
boolean |
hasGroup(String groupName)
Returns a boolean indicating if the group name appears in the xml file
|
boolean |
isGroupOnDuty(String group,
Calendar time)
Determines if a group is on duty at a given time.
|
boolean |
isUserScheduledForRole(String userId,
String roleId,
Date time)
isUserScheduledForRole
|
protected void |
parseXml(InputStream stream)
parseXml
|
void |
renameGroup(String oldName,
String newName)
Renames the group from the list of groups.
|
void |
renameUser(String oldName,
String newName)
When this method is called group name is changed, so also is the
group name belonging to the view.
|
void |
save(OnmsGroup group) |
void |
saveGroup(String name,
Group details)
Adds a new user and overwrites the "groups.xml"
|
void |
saveGroups()
saveGroups
|
void |
saveRole(Role role)
saveRole
|
protected abstract void |
saveXml(String data)
saveXml
|
void |
setGroups(Map<String,Group> grp)
Set the groups data
|
abstract void |
update()
update
|
boolean |
userHasRole(String userId,
String roleid)
userHasRole
|
protected static HashMap<String,List<DutySchedule>> m_dutySchedules
protected void parseXml(InputStream stream) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
parseXml
stream
- a InputStream
object.org.exolab.castor.xml.MarshalException
- if any.org.exolab.castor.xml.ValidationException
- if any.public void setGroups(Map<String,Group> grp)
grp
- a Map
object.public Map<String,Group> getGroups() throws IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
Map
object.IOException
- if any.org.exolab.castor.xml.MarshalException
- if any.org.exolab.castor.xml.ValidationException
- if any.public OnmsGroupList getOnmsGroupList() throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException, IOException
org.exolab.castor.xml.MarshalException
org.exolab.castor.xml.ValidationException
IOException
public OnmsGroup getOnmsGroup(String groupName) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException, IOException
org.exolab.castor.xml.MarshalException
org.exolab.castor.xml.ValidationException
IOException
public abstract void update() throws IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
update
org.exolab.castor.xml.ValidationException
- if any.org.exolab.castor.xml.MarshalException
- if any.IOException
- if any.public boolean hasGroup(String groupName) throws IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
groupName
- a String
object.IOException
- if any.org.exolab.castor.xml.MarshalException
- if any.org.exolab.castor.xml.ValidationException
- if any.public List<String> getGroupNames() throws IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
getGroupNames
List
object.IOException
- if any.org.exolab.castor.xml.MarshalException
- if any.org.exolab.castor.xml.ValidationException
- if any.public Group getGroup(String name) throws IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
name
- the name of the group to returnIOException
- if any.org.exolab.castor.xml.MarshalException
- if any.org.exolab.castor.xml.ValidationException
- if any.public boolean isGroupOnDuty(String group, Calendar time) throws IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
group
- the group whose duty schedule we wanttime
- the time to check for a duty scheduleIOException
- if any.org.exolab.castor.xml.MarshalException
- if any.org.exolab.castor.xml.ValidationException
- if any.public long groupNextOnDuty(String group, Calendar time) throws IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
group
- the group whose duty schedule we wanttime
- the time to check for a duty scheduleIOException
- if any.org.exolab.castor.xml.MarshalException
- if any.org.exolab.castor.xml.ValidationException
- if any.protected abstract void saveXml(String data) throws IOException
saveXml
data
- a String
object.IOException
- if any.public void saveGroup(String name, Group details) throws Exception
public void deleteUser(String name) throws Exception
public void deleteGroup(String name) throws Exception
public void renameGroup(String oldName, String newName) throws Exception
public void renameUser(String oldName, String newName) throws Exception
public Collection<Role> getRoles()
getRoles
Collection
object.public boolean userHasRole(String userId, String roleid) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException, IOException
userHasRole
userId
- a String
object.roleid
- a String
object.org.exolab.castor.xml.MarshalException
- if any.org.exolab.castor.xml.ValidationException
- if any.IOException
- if any.public List<Schedule> getSchedulesForRoleAt(String roleId, Date time) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException, IOException
getSchedulesForRoleAt
roleId
- a String
object.time
- a Date
object.List
object.org.exolab.castor.xml.MarshalException
- if any.org.exolab.castor.xml.ValidationException
- if any.IOException
- if any.public List<Schedule> getUserSchedulesForRole(String userId, String roleId) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException, IOException
getUserSchedulesForRole
userId
- a String
object.roleId
- a String
object.List
object.org.exolab.castor.xml.MarshalException
- if any.org.exolab.castor.xml.ValidationException
- if any.IOException
- if any.public boolean isUserScheduledForRole(String userId, String roleId, Date time) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException, IOException
isUserScheduledForRole
userId
- a String
object.roleId
- a String
object.time
- a Date
object.org.exolab.castor.xml.MarshalException
- if any.org.exolab.castor.xml.ValidationException
- if any.IOException
- if any.public OwnedIntervalSequence getRoleScheduleEntries(String roleid, Date start, Date end) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException, IOException
getRoleScheduleEntries
roleid
- a String
object.start
- a Date
object.end
- a Date
object.OwnedIntervalSequence
object.org.exolab.castor.xml.MarshalException
- if any.org.exolab.castor.xml.ValidationException
- if any.IOException
- if any.Copyright © 2015. All Rights Reserved.