public abstract class GroupManager extends Object implements GroupConfig
Abstract GroupManager class.
Modifier and Type | Class and Description |
---|---|
static class |
GroupManager.OnmsGroupListMapper |
static class |
GroupManager.OnmsGroupMapper |
Modifier and Type | Field and Description |
---|---|
protected static Map<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)
getOnmsGroup
|
OnmsGroupList |
getOnmsGroupList()
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)
save
|
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 Map<String,List<DutySchedule>> m_dutySchedules
protected void parseXml(InputStream stream) throws IOException
parseXml
stream
- a InputStream
object.IOException
public void setGroups(Map<String,Group> grp)
setGroups
in interface GroupConfig
grp
- a Map
object.public Map<String,Group> getGroups() throws IOException
getGroups
in interface GroupConfig
Map
object.IOException
- if any.public OnmsGroupList getOnmsGroupList() throws IOException
GroupConfig
getOnmsGroupList
getOnmsGroupList
in interface GroupConfig
IOException
public OnmsGroup getOnmsGroup(String groupName) throws IOException
GroupConfig
getOnmsGroup
getOnmsGroup
in interface GroupConfig
IOException
public void save(OnmsGroup group) throws Exception
GroupConfig
save
save
in interface GroupConfig
Exception
public abstract void update() throws IOException
update
IOException
- if any.public boolean hasGroup(String groupName) throws IOException
hasGroup
in interface GroupConfig
groupName
- a String
object.IOException
- if any.public List<String> getGroupNames() throws IOException
getGroupNames
getGroupNames
in interface GroupConfig
List
object.IOException
- if any.public Group getGroup(String name) throws IOException
getGroup
in interface GroupConfig
name
- the name of the group to returnIOException
- if any.public void saveGroups() throws Exception
saveGroups
saveGroups
in interface GroupConfig
Exception
- if any.public boolean isGroupOnDuty(String group, Calendar time) throws IOException
isGroupOnDuty
in interface GroupConfig
group
- the group whose duty schedule we wanttime
- the time to check for a duty scheduleIOException
- if any.public long groupNextOnDuty(String group, Calendar time) throws IOException
groupNextOnDuty
in interface GroupConfig
group
- the group whose duty schedule we wanttime
- the time to check for a duty scheduleIOException
- 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
saveGroup
in interface GroupConfig
name
- a String
object.details
- a Group
object.Exception
- if any.public void saveRole(Role role) throws Exception
saveRole
saveRole
in interface GroupConfig
role
- a Role
object.Exception
- if any.public void deleteUser(String name) throws Exception
deleteUser
in interface GroupConfig
name
- a String
object.Exception
- if any.public void deleteGroup(String name) throws Exception
deleteGroup
in interface GroupConfig
name
- a String
object.Exception
- if any.public void deleteRole(String name) throws Exception
deleteRole
deleteRole
in interface GroupConfig
name
- a String
object.Exception
- if any.public void renameGroup(String oldName, String newName) throws Exception
renameGroup
in interface GroupConfig
oldName
- a String
object.newName
- a String
object.Exception
- if any.public void renameUser(String oldName, String newName) throws Exception
renameUser
in interface GroupConfig
oldName
- a String
object.newName
- a String
object.Exception
- if any.public String[] getRoleNames()
getRoleNames
getRoleNames
in interface GroupConfig
String
objects.public Collection<Role> getRoles()
getRoles
getRoles
in interface GroupConfig
Collection
object.public Role getRole(String roleName)
getRole
getRole
in interface GroupConfig
roleName
- a String
object.Role
object.public boolean userHasRole(String userId, String roleid) throws IOException
userHasRole
userHasRole
in interface GroupConfig
userId
- a String
object.roleid
- a String
object.IOException
- if any.public List<Schedule> getSchedulesForRoleAt(String roleId, Date time) throws IOException
getSchedulesForRoleAt
getSchedulesForRoleAt
in interface GroupConfig
roleId
- a String
object.time
- a Date
object.List
object.IOException
- if any.public List<Schedule> getUserSchedulesForRole(String userId, String roleId) throws IOException
getUserSchedulesForRole
getUserSchedulesForRole
in interface GroupConfig
userId
- a String
object.roleId
- a String
object.List
object.IOException
- if any.public boolean isUserScheduledForRole(String userId, String roleId, Date time) throws IOException
isUserScheduledForRole
isUserScheduledForRole
in interface GroupConfig
userId
- a String
object.roleId
- a String
object.time
- a Date
object.IOException
- if any.public OwnedIntervalSequence getRoleScheduleEntries(String roleid, Date start, Date end) throws IOException
getRoleScheduleEntries
getRoleScheduleEntries
in interface GroupConfig
roleid
- a String
object.start
- a Date
object.end
- a Date
object.OwnedIntervalSequence
object.IOException
- if any.public List<Group> findGroupsForUser(String user)
findGroupsForUser
findGroupsForUser
in interface GroupConfig
user
- a String
object.List
object.Copyright © 2021. All rights reserved.