/** * Return a <code>Map</code> of usernames to user instances. * * @return a {@link java.util.Map} object. * @throws java.io.IOException if any. */ public Map<String, User> getUsers() throws IOException { update(); m_readLock.lock(); try { return Collections.unmodifiableMap(m_users); } finally { m_readLock.unlock(); } }
/** * Returns a boolean indicating if the user name appears in the XML file * * @return true if the user exists in the XML file, false otherwise * @param userName a {@link java.lang.String} object. * @throws java.io.IOException if any. */ public boolean hasUser(final String userName) throws IOException { update(); m_readLock.lock(); try { return m_users.containsKey(userName); } finally { m_readLock.unlock(); } }
public OnmsUser getOnmsUser(final String username) throws IOException { update(); m_readLock.lock(); try { return _getOnmsUser(username); } finally { m_readLock.unlock(); } }
/** * <p>getUserNames</p> * * @return a {@link java.util.List} object. * @throws java.io.IOException if any. */ public List<String> getUserNames() throws IOException { update(); m_readLock.lock(); try { return _getUserNames(); } finally { m_readLock.unlock(); } }
/** * Adds a new user and overwrites the "users.xml" * * @param name a {@link java.lang.String} object. * @param details a {@link org.opennms.netmgt.config.users.User} object. * @throws java.lang.Exception if any. */ public void saveUser(final String name, final User details) throws Exception { update(); m_writeLock.lock(); try { _writeUser(name, details); } finally { m_writeLock.unlock(); } }
/** * Get an XMPP address by name * * @param user a {@link org.opennms.netmgt.config.users.User} object. * @return String the XMPP address * @throws java.io.IOException if any. */ public String getXMPPAddress(final User user) throws IOException { update(); m_readLock.lock(); try { return _getXMPPAddress(user); } finally { m_readLock.unlock(); } }
/** * <p>getUsersWithRole</p> * * @param roleid a {@link java.lang.String} object. * @return an array of {@link java.lang.String} objects. * @throws java.io.IOException if any. */ public String[] getUsersWithRole(final String roleid) throws IOException { update(); m_readLock.lock(); try { return _getUsersWithRole(roleid); } finally { m_readLock.unlock(); } }
/** * <p>hasOnCallRole</p> * * @param roleid a {@link java.lang.String} object. * @return a boolean. * @throws java.io.IOException if any. */ public boolean hasOnCallRole(final String roleid) throws IOException { update(); m_readLock.lock(); try { return m_groupManager.getRole(roleid) != null; } finally { m_readLock.unlock(); } }
/** * <p>userHasRole</p> * * @param user a {@link org.opennms.netmgt.config.users.User} object. * @param roleid a {@link java.lang.String} object. * @return a boolean. * @throws java.io.FileNotFoundException if any. * @throws java.io.IOException if any. */ public boolean userHasRole(final User user, final String roleid) throws FileNotFoundException, IOException { update(); m_readLock.lock(); try { return _userHasRole(user, roleid); } finally { m_readLock.unlock(); } }
/** * <p>countUsersWithRole</p> * * @param roleid a {@link java.lang.String} object. * @return a int. * @throws java.io.IOException if any. */ public int countUsersWithRole(final String roleid) throws IOException { update(); m_readLock.lock(); try { final String[] users = _getUsersWithRole(roleid); if (users == null) return 0; return users.length; } finally { m_readLock.unlock(); } }
/** * Get a user's telephone PIN by name * * @param name * the name of the user to return * @return the telephone PIN of the user specified by name * @throws java.io.IOException if any. */ public String getTuiPin(final String name) throws IOException { update(); m_readLock.lock(); try { return m_users.get(name).getTuiPin().orElse(null); } finally { m_readLock.unlock(); } }
/** * Get a user by name * * @param name * the name of the user to return * @return the user specified by name * @throws java.io.IOException if any. */ public User getUser(final String name) throws IOException { update(); m_readLock.lock(); try { return _getUser(name); } finally { m_readLock.unlock(); } }
/** * <p>getContactServiceProvider</p> * * @param user a {@link org.opennms.netmgt.config.users.User} object. * @param command a {@link java.lang.String} object. * @return a {@link java.lang.String} object. * @throws java.io.IOException if any. */ public String getContactServiceProvider(final User user, final String command) throws IOException { update(); m_readLock.lock(); try { return _getContactServiceProvider(user, command); } finally { m_readLock.unlock(); } }
/** * <p>getContactInfo</p> * * @param user a {@link org.opennms.netmgt.config.users.User} object. * @param command a {@link java.lang.String} object. * @return a {@link java.lang.String} object. * @throws java.io.IOException if any. */ public String getContactInfo(final User user, final String command) throws IOException { update(); m_readLock.lock(); try { return _getContactInfo(user, command); } finally { m_readLock.unlock(); } }
/** * Get an XMPP address by name * * @param userID * the user ID of the user to return * @return String the XMPP address * @throws java.io.IOException if any. */ public String getXMPPAddress(final String userID) throws IOException { update(); m_readLock.lock(); try { final User user = m_users.get(userID); return _getXMPPAddress(user); } finally { m_readLock.unlock(); } }
/** * <p>saveUsers</p> * * @param usersList a {@link java.util.Collection} object. * @throws java.lang.Exception if any. */ public void saveUsers(final Collection<User> usersList) throws Exception { update(); m_writeLock.lock(); try { // clear out the internal structure and reload it m_users.clear(); for (final User curUser : usersList) { m_users.put(curUser.getUserId(), curUser); } } finally { m_writeLock.unlock(); } }
/** * <p>isUserScheduledForRole</p> * * @param user a {@link org.opennms.netmgt.config.users.User} object. * @param roleid a {@link java.lang.String} object. * @param time a {@link java.util.Date} object. * @return a boolean. * @throws java.io.FileNotFoundException if any. * @throws java.io.IOException if any. */ public boolean isUserScheduledForRole(final User user, final String roleid, final Date time) throws FileNotFoundException, IOException { update(); m_readLock.lock(); try { return _isUserScheduledForRole(user, roleid, time); } finally { m_readLock.unlock(); } }
/** * Get a user's telephone PIN by User object * * @return the telephone PIN of the user specified by user * @param user a {@link org.opennms.netmgt.config.users.User} object. * @throws java.io.IOException if any. */ public String getTuiPin(final User user) throws IOException { update(); m_readLock.lock(); try { return m_users.get(user.getUserId()).getTuiPin().orElse(null); } finally { m_readLock.unlock(); } }
public void setContactInfo(final String userId, final ContactType contactType, final String contactValue) throws Exception { update(); m_writeLock.lock(); try { final User user = _getUser(userId); if (user != null) { _setContact(user, contactType, contactValue); } _saveCurrent(); } finally { m_writeLock.unlock(); } }
public OnmsUserList getOnmsUserList() throws IOException { update(); final OnmsUserList list = new OnmsUserList(); m_readLock.lock(); try { for (final String username : _getUserNames()) { list.add(_getOnmsUser(username)); } list.setTotalCount(list.getCount()); return list; } finally { m_readLock.unlock(); } }