use of com.liferay.portal.model.Organization in project liferay-ide by liferay.
the class UserLocalServiceImpl method updateOrganizations.
protected void updateOrganizations(long userId, long[] newOrganizationIds, boolean indexingEnabled) throws PortalException, SystemException {
if (newOrganizationIds == null) {
return;
}
List<Organization> oldOrganizations = userPersistence.getOrganizations(userId);
Set<Long> oldOrganizationIds = new HashSet<Long>(oldOrganizations.size());
for (Organization oldOrganization : oldOrganizations) {
long oldOrganizationId = oldOrganization.getOrganizationId();
oldOrganizationIds.add(oldOrganizationId);
if (!ArrayUtil.contains(newOrganizationIds, oldOrganizationId)) {
unsetOrganizationUsers(oldOrganizationId, new long[] { userId });
}
}
for (long newOrganizationId : newOrganizationIds) {
if (!oldOrganizationIds.contains(newOrganizationId)) {
addOrganizationUsers(newOrganizationId, new long[] { userId });
}
}
if (indexingEnabled) {
Indexer indexer = IndexerRegistryUtil.nullSafeGetIndexer(User.class);
indexer.reindex(new long[] { userId });
}
PermissionCacheUtil.clearCache();
}
use of com.liferay.portal.model.Organization in project liferay-ide by liferay.
the class UserLocalServiceImpl method getOrganizationUsersCount.
/**
* Returns the number of users with the status belonging to the
* organization.
*
* @param organizationId the primary key of the organization
* @param status the workflow status
* @return the number of users with the status belonging to the organization
* @throws PortalException if an organization with the primary key could not
* be found
* @throws SystemException if a system exception occurred
*/
@Override
public int getOrganizationUsersCount(long organizationId, int status) throws PortalException, SystemException {
Organization organization = organizationPersistence.findByPrimaryKey(organizationId);
LinkedHashMap<String, Object> params = new LinkedHashMap<String, Object>();
params.put("usersOrgs", new Long(organizationId));
return searchCount(organization.getCompanyId(), null, status, params);
}
Aggregations