private List<Long> getIds(final List<SCustomUserInfoDefinition> definitions) { List<Long> ids = new ArrayList<Long>(definitions.size()); for (SCustomUserInfoDefinition definition : definitions) { ids.add(definition.getId()); } return ids; } }
private List<Long> getIds(final List<SCustomUserInfoDefinition> definitions) { List<Long> ids = new ArrayList<Long>(definitions.size()); for (SCustomUserInfoDefinition definition : definitions) { ids.add(definition.getId()); } return ids; } }
private static Map<Long, String> getUserInfoDefinitionNames(final List<SCustomUserInfoDefinition> userInfoDefinitions) { final Map<Long, String> names = new HashMap<>(userInfoDefinitions.size()); for (final SCustomUserInfoDefinition userInfoDefinition : userInfoDefinitions) { names.put(userInfoDefinition.getId(), userInfoDefinition.getName()); } return names; }
private void deleteCustomUserInfo(List<SCustomUserInfoDefinition> customUserInfoDefinitions, IdentityService identityService) throws SIdentityException { for (SCustomUserInfoDefinition definition : customUserInfoDefinitions) { identityService.deleteCustomUserInfoDefinition(definition.getId()); } }
private static Map<Long, String> getUserInfoDefinitionNames(final List<SCustomUserInfoDefinition> userInfoDefinitions) { final Map<Long, String> names = new HashMap<>(userInfoDefinitions.size()); for (final SCustomUserInfoDefinition userInfoDefinition : userInfoDefinitions) { names.put(userInfoDefinition.getId(), userInfoDefinition.getName()); } return names; }
private void deleteCustomUserInfo(List<SCustomUserInfoDefinition> customUserInfoDefinitions, IdentityService identityService) throws SIdentityException { for (SCustomUserInfoDefinition definition : customUserInfoDefinitions) { identityService.deleteCustomUserInfoDefinition(definition.getId()); } }
public List<CustomUserInfo> list(final long userId, final int startIndex, final int maxResult) throws SIdentityException, SBonitaReadException { List<SCustomUserInfoDefinition> definitions = service.getCustomUserInfoDefinitions(startIndex, maxResult); if (definitions.size() == 0) { return Collections.emptyList(); } Map<Long, CustomUserInfoValue> values = transform(searchCorrespondingValues(userId, definitions)); List<CustomUserInfo> info = new ArrayList<CustomUserInfo>(); for (SCustomUserInfoDefinition definition : definitions) { info.add(new CustomUserInfo(userId, ModelConvertor.convert(definition), values.get(definition.getId()))); } return info; }
public List<CustomUserInfo> list(final long userId, final int startIndex, final int maxResult) throws SIdentityException, SBonitaReadException { List<SCustomUserInfoDefinition> definitions = service.getCustomUserInfoDefinitions(startIndex, maxResult); if (definitions.size() == 0) { return Collections.emptyList(); } Map<Long, CustomUserInfoValue> values = transform(searchCorrespondingValues(userId, definitions)); List<CustomUserInfo> info = new ArrayList<CustomUserInfo>(); for (SCustomUserInfoDefinition definition : definitions) { info.add(new CustomUserInfo(userId, ModelConvertor.convert(definition), values.get(definition.getId()))); } return info; }
private SCustomUserInfoDefinitionCreationException handleCustomUserInfoDefinitionCreationFailure(final SCustomUserInfoDefinition customUserInfo, final String methodName, final SCustomUserInfoDefinitionLogBuilder logBuilder, final SBonitaException exception) { log(customUserInfo.getId(), SQueriableLog.STATUS_FAIL, logBuilder, methodName); return new SCustomUserInfoDefinitionCreationException(customUserInfo.getName(), exception); }
private SCustomUserInfoDefinitionCreationException handleCustomUserInfoDefinitionCreationFailure(final SCustomUserInfoDefinition customUserInfo, final String methodName, final SCustomUserInfoDefinitionLogBuilder logBuilder, final SBonitaException exception) { log(customUserInfo.getId(), SQueriableLog.STATUS_FAIL, logBuilder, methodName); return new SCustomUserInfoDefinitionCreationException(customUserInfo.getName(), exception); }
@Override public void deleteCustomUserInfoDefinition(final SCustomUserInfoDefinition info) throws SIdentityException { final String methodName = "deleteCustomUserInfoDefinition"; final SCustomUserInfoDefinitionLogBuilder logBuilder = getSCustomUserInfoDefinitionLog(ActionType.DELETED, "Deleting profile custom user info definition with name " + info.getName()); try { recorder.recordDelete(new DeleteRecord(info), CUSTOM_USER_INFO_DEFINITION); log(info.getId(), SQueriableLog.STATUS_OK, logBuilder, methodName); } catch (final SRecorderException e) { log(info.getId(), SQueriableLog.STATUS_FAIL, logBuilder, methodName); throw new SIdentityException("Can't delete profile custom user info definition " + info, e); } }
public void imporCustomUserInfoValues(List<ExportedCustomUserInfoValue> customUserInfoValues, long persistedUserId) throws SBonitaException { for (ExportedCustomUserInfoValue infoValue : customUserInfoValues) { SCustomUserInfoDefinition infoDefinition = customUserInfoDefinitions.get(infoValue.getName()); if (infoDefinition == null) { String message = "The XML file is inconsistent. A custom user info value is refenced with name '" + infoValue.getName() + "', but no custom user info definition is defined with this name."; throw new SImportOrganizationException(message); } userInfoAPI.set(infoDefinition.getId(), persistedUserId, infoValue.getValue()); } }
@Override public void updateCustomUserInfoDefinition(final SCustomUserInfoDefinition customUserInfo, final EntityUpdateDescriptor descriptor) throws SIdentityException { final String methodName = "updateCustomUserInfoDefinition"; final SCustomUserInfoDefinitionLogBuilder logBuilder = getSCustomUserInfoDefinitionLog(ActionType.UPDATED, "Updating the custom user info definition with name " + customUserInfo.getName()); try { recorder.recordUpdate(UpdateRecord.buildSetFields(customUserInfo, descriptor), CUSTOM_USER_INFO_DEFINITION); log(customUserInfo.getId(), SQueriableLog.STATUS_OK, logBuilder, methodName); } catch (final SRecorderException e) { log(customUserInfo.getId(), SQueriableLog.STATUS_FAIL, logBuilder, methodName); throw new SIdentityException("Can't update custom user info definition " + customUserInfo, e); } }
public void imporCustomUserInfoValues(List<ExportedCustomUserInfoValue> customUserInfoValues, long persistedUserId) throws SBonitaException { for (ExportedCustomUserInfoValue infoValue : customUserInfoValues) { SCustomUserInfoDefinition infoDefinition = customUserInfoDefinitions.get(infoValue.getName()); if (infoDefinition == null) { String message = "The XML file is inconsistent. A custom user info value is refenced with name '" + infoValue.getName() + "', but no custom user info definition is defined with this name."; throw new SImportOrganizationException(message); } userInfoAPI.set(infoDefinition.getId(), persistedUserId, infoValue.getValue()); } }
@Override public void deleteCustomUserInfoDefinition(final SCustomUserInfoDefinition info) throws SIdentityException { final String methodName = "deleteCustomUserInfoDefinition"; final SCustomUserInfoDefinitionLogBuilder logBuilder = getSCustomUserInfoDefinitionLog(ActionType.DELETED, "Deleting profile custom user info definition with name " + info.getName()); try { recorder.recordDelete(new DeleteRecord(info), CUSTOM_USER_INFO_DEFINITION); log(info.getId(), SQueriableLog.STATUS_OK, logBuilder, methodName); } catch (final SRecorderException e) { log(info.getId(), SQueriableLog.STATUS_FAIL, logBuilder, methodName); throw new SIdentityException("Can't delete profile custom user info definition " + info, e); } }
private void updateCustomUserInfoValues(final ExportedUser userToImport, final long existingUserId) throws SBonitaException { for (final ExportedCustomUserInfoValue infoValue : userToImport.getCustomUserInfoValues()) { final SCustomUserInfoDefinition customUserInfoDefinition = identityService.getCustomUserInfoDefinitionByName(infoValue.getName()); userInfoValueAPI.set(customUserInfoDefinition.getId(), existingUserId, infoValue.getValue()); } }
private void updateCustomUserInfoValues(final ExportedUser userToImport, final long existingUserId) throws SBonitaException { for (final ExportedCustomUserInfoValue infoValue : userToImport.getCustomUserInfoValues()) { final SCustomUserInfoDefinition customUserInfoDefinition = identityService.getCustomUserInfoDefinitionByName(infoValue.getName()); userInfoValueAPI.set(customUserInfoDefinition.getId(), existingUserId, infoValue.getValue()); } }
public static CustomUserInfoDefinitionImpl convert(final SCustomUserInfoDefinition sDefinition) { final CustomUserInfoDefinitionImpl definition = new CustomUserInfoDefinitionImpl(); definition.setId(sDefinition.getId()); definition.setName(sDefinition.getName()); definition.setDescription(sDefinition.getDescription()); return definition; }
public static CustomUserInfoDefinitionImpl convert(final SCustomUserInfoDefinition sDefinition) { final CustomUserInfoDefinitionImpl definition = new CustomUserInfoDefinitionImpl(); definition.setId(sDefinition.getId()); definition.setName(sDefinition.getName()); definition.setDescription(sDefinition.getDescription()); return definition; }
@Override public SCustomUserInfoDefinition createCustomUserInfoDefinition(final SCustomUserInfoDefinition customUserInfo) throws SCustomUserInfoDefinitionAlreadyExistsException, SCustomUserInfoDefinitionCreationException { final String methodName = "createCustomUserInfoDefinition"; final SCustomUserInfoDefinitionLogBuilder logBuilder = getSCustomUserInfoDefinitionLog(ActionType.CREATED, "Adding a custom user info with name " + customUserInfo.getName()); try { throwExceptionIfAlreadyExists(customUserInfo); recorder.recordInsert(new InsertRecord(customUserInfo), CUSTOM_USER_INFO_DEFINITION); log(customUserInfo.getId(), SQueriableLog.STATUS_OK, logBuilder, methodName); return customUserInfo; } catch (final SRecorderException | SBonitaReadException e) { throw handleCustomUserInfoDefinitionCreationFailure(customUserInfo, methodName, logBuilder, e); } }