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 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)
setGroups in interface GroupConfiggrp - a Map object.public Map<String,Group> getGroups() throws IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
getGroups in interface GroupConfigMap 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
GroupConfiggetOnmsGroupList
getOnmsGroupList in interface GroupConfigorg.exolab.castor.xml.MarshalExceptionorg.exolab.castor.xml.ValidationExceptionIOExceptionpublic OnmsGroup getOnmsGroup(String groupName) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException, IOException
GroupConfiggetOnmsGroup
getOnmsGroup in interface GroupConfigorg.exolab.castor.xml.MarshalExceptionorg.exolab.castor.xml.ValidationExceptionIOExceptionpublic void save(OnmsGroup group) throws Exception
GroupConfigsave
save in interface GroupConfigExceptionpublic 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
hasGroup in interface GroupConfiggroupName - 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
getGroupNames in interface GroupConfigList 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
getGroup in interface GroupConfigname - the name of the group to returnIOException - if any.org.exolab.castor.xml.MarshalException - if any.org.exolab.castor.xml.ValidationException - if any.public void saveGroups()
throws Exception
saveGroups
saveGroups in interface GroupConfigException - if any.public boolean isGroupOnDuty(String group, Calendar time) throws IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
isGroupOnDuty in interface GroupConfiggroup - 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
groupNextOnDuty in interface GroupConfiggroup - 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
saveGroup in interface GroupConfigname - a String object.details - a Group object.Exception - if any.public void saveRole(Role role) throws Exception
saveRole
saveRole in interface GroupConfigrole - a Role object.Exception - if any.public void deleteUser(String name) throws Exception
deleteUser in interface GroupConfigname - a String object.Exception - if any.public void deleteGroup(String name) throws Exception
deleteGroup in interface GroupConfigname - a String object.Exception - if any.public void deleteRole(String name) throws Exception
deleteRole
deleteRole in interface GroupConfigname - a String object.Exception - if any.public void renameGroup(String oldName, String newName) throws Exception
renameGroup in interface GroupConfigoldName - a String object.newName - a String object.Exception - if any.public void renameUser(String oldName, String newName) throws Exception
renameUser in interface GroupConfigoldName - a String object.newName - a String object.Exception - if any.public String[] getRoleNames()
getRoleNames
getRoleNames in interface GroupConfigString objects.public Collection<Role> getRoles()
getRoles
getRoles in interface GroupConfigCollection object.public Role getRole(String roleName)
getRole
getRole in interface GroupConfigroleName - a String object.Role object.public boolean userHasRole(String userId, String roleid) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException, IOException
userHasRole
userHasRole in interface GroupConfiguserId - 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
getSchedulesForRoleAt in interface GroupConfigroleId - 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
getUserSchedulesForRole in interface GroupConfiguserId - 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
isUserScheduledForRole in interface GroupConfiguserId - 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
getRoleScheduleEntries in interface GroupConfigroleid - 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.public List<Group> findGroupsForUser(String user)
findGroupsForUser
findGroupsForUser in interface GroupConfiguser - a String object.List object.Copyright © 2017. All rights reserved.