Package org.wso2.carbon.user.core

Examples of org.wso2.carbon.user.core.UserStoreException


            if (sqlStmt == null) {
                sqlStmt = realmConfig
                        .getUserStoreProperty(JDBCRealmConstants.ADD_USER_PROPERTY);
            }
            if (sqlStmt == null) {
                throw new UserStoreException("The sql statement for add user property sql is null");
            }
            updateStringValuesToDatabase(dbConnection, sqlStmt, userName, tenantId, propertyName,
                    value, profileName, tenantId);
        } catch (UserStoreException e) {
            throw e;
        } catch (Exception e) {
            log.error(e.getMessage(), e);
            throw new UserStoreException(e.getMessage(), e);
        }
    }
View Full Code Here


    protected void updateProperty(Connection dbConnection, String userName, String propertyName,
            String value, String profileName) throws UserStoreException {
        String sqlStmt = realmConfig
                .getUserStoreProperty(JDBCRealmConstants.UPDATE_USER_PROPERTY);
        if (sqlStmt == null) {
            throw new UserStoreException("The sql statement for add user property sql is null");
        }
        updateStringValuesToDatabase(dbConnection, sqlStmt, value, userName, tenantId,
                propertyName, profileName, tenantId);
    }
View Full Code Here

    protected void deleteProperty(Connection dbConnection, String userName, String propertyName,
            String profileName) throws UserStoreException {
        String sqlStmt = realmConfig
                .getUserStoreProperty(JDBCRealmConstants.DELETE_USER_PROPERTY);
        if (sqlStmt == null) {
            throw new UserStoreException("The sql statement for add user property sql is null");
        }
        updateStringValuesToDatabase(dbConnection, sqlStmt, userName, tenantId, propertyName,
                profileName, tenantId);
    }
View Full Code Here

    protected String getProperty(Connection dbConnection, String userName, String propertyName,
            String profileName) throws UserStoreException {
        String sqlStmt = realmConfig
                .getUserStoreProperty(JDBCRealmConstants.GET_PROP_FOR_PROFILE);
        if (sqlStmt == null) {
            throw new UserStoreException("The sql statement for add user property sql is null");
        }
        PreparedStatement prepStmt = null;
        ResultSet rs = null;
        String value = null;
        try {
            prepStmt = dbConnection.prepareStatement(sqlStmt);
            prepStmt.setString(1, userName);
            prepStmt.setString(2, propertyName);
            prepStmt.setString(3, profileName);
            if (sqlStmt.contains(UserCoreConstants.UM_TENANT_COLUMN)) {
                prepStmt.setInt(4, tenantId);
                prepStmt.setInt(5, tenantId);
            }

            rs = prepStmt.executeQuery();
            while (rs.next()) {
                value = rs.getString(1);
            }
            return value;
        } catch (SQLException e) {
            log.error(e.getMessage(), e);
            log.error("Using sql : " + sqlStmt);
            throw new UserStoreException(e.getMessage(), e);
        } finally {
            DatabaseUtil.closeAllConnections(null, rs, prepStmt);
        }
    }
View Full Code Here

                password = Base64.encode(byteValue);
            }
            return password;
        } catch (NoSuchAlgorithmException e) {
            log.error(e.getMessage(), e);
            throw new UserStoreException(e.getMessage(), e);
        }
    }
View Full Code Here

        } else {
            if (!isExistingUser(realmConfig.getAdminUserName())) {
                if ("true".equals(realmConfig
                        .getUserStoreProperty(UserCoreConstants.RealmConfig.PROPERTY_READ_ONLY))) {
                    log.error("Admin user name is not valid");
                    throw new UserStoreException("Admin user name is not valid");
                }
                // it is not required to notify to the listeners, just persist data.
                this.persistUser(realmConfig.getAdminUserName(), realmConfig.getAdminPassword(),
                        null, null, null, false);
            }
View Full Code Here

                        tenantId);
            }
            dbConnection.commit();
        } catch (SQLException e) {
            log.error(e.getMessage(), e);
            throw new UserStoreException(e.getMessage(), e);
        } catch (Exception e) {
            log.error(e.getMessage(), e);
            throw new UserStoreException(e.getMessage(), e);
        } finally {
            DatabaseUtil.closeAllConnections(dbConnection);
        }
    }
View Full Code Here

                createdTime = rs.getTimestamp(2);
            }
        } catch (SQLException e) {
            log.error(e.getMessage(), e);
            log.error("Using sql : " + HybridJDBCConstants.GET_REMEMBERME_VALUE_SQL);
            throw new UserStoreException(e.getMessage(), e);
        } finally {
            DatabaseUtil.closeAllConnections(null, rs, prepStmt);
        }

        if (value != null && createdTime != null) {
View Full Code Here

                    if (context != null && context.getRealmService() != null) {
                        try {
                            tenantId = context.getRealmService().getTenantManager().getTenantId(
                                    tenantIdString);
                        } catch (org.wso2.carbon.user.api.UserStoreException e) {
                            throw new UserStoreException(e);
                        }
                    }
                }
            }
View Full Code Here

                        roleName, tenantId, tenantId);
            }
            dbConnection.commit();
        } catch (SQLException e) {
            log.error(e.getMessage(), e);
            throw new UserStoreException(e.getMessage(), e);
        } catch (Exception e) {
            log.error(e.getMessage(), e);
            throw new UserStoreException(e.getMessage(), e);
        } finally {
            DatabaseUtil.closeAllConnections(dbConnection);
        }
    }
View Full Code Here

TOP

Related Classes of org.wso2.carbon.user.core.UserStoreException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.