public IEnumerable <SCIMRepresentationAttribute> GetAttributesByPath(string fullPath)
        {
            if (string.IsNullOrWhiteSpace(fullPath))
            {
                return(new SCIMRepresentationAttribute[0]);
            }

            return(FlatAttributes.Where(a => a.FullPath == fullPath));
        }
        public void UpdateAttribute(SCIMRepresentationAttribute attribute)
        {
            var attr = FlatAttributes.First(a => a.Id == attribute.Id);

            attr.ValueBinary    = attribute.ValueBinary;
            attr.ValueBoolean   = attribute.ValueBoolean;
            attr.ValueDateTime  = attribute.ValueDateTime;
            attr.ValueDecimal   = attribute.ValueDecimal;
            attr.ValueInteger   = attribute.ValueInteger;
            attr.ValueReference = attribute.ValueReference;
            attr.ValueString    = attribute.ValueString;
        }
 public object Clone()
 {
     return(new SCIMRepresentation
     {
         Id = Id,
         ExternalId = ExternalId,
         ResourceType = ResourceType,
         Version = Version,
         Created = Created,
         LastModified = LastModified,
         DisplayName = DisplayName,
         FlatAttributes = FlatAttributes.Select(a => (SCIMRepresentationAttribute)a.Clone()).ToList(),
         Schemas = Schemas.Select(a => (SCIMSchema)a.Clone()).ToList()
     });
 }
        public void RemoveAttributesById(List <SCIMRepresentationAttribute> removedAttrs, IEnumerable <string> attrIds)
        {
            for (int i = 0; i < attrIds.Count(); i++)
            {
                var schemaAttrId = attrIds.ElementAt(i);
                var attr         = GetAttributeById(schemaAttrId);
                if (attr == null)
                {
                    continue;
                }

                removedAttrs.Add(attr);
                var children    = GetChildren(attr);
                var childrenIds = children.Select(a => a.Id).ToList();
                RemoveAttributesById(removedAttrs, childrenIds);
                FlatAttributes.Remove(attr);
            }
        }
 public bool ContainsAttribute(SCIMRepresentationAttribute attr)
 {
     return(FlatAttributes.Any(a => a.IsSimilar(attr)));
 }
 public IEnumerable <SCIMRepresentationAttribute> GetChildren(SCIMRepresentationAttribute attr)
 {
     return(FlatAttributes.Where(a => a.ParentAttributeId == attr.Id));
 }
 public IEnumerable <SCIMRepresentationAttribute> GetAttributesByAttrSchemaId(string attrSchemaId)
 {
     return(FlatAttributes.Where(a => a.SchemaAttributeId == attrSchemaId));
 }
 public SCIMRepresentationAttribute GetAttributeById(string id)
 {
     return(FlatAttributes.FirstOrDefault(a => a.Id == id));
 }
 public void AddAttribute(SCIMRepresentationAttribute parentAttribute, SCIMRepresentationAttribute childAttribute)
 {
     childAttribute.ParentAttributeId = parentAttribute.Id;
     FlatAttributes.Add(childAttribute);
 }
 public void AddAttribute(SCIMRepresentationAttribute attribute)
 {
     FlatAttributes.Add(attribute);
 }