use of org.wso2.carbon.identity.user.store.configuration.utils.IdentityUserStoreMgtException in project carbon-identity-framework by wso2.
the class AbstractUserStoreDAO method getUserStoreProperty.
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;
}
use of org.wso2.carbon.identity.user.store.configuration.utils.IdentityUserStoreMgtException in project carbon-identity-framework by wso2.
the class AbstractUserStoreDAO method addUserStore.
@Override
public void addUserStore(UserStoreDTO userStoreDTO) throws IdentityUserStoreMgtException {
UserStorePersistanceDTO userStorePersistanceDTO = getUserStorePersistanceDTO(userStoreDTO, getUserStoreProperties(userStoreDTO, userStoreDTO.getDomainId()));
doAddUserStore(userStorePersistanceDTO);
}
use of org.wso2.carbon.identity.user.store.configuration.utils.IdentityUserStoreMgtException in project carbon-identity-framework by wso2.
the class AbstractUserStoreDAO method getUserStores.
@Override
public UserStoreDTO[] getUserStores() throws IdentityUserStoreMgtException {
UserStorePersistanceDTO[] userStorePersistanceDTOS = doGetAllUserStores();
List<UserStoreDTO> userStoreDTOs = new ArrayList<>();
for (UserStorePersistanceDTO userStorePersistanceDTO : userStorePersistanceDTOS) {
userStoreDTOs.add(userStorePersistanceDTO.getUserStoreDTO());
}
return userStoreDTOs.toArray(new UserStoreDTO[userStoreDTOs.size()]);
}
use of org.wso2.carbon.identity.user.store.configuration.utils.IdentityUserStoreMgtException in project carbon-identity-framework by wso2.
the class DatabaseBasedUserStoreDAOImpl method deleteUserStore.
private void deleteUserStore(String domain, int tenantId) throws IdentityUserStoreMgtException {
String msg = "Error while removing the user store with the domain name: " + domain + " in the tenant: " + tenantId;
try (Connection connection = IdentityDatabaseUtil.getDBConnection()) {
try (PreparedStatement ps = connection.prepareStatement(UserStoreMgtDBQueries.DELETE_USERSTORE_PROPERTIES)) {
ps.setString(1, domain);
ps.setInt(2, tenantId);
ps.setString(3, USERSTORE);
ps.executeUpdate();
if (log.isDebugEnabled()) {
log.debug("The userstore domain :" + domain + "removed for the tenant" + tenantId);
}
IdentityDatabaseUtil.commitTransaction(connection);
} catch (SQLException e) {
IdentityDatabaseUtil.rollbackTransaction(connection);
throw new IdentityUserStoreMgtException(msg, e);
}
} catch (SQLException e) {
throw new IdentityUserStoreMgtException(msg, e);
}
}
use of org.wso2.carbon.identity.user.store.configuration.utils.IdentityUserStoreMgtException in project carbon-identity-framework by wso2.
the class UserStoreConfigAdminService method changeUserStoreState.
/**
* Update a domain to be disabled/enabled in file repository.
*
* @param domain Name of the domain to be updated
* @param isDisable Whether to disable/enable domain(true/false)
* @throws IdentityUserStoreMgtException If error occurs during domain validation
* @throws TransformerConfigurationException If error occurs during configuration transformation
*/
public void changeUserStoreState(String domain, Boolean isDisable) throws IdentityUserStoreMgtException, TransformerConfigurationException {
validateDomain(domain, isDisable);
try {
triggerListenersOnUserStorePreStateChange(domain, isDisable);
} catch (UserStoreException e) {
throw new IdentityUserStoreMgtException("Error occurred while triggering the user store pre state change" + " listeners.");
}
UserStoreDTO userStoreDTO = getUserStoreDTO(domain, isDisable, null);
updateStateInFileRepository(userStoreDTO);
}
Aggregations