removed getBySubject and getAll from user info repository and service layers, closes #760

pull/779/head
Justin Richer 2015-02-16 11:07:41 -05:00
parent 63dd7c0b25
commit ef3a696972
5 changed files with 5 additions and 57 deletions

View File

@ -33,9 +33,7 @@ import com.google.gson.JsonObject;
@Entity
@Table(name="user_info")
@NamedQueries({
@NamedQuery(name="DefaultUserInfo.getAll", query = "select u from DefaultUserInfo u"),
@NamedQuery(name="DefaultUserInfo.getByUsername", query = "select u from DefaultUserInfo u WHERE u.preferredUsername = :username"),
@NamedQuery(name="DefaultUserInfo.getBySubject", query = "select u from DefaultUserInfo u WHERE u.sub = :sub")
@NamedQuery(name="DefaultUserInfo.getByUsername", query = "select u from DefaultUserInfo u WHERE u.preferredUsername = :username")
})
public class DefaultUserInfo implements UserInfo {

View File

@ -16,8 +16,6 @@
******************************************************************************/
package org.mitre.openid.connect.repository;
import java.util.Collection;
import org.mitre.openid.connect.model.UserInfo;
/**
@ -29,37 +27,21 @@ import org.mitre.openid.connect.model.UserInfo;
public interface UserInfoRepository {
/**
* Returns the UserInfo for the given subject
*
* @param sub
* the subject of the UserInfo
* @return a valid UserInfo if it exists, null otherwise
*/
public UserInfo getBySubject(String sub);
/**
* Persists a UserInfo
* Persists a UserInfo object, if possible.
*
* @param user
* @return
* @return the persisted object
*/
public UserInfo save(UserInfo userInfo);
/**
* Removes the given UserInfo from the repository
* Removes the given UserInfo from the repository, if possible.
*
* @param userInfo
* the UserInfo object to remove
*/
public void remove(UserInfo userInfo);
/**
* Return a collection of all UserInfos managed by this repository
*
* @return the UserInfo collection, or null
*/
public Collection<? extends UserInfo> getAll();
/**
* Get a UserInfo object by its preferred_username field
* @param username

View File

@ -34,15 +34,6 @@ public interface UserInfoService {
*/
public void save(UserInfo userInfo);
/**
* Get UserInfo for the Subject
*
* @param sub
* subject for UserInfo
* @return UserInfo for sub, or null
*/
public UserInfo getBySubject(String userId);
/**
* Remove the UserInfo
*

View File

@ -37,21 +37,12 @@ import org.springframework.transaction.annotation.Transactional;
* @author Michael Joseph Walsh
*
*/
@Repository
@Repository("jpaUserInfoRepository")
public class JpaUserInfoRepository implements UserInfoRepository {
@PersistenceContext
private EntityManager manager;
@Override
@Transactional
public UserInfo getBySubject(String sub) {
TypedQuery<DefaultUserInfo> query = manager.createNamedQuery("DefaultUserInfo.getBySubject", DefaultUserInfo.class);
query.setParameter("sub", sub);
return getSingleResult(query.getResultList());
}
@Override
@Transactional
public UserInfo save(UserInfo userInfo) {
@ -72,15 +63,6 @@ public class JpaUserInfoRepository implements UserInfoRepository {
}
}
@Override
@Transactional
public Collection<DefaultUserInfo> getAll() {
TypedQuery<DefaultUserInfo> query = manager.createNamedQuery("DefaultUserInfo.getAll", DefaultUserInfo.class);
return query.getResultList();
}
/**
* Get a single UserInfo object by its username
*/

View File

@ -49,11 +49,6 @@ public class DefaultUserInfoService implements UserInfoService {
userInfoRepository.save(userInfo);
}
@Override
public UserInfo getBySubject(String userId) {
return userInfoRepository.getBySubject(userId);
}
@Override
public void remove(UserInfo userInfo) {
userInfoRepository.remove(userInfo);