@Override public Role updateRole(final long roleId, final RoleUpdater updateDescriptor) throws RoleNotFoundException, UpdateException { if (updateDescriptor == null || updateDescriptor.getFields().isEmpty()) { throw new UpdateException("The update descriptor does not contain field updates"); } final TenantServiceAccessor tenantAccessor = getTenantAccessor(); final IdentityService identityService = tenantAccessor.getIdentityService(); try { final EntityUpdateDescriptor changeDescriptor = getRoleUpdateDescriptor(updateDescriptor, tenantAccessor.getTechnicalLoggerService()); return ModelConvertor.toRole(identityService.updateRole(identityService.getRole(roleId), changeDescriptor, getIconUpdater(updateDescriptor))); } catch (final SRoleNotFoundException e) { throw new RoleNotFoundException(e); } catch (SIdentityException e) { throw new UpdateException(e); } }
@Override public Role updateRole(final long roleId, final RoleUpdater updateDescriptor) throws RoleNotFoundException, UpdateException { if (updateDescriptor == null || updateDescriptor.getFields().isEmpty()) { throw new UpdateException("The update descriptor does not contain field updates"); } final TenantServiceAccessor tenantAccessor = getTenantAccessor(); final IdentityService identityService = tenantAccessor.getIdentityService(); try { final EntityUpdateDescriptor changeDescriptor = getRoleUpdateDescriptor(updateDescriptor, tenantAccessor.getTechnicalLoggerService()); return ModelConvertor.toRole(identityService.updateRole(identityService.getRole(roleId), changeDescriptor, getIconUpdater(updateDescriptor))); } catch (final SRoleNotFoundException e) { throw new RoleNotFoundException(e); } catch (SIdentityException e) { throw new UpdateException(e); } }
@Override public Group updateGroup(final long groupId, final GroupUpdater updater) throws GroupNotFoundException, UpdateException, AlreadyExistsException { if (updater == null || updater.getFields().isEmpty()) { throw new UpdateException("The update descriptor does not contain field updates"); } final TenantServiceAccessor tenantAccessor = getTenantAccessor(); final IdentityService identityService = tenantAccessor.getIdentityService(); try { checkPathUnicity(groupId, updater, identityService); final EntityUpdateDescriptor changeDescriptor = getGroupUpdateDescriptor(updater, tenantAccessor.getTechnicalLoggerService()); return ModelConvertor.toGroup(new UpdateGroup(groupId, changeDescriptor, identityService, getIconUpdater(updater)).update()); } catch (final SGroupNotFoundException e) { throw new GroupNotFoundException(e); } catch (final SIdentityException sbe) { throw new UpdateException(sbe); } }
@Override public Group updateGroup(final long groupId, final GroupUpdater updater) throws GroupNotFoundException, UpdateException, AlreadyExistsException { if (updater == null || updater.getFields().isEmpty()) { throw new UpdateException("The update descriptor does not contain field updates"); } final TenantServiceAccessor tenantAccessor = getTenantAccessor(); final IdentityService identityService = tenantAccessor.getIdentityService(); try { checkPathUnicity(groupId, updater, identityService); final EntityUpdateDescriptor changeDescriptor = getGroupUpdateDescriptor(updater, tenantAccessor.getTechnicalLoggerService()); return ModelConvertor.toGroup(new UpdateGroup(groupId, changeDescriptor, identityService, getIconUpdater(updater)).update()); } catch (final SGroupNotFoundException e) { throw new GroupNotFoundException(e); } catch (final SIdentityException sbe) { throw new UpdateException(sbe); } }
@Override public User updateUser(final long userId, final UserUpdater updater) throws UserNotFoundException, UpdateException { if (updater == null || !updater.hasFields()) { throw new UpdateException("The update descriptor does not contain field updates"); } final TenantServiceAccessor tenantAccessor = getTenantAccessor(); final IdentityService identityService = tenantAccessor.getIdentityService(); // User change final EntityUpdateDescriptor userUpdateDescriptor = getUserUpdateDescriptor(updater, tenantAccessor.getTechnicalLoggerService()); // Personal data change final EntityUpdateDescriptor personalDataUpdateDescriptor = getUserContactInfoUpdateDescriptor(updater.getPersoContactUpdater()); // Professional data change final EntityUpdateDescriptor professionalDataUpdateDescriptor = getUserContactInfoUpdateDescriptor(updater.getProContactUpdater()); final EntityUpdateDescriptor iconUpdater = getIconUpdater(updater); try { SUser sUser = identityService.updateUser(userId, userUpdateDescriptor, personalDataUpdateDescriptor, professionalDataUpdateDescriptor, iconUpdater); return ModelConvertor.toUser(sUser); } catch (final SUserNotFoundException e) { throw new UserNotFoundException(e); } catch (final SBonitaException e) { throw new UpdateException(e); } }
@Override public User updateUser(final long userId, final UserUpdater updater) throws UserNotFoundException, UpdateException { if (updater == null || !updater.hasFields()) { throw new UpdateException("The update descriptor does not contain field updates"); } final TenantServiceAccessor tenantAccessor = getTenantAccessor(); final IdentityService identityService = tenantAccessor.getIdentityService(); // User change final EntityUpdateDescriptor userUpdateDescriptor = getUserUpdateDescriptor(updater, tenantAccessor.getTechnicalLoggerService()); // Personal data change final EntityUpdateDescriptor personalDataUpdateDescriptor = getUserContactInfoUpdateDescriptor(updater.getPersoContactUpdater()); // Professional data change final EntityUpdateDescriptor professionalDataUpdateDescriptor = getUserContactInfoUpdateDescriptor(updater.getProContactUpdater()); final EntityUpdateDescriptor iconUpdater = getIconUpdater(updater); try { SUser sUser = identityService.updateUser(userId, userUpdateDescriptor, personalDataUpdateDescriptor, professionalDataUpdateDescriptor, iconUpdater); return ModelConvertor.toUser(sUser); } catch (final SUserNotFoundException e) { throw new UserNotFoundException(e); } catch (final SBonitaException e) { throw new UpdateException(e); } }