public class ResourceAdapter extends AbstractAuthorizationModel implements Resource, JpaModel<ResourceEntity>
Resource.FilterOption, Resource.SearchableFields
Constructor and Description |
---|
ResourceAdapter(ResourceEntity entity,
javax.persistence.EntityManager em,
StoreFactory storeFactory) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
List<String> |
getAttribute(String name)
Returns the values of an attribute with the given
name |
Map<String,List<String>> |
getAttributes()
Returns the attributes associated with this resource.
|
String |
getDisplayName()
Returns the end user friendly name for this resource.
|
ResourceEntity |
getEntity() |
String |
getIconUri()
Returns an icon
URI for this resource. |
String |
getId()
Returns the unique identifier for this instance.
|
String |
getName()
Returns the resource's name.
|
String |
getOwner()
Returns the resource's owner, which is usually an identifier that uniquely identifies the resource's owner.
|
String |
getResourceServer()
Returns the
ResourceServer to where this resource belongs to. |
List<Scope> |
getScopes()
|
String |
getSingleAttribute(String name)
Returns the first value of an attribute with the given
name |
String |
getType()
Returns a string representing the type of this resource.
|
Set<String> |
getUris()
|
int |
hashCode() |
boolean |
isOwnerManagedAccess()
Indicates if this resource can be managed by the resource owner.
|
void |
removeAttribute(String name) |
void |
setAttribute(String name,
List<String> values)
Sets an attribute with the given
name and values . |
void |
setDisplayName(String name)
Sets an end user friendly name for this resource.
|
void |
setIconUri(String iconUri)
Sets an icon
URI for this resource. |
void |
setName(String name)
Sets a name for this resource.
|
void |
setOwnerManagedAccess(boolean ownerManagedAccess)
Sets if this resource can be managed by the resource owner.
|
void |
setType(String type)
Sets a string representing the type of this resource.
|
static ResourceEntity |
toEntity(javax.persistence.EntityManager em,
Resource resource) |
void |
updateScopes(Set<Scope> toUpdate)
Update the set of scopes associated with this resource.
|
void |
updateUris(Set<String> uri)
Sets a list of
URI that uniquely identify this resource. |
throwExceptionIfReadonly
public ResourceAdapter(ResourceEntity entity, javax.persistence.EntityManager em, StoreFactory storeFactory)
public ResourceEntity getEntity()
getEntity
in interface JpaModel<ResourceEntity>
public String getId()
Resource
public String getName()
Resource
public String getDisplayName()
Resource
Resource.getName()
is returned.getDisplayName
in interface Resource
public void setDisplayName(String name)
Resource
setDisplayName
in interface Resource
name
- the name of this resourcepublic void updateUris(Set<String> uri)
Resource
URI
that uniquely identify this resource.updateUris
in interface Resource
uri
- an URI
for this resourcepublic void setName(String name)
Resource
public String getType()
Resource
public void setType(String type)
Resource
public String getIconUri()
Resource
URI
for this resource.getIconUri
in interface Resource
public void setIconUri(String iconUri)
Resource
URI
for this resource.setIconUri
in interface Resource
public String getResourceServer()
Resource
ResourceServer
to where this resource belongs to.getResourceServer
in interface Resource
public String getOwner()
Resource
public boolean isOwnerManagedAccess()
Resource
isOwnerManagedAccess
in interface Resource
true
if this resource can be managed by the resource owner. Otherwise, false
.public void setOwnerManagedAccess(boolean ownerManagedAccess)
Resource
setOwnerManagedAccess
in interface Resource
ownerManagedAccess
- true
indicates that this resource can be managed by the resource owner.public void updateScopes(Set<Scope> toUpdate)
Resource
updateScopes
in interface Resource
toUpdate
- the list of scopes to updatepublic Map<String,List<String>> getAttributes()
Resource
getAttributes
in interface Resource
public String getSingleAttribute(String name)
Resource
name
getSingleAttribute
in interface Resource
public List<String> getAttribute(String name)
Resource
name
getAttribute
in interface Resource
public void setAttribute(String name, List<String> values)
Resource
name
and values
.setAttribute
in interface Resource
name
- the attribute namepublic void removeAttribute(String name)
removeAttribute
in interface Resource
public static ResourceEntity toEntity(javax.persistence.EntityManager em, Resource resource)
Copyright © 2021 JBoss by Red Hat. All rights reserved.