@Component(value="userAttributesJPADao") @Transactional public class UserAttributesDaoImpl<U extends UserAttribute> extends GenericDaoImpl<U> implements UserAttributesDao<U>
UserAttribute
em
ct, t
NAMESPACE_DELIM
Constructor and Description |
---|
UserAttributesDaoImpl() |
Modifier and Type | Method and Description |
---|---|
Long |
delete(Long id)
A special Delete operation on the entity that will remove the entity and related entities based on id.
|
void |
delete(String userNameId) |
void |
delete(U userAttribute) |
Map<String,Object> |
get(String namespace)
Get a Map of key name and corresponding
IConfiguration for the specific namespace. |
Object |
get(String namespace,
String key) |
Object |
get(User user,
String namespace,
String key)
Get a configuration in the context to a
User |
Map<String,U> |
getAttributes(String userNameId)
Will throw
RuntimeException if record does not exist |
U |
getUserAttribute(String userNameId,
String attibuteName) |
U |
getUserAttribute(String userNameId,
String attibuteName,
Class<U> type) |
String |
getValue(String userNameId,
String attibuteName)
Will throw
RuntimeException if record does not exist |
Map<String,String> |
getValues(String userNameId)
Will throw
RuntimeException if record does not exist |
U |
load(Object id) |
U |
load(Object id,
Class entityClass)
In some situations the DAO represents an Interface or perhaps a parent of the actual Entity./
The exact type of the entity would have to be Supplied.
|
U |
load(String userNameId,
String attributeName)
For a given user and attribute name load the
UserAttribute Note: UserAttribute s have to have a unique attribute name and userId combination. |
List |
query(String ql,
String dialect,
Object... params)
Execute a raw Query in the native implementation language.
|
Page |
query(String ql,
String dialect,
PageInfo pageInfo,
Object... params)
Execute a raw Query in the native implementation language.
|
void |
save(String userNameId,
Map<String,String> attributes)
Save/Merge a set of Attributes for a user; a null attribute will result in removal
|
U |
save(U transientObject) |
getEntityManager, getNativeEntityName, paginate, setEntityManager, update
@Transactional public String getValue(String userNameId, String attibuteName)
RuntimeException
if record does not existgetValue
in interface UserAttributesDao<U extends UserAttribute>
userNameId
- attibuteName
- @Transactional public Map<String,String> getValues(String userNameId)
RuntimeException
if record does not existgetValues
in interface UserAttributesDao<U extends UserAttribute>
userNameId
- @Transactional public Map<String,U> getAttributes(String userNameId)
RuntimeException
if record does not existgetAttributes
in interface UserAttributesDao<U extends UserAttribute>
userNameId
- public U getUserAttribute(String userNameId, String attibuteName)
getUserAttribute
in interface UserAttributesDao<U extends UserAttribute>
public U getUserAttribute(String userNameId, String attibuteName, Class<U> type)
getUserAttribute
in interface UserAttributesDao<U extends UserAttribute>
@Transactional(readOnly=false) public void save(String userNameId, Map<String,String> attributes)
save
in interface UserAttributesDao<U extends UserAttribute>
userId
- attributes
- @Transactional(readOnly=false) public void delete(String userNameId)
delete
in interface UserAttributesDao<U extends UserAttribute>
@Transactional(readOnly=false) public void delete(U userAttribute)
delete
in interface GenericDao<U extends UserAttribute>
delete
in interface UserAttributesDao<U extends UserAttribute>
delete
in class GenericDaoImpl<U extends UserAttribute>
public U load(String userNameId, String attributeName)
UserAttributesDao
UserAttribute
UserAttribute
s have to have a unique attribute name and userId combination. So different attribute types do not matter when identifying an attribute.load
in interface UserAttributesDao<U extends UserAttribute>
userNameId
- as StringattributeName
- as StringUserAttribute
public Object get(String namespace, String key)
get
in interface ConfigurationSource<String,Object>
namespace
- as Stringkey
- as Kpublic Object get(User user, String namespace, String key)
ConfigurationSource
User
get
in interface ConfigurationSource<String,Object>
user
- as User
namespace
- as DTYPE (Entity type class name) @nullable true. if null will call load(String, String)
key
- @Nuallable true if we wish to fetch all attributes for userpublic Map<String,Object> get(String namespace)
ConfigurationSource
IConfiguration
for the specific namespace.
get
in interface ConfigurationSource<String,Object>
namespace
- as StringIConfiguration
@Transactional(readOnly=true) public U load(Object id, Class entityClass)
GenericDao
load
in interface GenericDao<U extends UserAttribute>
load
in class GenericDaoImpl<U extends UserAttribute>
id
- as Id for EntityentityClass
- as Class
of entity@Transactional(readOnly=true) public U load(Object id)
load
in interface GenericDao<U extends UserAttribute>
load
in class GenericDaoImpl<U extends UserAttribute>
@Transactional(readOnly=false) public U save(U transientObject)
save
in interface GenericDao<U extends UserAttribute>
save
in interface UserAttributesDao<U extends UserAttribute>
save
in class GenericDaoImpl<U extends UserAttribute>
@Transactional(readOnly=false) public Long delete(Long id)
GenericDao
delete
in interface GenericDao<U extends UserAttribute>
delete
in class GenericDaoImpl<U extends UserAttribute>
Long
@Transactional(readOnly=true) public List query(String ql, String dialect, Object... params) throws Exception
GenericDaoImpl
query
in interface FreeQuery
query
in class GenericDaoImpl<U extends UserAttribute>
ql
- as String in native Schema languagedialect
- as String. NULL or empty or "NATIVE" implies NATIVE, "JPA" implies JPA will be used. Additional dialects can be supported but they will be implementation dependent.params
- as Query parameters to the string.
List
Exception
@Transactional(readOnly=true) public Page query(String ql, String dialect, PageInfo pageInfo, Object... params) throws Exception
GenericDaoImpl
query
in interface FreeQuery
query
in class GenericDaoImpl<U extends UserAttribute>
ql
- as String in native Schema languagedialect
- as String. NULL or empty or "NATIVE" implies NATIVE, "JPA" implies JPA will be used. Additional dialects can be supported but they will be implementation dependent.pageInfo
- as PageInfo
for pagination of resultparams
- as Query parameters to the string
Page
Exception
Copyright © 2018. All rights reserved.