Search in sources :

Example 1 with Name

use of org.openntf.domino.Name in project org.openntf.domino by OpenNTF.

the class Session method getUserNameCollection.

/*
	 * (non-Javadoc)
	 *
	 * @see org.openntf.domino.Session#getUserNameCollection()
	 */
@Override
public Collection<String> getUserNameCollection() {
    Collection<String> result = new ArrayList<String>();
    Vector<org.openntf.domino.Name> v = this.getUserNameList();
    if (!v.isEmpty()) {
        for (org.openntf.domino.Name name : v) {
            result.add(name.getCanonical());
        // DominoUtils.incinerate(name);
        }
    }
    return result;
}
Also used : Name(org.openntf.domino.Name) ArrayList(java.util.ArrayList) Name(org.openntf.domino.Name)

Example 2 with Name

use of org.openntf.domino.Name in project org.openntf.domino by OpenNTF.

the class UserProvider method processRequest.

@Override
public Object processRequest(FramedGraph graph, String item, MultivaluedMap<String, String> params) {
    Map<String, Object> result = new LinkedHashMap<String, Object>();
    try {
        Session session = Factory.getSession(SessionType.CURRENT);
        String userName = session.getEffectiveUserName();
        result.put("username", userName);
        Name name = session.createName(userName);
        Collection<String> groups = name.getGroups("");
        result.put("groups", groups);
    } catch (Throwable t) {
        t.printStackTrace();
    }
    return result;
}
Also used : LinkedHashMap(java.util.LinkedHashMap) Session(org.openntf.domino.Session) Name(org.openntf.domino.Name)

Example 3 with Name

use of org.openntf.domino.Name in project org.openntf.domino by OpenNTF.

the class TestName method testEmptyName.

/**
 * Tests for https://github.com/OpenNTF/org.openntf.domino/issues/146 , where this
 * method throws a NullPointerException.
 */
@Test
public void testEmptyName() {
    Name n = Factory.getSession().createName("");
    n.getAddr821();
}
Also used : Name(org.openntf.domino.Name) Test(org.junit.Test)

Example 4 with Name

use of org.openntf.domino.Name in project org.openntf.domino by OpenNTF.

the class Session method getUserGroupNameCollection.

/*
	 * (non-Javadoc)
	 *
	 * @see org.openntf.domino.Session#getUserGroupNameCollection()
	 */
@Override
public Collection<String> getUserGroupNameCollection() {
    Collection<String> result = new ArrayList<String>();
    java.util.Vector<org.openntf.domino.Name> v = this.getUserGroupNameList();
    if (!v.isEmpty()) {
        for (org.openntf.domino.Name name : v) {
            result.add(name.getCanonical());
        // DominoUtils.incinerate(name);
        }
    }
    return result;
}
Also used : Name(org.openntf.domino.Name) ArrayList(java.util.ArrayList) Name(org.openntf.domino.Name)

Aggregations

Name (org.openntf.domino.Name)4 ArrayList (java.util.ArrayList)2 LinkedHashMap (java.util.LinkedHashMap)1 Test (org.junit.Test)1 Session (org.openntf.domino.Session)1