private SGroup addGroup(final ExportedGroup exportedGroup) throws SGroupCreationException { final SGroup sGroup = ModelConvertor.constructSGroup(exportedGroup); identityService.createGroup(sGroup, null, null); return sGroup; }
private SGroup addGroup(final ExportedGroup exportedGroup) throws SGroupCreationException { final SGroup sGroup = ModelConvertor.constructSGroup(exportedGroup); identityService.createGroup(sGroup, null, null); return sGroup; }
@Override public Group createGroup(final GroupCreator creator) throws CreationException { if (creator == null) { throw new CreationException("Cannot create a null group"); } String groupName = creator.getFields().get(GroupCreator.GroupField.NAME).toString(); if (groupName.contains("/")) { throw new InvalidGroupNameException("Cannot create a group with '/' in its name"); } final TenantServiceAccessor tenantAccessor = getTenantAccessor(); final IdentityService identityService = tenantAccessor.getIdentityService(); if (creator.getFields().containsKey(GroupCreator.GroupField.ICON_NAME) || creator.getFields().containsKey(GroupCreator.GroupField.ICON_PATH)) { tenantAccessor.getTechnicalLoggerService().log(IdentityAPIImpl.class, TechnicalLogSeverity.WARNING, "setIconName and setIconPath are deprecated, use setIcon instead"); } final SGroup sGroup = ModelConvertor.constructSGroup(creator); try { identityService.getGroupByPath(sGroup.getPath()); throw new AlreadyExistsException("Group named \"" + sGroup.getName() + "\" already exists"); } catch (final SGroupNotFoundException ignored) { } try { identityService.createGroup(sGroup, (String) creator.getFields().get(GroupCreator.GroupField.ICON_FILENAME), (byte[]) creator.getFields().get(GroupCreator.GroupField.ICON_CONTENT)); } catch (SGroupCreationException e) { throw new CreationException(e); } return ModelConvertor.toGroup(sGroup); }
@Override public Group createGroup(final GroupCreator creator) throws CreationException { if (creator == null) { throw new CreationException("Cannot create a null group"); } String groupName = creator.getFields().get(GroupCreator.GroupField.NAME).toString(); if (groupName.contains("/")) { throw new InvalidGroupNameException("Cannot create a group with '/' in its name"); } final TenantServiceAccessor tenantAccessor = getTenantAccessor(); final IdentityService identityService = tenantAccessor.getIdentityService(); if (creator.getFields().containsKey(GroupCreator.GroupField.ICON_NAME) || creator.getFields().containsKey(GroupCreator.GroupField.ICON_PATH)) { tenantAccessor.getTechnicalLoggerService().log(IdentityAPIImpl.class, TechnicalLogSeverity.WARNING, "setIconName and setIconPath are deprecated, use setIcon instead"); } final SGroup sGroup = ModelConvertor.constructSGroup(creator); try { identityService.getGroupByPath(sGroup.getPath()); throw new AlreadyExistsException("Group named \"" + sGroup.getName() + "\" already exists"); } catch (final SGroupNotFoundException ignored) { } try { identityService.createGroup(sGroup, (String) creator.getFields().get(GroupCreator.GroupField.ICON_FILENAME), (byte[]) creator.getFields().get(GroupCreator.GroupField.ICON_CONTENT)); } catch (SGroupCreationException e) { throw new CreationException(e); } return ModelConvertor.toGroup(sGroup); }