public SCIMRepresentationAttribute(string id, SCIMSchemaAttribute schemaAttribute, List <int> valuesInteger = null, List <bool> valuesBoolean = null, List <string> valuesString = null, List <DateTime> valuesDateTime = null) : this(id) { SchemaAttribute = schemaAttribute; ValuesInteger = valuesInteger == null ? new List <int>() : valuesInteger; ValuesBoolean = valuesBoolean == null ? new List <bool>() : valuesBoolean; ValuesString = valuesString == null ? new List <string>() : valuesString; ValuesDateTime = valuesDateTime == null ? new List <DateTime>() : valuesDateTime; }
private static ICollection <SCIMRepresentationAttribute> ExtractRepresentationAttributesFromJSON(SCIMSchemaAttribute schemaAttribute, object jObj) { var jArr = jObj as JArray; var parsedRepresentationAttributes = new List <SCIMRepresentationAttribute>(); if (schemaAttribute.Type == SCIMSchemaAttributeTypes.COMPLEX) { if (jArr != null) { foreach (JObject record in jArr) { var attribute = new SCIMRepresentationAttribute(Guid.NewGuid().ToString(), schemaAttribute); foreach (var attr in SCIMRepresentationHelper.BuildRepresentationAttributes(record, schemaAttribute.SubAttributes)) { attribute.Add(attr); } parsedRepresentationAttributes.Add(attribute); } } else { var attribute = new SCIMRepresentationAttribute(Guid.NewGuid().ToString(), schemaAttribute); foreach (var attr in SCIMRepresentationHelper.BuildRepresentationAttributes(jObj as JObject, schemaAttribute.SubAttributes)) { attribute.Add(attr); } parsedRepresentationAttributes.Add(attribute); } } else { switch (schemaAttribute.Type) { case SCIMSchemaAttributeTypes.BOOLEAN: parsedRepresentationAttributes.Add(new SCIMRepresentationAttribute(Guid.NewGuid().ToString(), schemaAttribute, valuesBoolean: new List <bool> { bool.Parse(jObj.ToString()) })); break; case SCIMSchemaAttributeTypes.STRING: parsedRepresentationAttributes.Add(new SCIMRepresentationAttribute(Guid.NewGuid().ToString(), schemaAttribute, valuesString: new List <string> { jObj.ToString() })); break; case SCIMSchemaAttributeTypes.INTEGER: parsedRepresentationAttributes.Add(new SCIMRepresentationAttribute(Guid.NewGuid().ToString(), schemaAttribute, valuesInteger: new List <int> { int.Parse(jObj.ToString()) })); break; case SCIMSchemaAttributeTypes.DATETIME: parsedRepresentationAttributes.Add(new SCIMRepresentationAttribute(Guid.NewGuid().ToString(), schemaAttribute, valuesDateTime: new List <DateTime> { DateTime.Parse(jObj.ToString()) })); break; } } return(parsedRepresentationAttributes); }
public bool HasAttribute(SCIMSchemaAttribute attribute) { return(Attributes.Any(attr => attr.Id == attribute.Id || attr.HasAttribute(attribute))); }
public void AddSubAttribute(SCIMSchemaAttribute subAttribute) { SubAttributes.Add(subAttribute); }
public SCIMSchema GetSchema(SCIMSchemaAttribute attribute) { return(Schemas.FirstOrDefault(s => s.HasAttribute(attribute))); }