private static List <LinkElementModel> getChildrenFromMetadataNestedUsage(LinkElementModel model) { MetadataAttributeManager metadataAttributeManager = new MetadataAttributeManager(); try { MetadataNestedAttributeUsage metadataNestedAttributeUsage = metadataAttributeManager.MetadataNestedAttributeUsageRepo.Get(model.ElementId); LinkElementComplexity complexity = LinkElementComplexity.None; LinkElementType type = LinkElementType.ComplexMetadataAttribute; complexity = metadataNestedAttributeUsage.Member.Self is MetadataSimpleAttribute ? LinkElementComplexity.Simple : LinkElementComplexity.Complex; if (complexity == LinkElementComplexity.Complex) { return(getChildrenFromComplexMetadataAttribute(metadataNestedAttributeUsage.Member.Id, model.Position)); } return(new List <LinkElementModel>()); } finally { metadataAttributeManager.Dispose(); } }
private static List <LinkElementModel> getChildrenFromComplexMetadataAttribute(long metadataCompountAttributeId, LinkElementPostion position) { List <LinkElementModel> tmp = new List <LinkElementModel>(); MetadataAttributeManager metadataAttributeManager = new MetadataAttributeManager(); try { MetadataCompoundAttribute mca = metadataAttributeManager.MetadataCompoundAttributeRepo.Get(metadataCompountAttributeId); foreach (var attr in mca.MetadataNestedAttributeUsages) { LinkElementComplexity complexity = LinkElementComplexity.None; LinkElementType type = LinkElementType.ComplexMetadataAttribute; complexity = attr.Member.Self is MetadataSimpleAttribute ? LinkElementComplexity.Simple : LinkElementComplexity.Complex; //type = attr.Member.Self is MetadataSimpleAttribute // ? LinkElementType.SimpleMetadataAttribute // : LinkElementType.ComplexMetadataAttribute; type = LinkElementType.MetadataNestedAttributeUsage; tmp.Add( new LinkElementModel( 0, attr.Id, type, attr.Label, "", position, complexity, attr.Description) ); } return(tmp); } finally { metadataAttributeManager.Dispose(); } }