I solved this by writing a dynamic query as shown below. I do not know if this is right or not. Can anyone see and answer?
public static List<User> getallActiveUsers() {
List<User> activeUsers = new ArrayList<User>();
Criterion stageCriterion = null;
int deactiveStatus = 5;
DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(User.class);
stageCriterion = PropertyFactoryUtil.forName("status").ne(deactiveStatus);
dynamicQuery.add(stageCriterion);
try {
activeUsers = UserLocalServiceUtil.dynamicQuery(dynamicQuery);
} catch (SystemException e) {
e.printStackTrace();
}
_log.info("ALL ACTIVE USERS"+activeUsers.toString());
_log.info("ALL ACTIVE Size"+activeUsers.size());
return activeUsers;
}
source
share