gluu
公開メンバ関数 | 非公開メンバ関数 | 非公開変数類 | 全メンバ一覧
org.gluu.oxtrust.model.scim2.BaseScimResource クラス
org.gluu.oxtrust.model.scim2.BaseScimResource の継承関係図
Inheritance graph
org.gluu.oxtrust.model.scim2.BaseScimResource 連携図
Collaboration graph

公開メンバ関数

void addCustomAttributes (String uri, Map< String, Object > map)
 
void addCustomAttributes (CustomAttributes customAttributes)
 
Map< String, Object > getCustomAttributes ()
 
CustomAttributes getCustomAttributes (String uri)
 
 BaseScimResource ()
 
String getId ()
 
void setId (String id)
 
String getExternalId ()
 
void setExternalId (String externalId)
 
Meta getMeta ()
 
void setMeta (Meta meta)
 
Set< String > getSchemas ()
 
void setSchemas (Set< String > schemas)
 

非公開メンバ関数

Map< String, Object > reshapeMalformedCustAttrs (Map< String, Object > map)
 

非公開変数類

Set< String > schemas
 
String id
 
String externalId
 
Meta meta
 
Map< String, Object > extendedAttrs =new HashMap<String, Object>()
 

詳解

This class represents the root hierarchy of SCIM resources. All of them: user, group, etc. are subclasses of this class.

構築子と解体子

◆ BaseScimResource()

org.gluu.oxtrust.model.scim2.BaseScimResource.BaseScimResource ( )
inline

Constructs a basic SCIM resource with all its attributes unassigned

124  {
125  schemas=new HashSet<String>();
126  String defSchema= ScimResourceUtil.getDefaultSchemaUrn(getClass());
127  if (defSchema!=null)
128  schemas.add(defSchema);
129  }
Set< String > schemas
Definition: BaseScimResource.java:44

関数詳解

◆ addCustomAttributes() [1/2]

void org.gluu.oxtrust.model.scim2.BaseScimResource.addCustomAttributes ( String  uri,
Map< String, Object >  map 
)
inline

Replaces the custom attributes belonging to the resource extension identified by the uri passed as parameter with the attribute/value pairs supplied in the Map. Developers are highly encouraged not to use this method but addCustomAttributes(CustomAttributes) instead which adds type-safety.

Note that this method does not apply any sort of validation. Whether the uri and attributes are recognized or the values are consistent with data types registered in Gluu Server, is something that is performed only when the resource is passed in a service method invocation.

引数
uriA string with URI that identifies an extension
mapA Map holding attribute names (Strings) and values (Objects).
79  {
80  //This is a workaround to support incoming malformed custom attributes sent by SCIM-Client version 3.1.2 and earlier
82  extendedAttrs.put(uri, map);
83  }
Map< String, Object > reshapeMalformedCustAttrs(Map< String, Object > map)
Definition: BaseScimResource.java:163
Map< String, Object > extendedAttrs
Definition: BaseScimResource.java:66

◆ addCustomAttributes() [2/2]

void org.gluu.oxtrust.model.scim2.BaseScimResource.addCustomAttributes ( CustomAttributes  customAttributes)
inline

Adds the custom attributes contained in the CustomAttributes instance passed to this method. All previously added attributes are replaced if they are linked to the same uri that customAttributes parameter is associated to.

Note that this method does not apply any sort of validation. Whether the uri and attributes are recognized or the values are consistent with data types registered in Gluu Server, is something that is performed only when the resource is passed in a service method invocation.

引数
customAttributesAn object that comprised of attribute/value pairs
94  {
95  addCustomAttributes(customAttributes.getUri(), customAttributes.getAttributeMap());
96  }
void addCustomAttributes(String uri, Map< String, Object > map)
Definition: BaseScimResource.java:79

◆ getCustomAttributes() [1/2]

Map<String, Object> org.gluu.oxtrust.model.scim2.BaseScimResource.getCustomAttributes ( )
inline

Retrieves all custom attributes found in this resource object. The attributes are structured hierarchically in a Map where they can be looked up using the uri to which the attributes belong to.

Developers are highly encouraged not to use this method but getCustomAttributes(String) instead which adds type-safety.

戻り値
A Map with all custom attributes
106  {
107  return extendedAttrs;
108  }
Map< String, Object > extendedAttrs
Definition: BaseScimResource.java:66

◆ getCustomAttributes() [2/2]

CustomAttributes org.gluu.oxtrust.model.scim2.BaseScimResource.getCustomAttributes ( String  uri)
inline

Retrieves the custom attributes found in this resource object associated to the uri supplied.

引数
uriA String value representing a URI
戻り値
A CustomAttributes instance that allows developers to inspect attributes and values in a type-safe manner.
115  {
116  if (extendedAttrs.get(uri)==null)
117  return null;
118  return new CustomAttributes(uri, IntrospectUtil.strObjMap(extendedAttrs.get(uri)));
119  }
Map< String, Object > extendedAttrs
Definition: BaseScimResource.java:66

◆ getExternalId()

String org.gluu.oxtrust.model.scim2.BaseScimResource.getExternalId ( )
inline
139  {
140  return externalId;
141  }
String externalId
Definition: BaseScimResource.java:59

◆ getId()

String org.gluu.oxtrust.model.scim2.BaseScimResource.getId ( )
inline
131  {
132  return id;
133  }
String id
Definition: BaseScimResource.java:54

◆ getMeta()

Meta org.gluu.oxtrust.model.scim2.BaseScimResource.getMeta ( )
inline
147  {
148  return meta;
149  }
Meta meta
Definition: BaseScimResource.java:64

◆ getSchemas()

Set<String> org.gluu.oxtrust.model.scim2.BaseScimResource.getSchemas ( )
inline
155  {
156  return schemas;
157  }
Set< String > schemas
Definition: BaseScimResource.java:44

◆ reshapeMalformedCustAttrs()

Map<String, Object> org.gluu.oxtrust.model.scim2.BaseScimResource.reshapeMalformedCustAttrs ( Map< String, Object >  map)
inlineprivate
163  {
164 
165  /*
166  To understand the transformation check classes Extension, Extension.Field, and ExtensionFieldType in package
167  org.gluu.oxtrust.model.scim2 of version 3.1.2 or earlier
168  */
169  org.apache.logging.log4j.Logger log = LogManager.getLogger(getClass());
170  try {
171 
172  Set<String> keys = map.keySet();
173  if (keys.contains("fields") && keys.size() == 1) {
174 
175  ObjectMapper mapper = new ObjectMapper();
176  map = IntrospectUtil.strObjMap(map.get("fields"));
177  log.debug("Custom attributes map received was\n {}", map);
178 
179  for (String custAttrName : map.keySet()) {
180 
181  Map<String, Object> subMap = IntrospectUtil.strObjMap(map.get(custAttrName));
182  boolean multivalued=(Boolean) subMap.get("multiValued");
183  String type=IntrospectUtil.strObjMap(subMap.get("type")).get("name").toString();
184 
185  if (type.equals("STRING") || type.equals("DATE_TIME")){
186  if (multivalued){
187  List<String> values=mapper.readValue(subMap.get("value").toString(), new TypeReference<List<String>>(){});
188  map.put(custAttrName, values);
189  }
190  else{
191  map.put(custAttrName, subMap.get("value"));
192  }
193  }
194  else
195  if (type.equals("DECIMAL")){
196  if (multivalued){
197  List<Integer> values=mapper.readValue(subMap.get("value").toString(), new TypeReference<List<Integer>>(){});
198  map.put(custAttrName, values);
199  }
200  else{
201  map.put(custAttrName, new Integer(subMap.get("value").toString()));
202  }
203  }
204  }
205  log.debug("Custom attributes map after conversion is\n {}", map);
206  }
207  }
208  catch (Exception e){
209  log.error(e.getMessage(), e);
210  map=null;
211  }
212  return map;
213 
214  }

◆ setExternalId()

void org.gluu.oxtrust.model.scim2.BaseScimResource.setExternalId ( String  externalId)
inline
143  {
144  this.externalId = externalId;
145  }
String externalId
Definition: BaseScimResource.java:59

◆ setId()

void org.gluu.oxtrust.model.scim2.BaseScimResource.setId ( String  id)
inline
135  {
136  this.id = id;
137  }
String id
Definition: BaseScimResource.java:54

◆ setMeta()

void org.gluu.oxtrust.model.scim2.BaseScimResource.setMeta ( Meta  meta)
inline
151  {
152  this.meta = meta;
153  }
Meta meta
Definition: BaseScimResource.java:64

◆ setSchemas()

void org.gluu.oxtrust.model.scim2.BaseScimResource.setSchemas ( Set< String >  schemas)
inline
159  {
160  this.schemas = schemas;
161  }
Set< String > schemas
Definition: BaseScimResource.java:44

メンバ詳解

◆ extendedAttrs

Map<String, Object> org.gluu.oxtrust.model.scim2.BaseScimResource.extendedAttrs =new HashMap<String, Object>()
private

◆ externalId

String org.gluu.oxtrust.model.scim2.BaseScimResource.externalId
private

◆ id

String org.gluu.oxtrust.model.scim2.BaseScimResource.id
private

◆ meta

Meta org.gluu.oxtrust.model.scim2.BaseScimResource.meta
private

◆ schemas

Set<String> org.gluu.oxtrust.model.scim2.BaseScimResource.schemas
private

このクラス詳解は次のファイルから抽出されました: