gluu
公開メンバ関数 | 非公開変数類 | 全メンバ一覧
org.gluu.oxtrust.service.scim2.ExtensionService クラス
org.gluu.oxtrust.service.scim2.ExtensionService 連携図
Collaboration graph

公開メンバ関数

List< ExtensiongetResourceExtensions (Class<? extends BaseScimResource > cls)
 
List< String > getUrnsOfExtensions (Class<? extends BaseScimResource > cls)
 
List< String > getStringAttributeValues (ExtensionField field, Object valuesHolder)
 
List< Object > convertValues (ExtensionField field, String strValues[])
 
Extension extensionOfAttribute (Class<? extends BaseScimResource > cls, String attribute)
 
ExtensionField getFieldOfExtendedAttribute (Class<? extends BaseScimResource > cls, String attribute)
 

非公開変数類

Logger log
 
AttributeService attrService
 

詳解

Created by jgomer on 2017-09-29.

関数詳解

◆ convertValues()

List<Object> org.gluu.oxtrust.service.scim2.ExtensionService.convertValues ( ExtensionField  field,
String  strValues[] 
)
inline

Builds a list of objects based on the supplied String values passed and the extension field passed. The strings are converted according to the type asociated to the field: for STRING the value is left as is; for DATE the value is converted to a String following the ISO date format; for NUMERIC an Integer/Double is created from the value supplied.

引数
fieldAn ExtensionField
strValuesA non-empty String array with the values associated to the field passed. These values are coming from LDAP
戻り値
List of opaque values
127  {
128 
129  List<Object> values=new ArrayList<Object>();
130 
131  for (String val : strValues) {
132  //In practice, there should not be nulls in strValues
133  if (val!=null) {
134  Object value = ExtensionField.valueFromString(field, val);
135 
136  //won't happen either (value being null) because calls to this method occurs after lots of validations have taken place
137  if (value != null) {
138  values.add(value);
139  log.debug("convertValues. Added value '{}'", value.toString());
140  }
141  }
142  }
143  return values;
144 
145  }
Logger log
Definition: ExtensionService.java:41

◆ extensionOfAttribute()

Extension org.gluu.oxtrust.service.scim2.ExtensionService.extensionOfAttribute ( Class<? extends BaseScimResource cls,
String  attribute 
)
inline
147  {
148 
149  List<Extension> extensions=getResourceExtensions(cls);
150  Extension belong=null;
151 
152  try {
153  for (Extension ext : extensions) {
154  if (attribute.startsWith(ext.getUrn() + ":")){
155  attribute=attribute.substring(ext.getUrn().length()+1);
156 
157  for (String fieldName : ext.getFields().keySet())
158  if (attribute.equals(fieldName)) {
159  belong = ext;
160  break;
161  }
162  }
163  }
164  }
165  catch (Exception e){
166  log.error(e.getMessage(), e);
167  }
168  return belong;
169 
170  }
List< Extension > getResourceExtensions(Class<? extends BaseScimResource > cls)
Definition: ExtensionService.java:46
Logger log
Definition: ExtensionService.java:41

◆ getFieldOfExtendedAttribute()

ExtensionField org.gluu.oxtrust.service.scim2.ExtensionService.getFieldOfExtendedAttribute ( Class<? extends BaseScimResource cls,
String  attribute 
)
inline
172  {
173 
174  List<Extension> extensions=getResourceExtensions(cls);
175  ExtensionField field=null;
176 
177  try {
178  for (Extension ext : extensions) {
179  if (attribute.startsWith(ext.getUrn() + ":")){
180  attribute=attribute.substring(ext.getUrn().length()+1);
181 
182  for (ExtensionField f : ext.getFields().values())
183  if (attribute.equals(f.getName())) {
184  field = f;
185  break;
186  }
187  }
188  }
189  }
190  catch (Exception e){
191  log.error(e.getMessage(), e);
192  }
193  return field;
194  }
List< Extension > getResourceExtensions(Class<? extends BaseScimResource > cls)
Definition: ExtensionService.java:46
Logger log
Definition: ExtensionService.java:41

◆ getResourceExtensions()

List<Extension> org.gluu.oxtrust.service.scim2.ExtensionService.getResourceExtensions ( Class<? extends BaseScimResource cls)
inline
46  {
47 
48  List<Extension> list=new ArrayList<Extension>();
49  try {
50  //Currently support one extension only for User Resource
51  if (cls.equals(UserResource.class)) {
52 
53  Map<String, ExtensionField> fields=new HashMap<String, ExtensionField>();
54 
55  for (GluuAttribute attribute : attrService.getSCIMRelatedAttributes()) {
56  if (attribute.getOxSCIMCustomAttribute().equals(ScimCustomAtribute.TRUE)) {
57  //first non-null check is needed because certain entries do not have the multivalue attribute set
58  boolean multi=attribute.getMultivaluedAttribute()!=null && attribute.getMultivaluedAttribute().equals(Multivalued.TRUE);
59 
60  ExtensionField field=new ExtensionField();
61  field.setDescription(attribute.getDescription());
62  field.setType(attribute.getDataType());
63  field.setMultiValued(multi);
64  field.setName(attribute.getName());
65 
66  fields.put(attribute.getName(), field);
67  }
68  }
69 
70  Extension ext=new Extension(USER_EXT_SCHEMA_ID);
71  ext.setFields(fields);
72  ext.setName(USER_EXT_SCHEMA_NAME);
73  ext.setDescription(USER_EXT_SCHEMA_DESCRIPTION);
74 
75  list.add(ext);
76  }
77  }
78  catch (Exception e){
79  log.error("An error ocurred when building extension for {}", cls.getName());
80  log.error(e.getMessage(), e);
81  }
82  return list;
83 
84  }
List< GluuAttribute > getSCIMRelatedAttributes()
Definition: AttributeService.java:294
Logger log
Definition: ExtensionService.java:41
AttributeService attrService
Definition: ExtensionService.java:44

◆ getStringAttributeValues()

List<String> org.gluu.oxtrust.service.scim2.ExtensionService.getStringAttributeValues ( ExtensionField  field,
Object  valuesHolder 
)
inline

Builds up a list of strings with the values associated to the field passed. The strings are created according to the type asociated to the field: for STRING the value is left as is; for DATE the value is converted to a String following the generalized date format; for NUMERIC the value is converted to a String

引数
fieldAn ExtensionField instance
valuesHolderA non-null value object (may be a collection)
戻り値
List with values represented as Strings
104  {
105 
106  Collection collection=field.isMultiValued() ? (Collection)valuesHolder : Collections.singletonList(valuesHolder);
107  List<String> values=new ArrayList<String>();
108 
109  for (Object elem : collection) {
110  //Despite valuesHolder is not null, it can be a collection with null elements...
111  if (elem!=null)
112  values.add(ExtensionField.stringValueOf(field, elem));
113  }
114  return values;
115 
116  }

◆ getUrnsOfExtensions()

List<String> org.gluu.oxtrust.service.scim2.ExtensionService.getUrnsOfExtensions ( Class<? extends BaseScimResource cls)
inline
86  {
87 
88  List<String> list=new ArrayList<String>();
89  for (Extension ext : getResourceExtensions(cls))
90  list.add(ext.getUrn());
91 
92  return list;
93 
94  }
List< Extension > getResourceExtensions(Class<? extends BaseScimResource > cls)
Definition: ExtensionService.java:46

メンバ詳解

◆ attrService

AttributeService org.gluu.oxtrust.service.scim2.ExtensionService.attrService
private

◆ log

Logger org.gluu.oxtrust.service.scim2.ExtensionService.log
private

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