Java Code Examples for org.wso2.carbon.identity.user.store.configuration.dto.UserStoreDTO#getProperties()
The following examples show how to use
org.wso2.carbon.identity.user.store.configuration.dto.UserStoreDTO#getProperties() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractUserStoreDAO.java From carbon-identity-framework with Apache License 2.0 | 6 votes |
private UserStoreDTO getUserStoreProperty(UserStoreDTO userStoreDTO) throws IdentityUserStoreMgtException { boolean newState = userStoreDTO.getDisabled(); UserStoreDTO userStoreDTOTemp = getUserStore(userStoreDTO.getDomainId()); if (userStoreDTOTemp != null) { userStoreDTO = userStoreDTOTemp; userStoreDTO.setDisabled(newState); PropertyDTO[] propertyDTO = userStoreDTO.getProperties(); for (PropertyDTO propertyDTOValue : propertyDTO) { if (propertyDTOValue.getName().equals(DISABLED)) { propertyDTOValue.setValue(String.valueOf(newState)); } } } return userStoreDTO; }
Example 2
Source File: ServerUserStoreService.java From identity-api-server with Apache License 2.0 | 5 votes |
/** * Retrieve user store by its domain id. * * @param domainId the user store domain id. * @return UserStoreConfigurationsRes. */ public UserStoreConfigurationsRes getUserStoreByDomainId(String domainId) { UserStoreConfigService userStoreConfigService = UserStoreConfigServiceHolder.getInstance() .getUserStoreConfigService(); List<AddUserStorePropertiesRes> propertiesTobeAdd = new ArrayList<>(); try { UserStoreDTO userStoreDTO = userStoreConfigService.getUserStore(base64URLDecodeId(domainId)); if (userStoreDTO == null) { throw handleException(Response.Status.NOT_FOUND, UserStoreConstants.ErrorMessage. ERROR_CODE_NOT_FOUND); } UserStoreConfigurationsRes userStoreConfigurations = new UserStoreConfigurationsRes(); userStoreConfigurations.setClassName(userStoreDTO.getClassName()); userStoreConfigurations.setDescription(userStoreDTO.getDescription()); userStoreConfigurations.setName(userStoreDTO.getDomainId()); userStoreConfigurations.setTypeId(base64URLEncodeId(Objects.requireNonNull (getUserStoreTypeName(userStoreDTO.getClassName())))); userStoreConfigurations.setTypeName(getUserStoreTypeName(userStoreDTO.getClassName())); PropertyDTO[] dtoProperties = userStoreDTO.getProperties(); for (PropertyDTO propertyDTO : dtoProperties) { AddUserStorePropertiesRes userStorePropertiesRes = new AddUserStorePropertiesRes(); userStorePropertiesRes.setName(propertyDTO.getName()); userStorePropertiesRes.setValue(propertyDTO.getValue()); propertiesTobeAdd.add(userStorePropertiesRes); } userStoreConfigurations.setProperties(propertiesTobeAdd); return userStoreConfigurations; } catch (IdentityUserStoreMgtException e) { UserStoreConstants.ErrorMessage errorEnum = UserStoreConstants.ErrorMessage.ERROR_CODE_ERROR_RETRIEVING_USER_STORE_BY_DOMAIN_ID; throw handleIdentityUserStoreMgtException(e, errorEnum); } }
Example 3
Source File: ServerUserStoreService.java From identity-api-server with Apache License 2.0 | 5 votes |
/** * To handle the patch REPLACE request. * * @param domainId user store domain id. * @param path patch operation path * @param value property value * @return UserStoreResponse */ private UserStoreResponse performPatchReplace(String domainId, String path, String value) { UserStoreConfigService userStoreConfigService = UserStoreConfigServiceHolder.getInstance() .getUserStoreConfigService(); try { UserStoreDTO userStoreDTO = userStoreConfigService.getUserStore(base64URLDecodeId(domainId)); if (userStoreDTO == null) { throw handleException(Response.Status.NOT_FOUND, UserStoreConstants.ErrorMessage.ERROR_CODE_NOT_FOUND); } if (StringUtils.isBlank(path)) { throw handleException(Response.Status.BAD_REQUEST, UserStoreConstants.ErrorMessage .ERROR_CODE_INVALID_INPUT); } PropertyDTO[] propertyDTOS = userStoreDTO.getProperties(); if (path.startsWith(UserStoreConstants.USER_STORE_PROPERTIES)) { String[] propertiesList = path.split("/"); for (PropertyDTO propertyDTO : propertyDTOS) { if (propertiesList[2].equals(propertyDTO.getName())) { propertyDTO.setValue(value); } } } else if (path.equals(UserStoreConstants.USER_STORE_DESCRIPTION)) { userStoreDTO.setDescription(value); } else { throw handleException(Response.Status.BAD_REQUEST, UserStoreConstants.ErrorMessage .ERROR_CODE_INVALID_INPUT); } userStoreDTO.setProperties(propertyDTOS); userStoreConfigService.updateUserStore(userStoreDTO, false); return buildResponseForPatchReplace(userStoreDTO, propertyDTOS); } catch (IdentityUserStoreMgtException e) { UserStoreConstants.ErrorMessage errorEnum = UserStoreConstants.ErrorMessage.ERROR_CODE_ERROR_UPDATING_USER_STORE; throw handleIdentityUserStoreMgtException(e, errorEnum); } }
Example 4
Source File: ServerUserStoreService.java From identity-api-server with Apache License 2.0 | 5 votes |
/** * Add requested user store properties to the response. * * @param userStoreDTO userStoreDTO object. * @param userStoreListResponse userStoreListResponse object. * @param requestedAttributesList Requested user store properties name list. */ private void addUserstoreProperties(UserStoreDTO userStoreDTO, UserStoreListResponse userStoreListResponse, List<String> requestedAttributesList) { for (PropertyDTO propertyDTO : userStoreDTO.getProperties()) { if (requestedAttributesList.contains(propertyDTO.getName()) && StringUtils.isNotBlank(propertyDTO.getValue())) { AddUserStorePropertiesRes addUserStorePropertiesRes = new AddUserStorePropertiesRes(); addUserStorePropertiesRes.setName(propertyDTO.getName()); addUserStorePropertiesRes.setValue(propertyDTO.getValue()); userStoreListResponse.addPropertiesItem(addUserStorePropertiesRes); } } }