Chapter 8. User and Group

Objects represented by User and Group interfaces are managed by PersistenceManager. In the example below 3 users and 4 groups are created.

PersistenceManager pm = identitySession.getPersistenceManager();
User johnUser = pm.createUser("John");
User annUser = pm.createUser("Ann");
User stefanUser = pm.createUser("Stefan");

String OFFICE = "OFFICE";
String DEPARTMENT = "DEPARTMENT";

Group parisOffice = pm.createGroup("Paris", OFFICE);
Group atlantaOffice = pm.createGroup("Atlanta", OFFICE);

assertEquals(OFFICE, parisOffice.getGroupType());

Group itDep = pm.createGroup("IT", DEPARTMENT);
Group hrDep = pm.createGroup("HR", DEPARTMENT);
            

At the SPI level both Group and User are mapped as IdentityObject. What differentiate them is the IdentityObjectType. IdentityObjectType "USER" is mapped to represent User objects while other are mapped to represent different Group types names.