private Dictionary<string, string[]> FetchMetadata(IDocument document)
{
Dictionary<string, string[]> metadata = new Dictionary<string, string[]>();
IObjectType typeDef = session.GetTypeDefinition(document.ObjectType.Id/*"cmis:document" not Name FullName*/); // TODO cache
IList<IPropertyDefinition> propertyDefs = typeDef.PropertyDefinitions;
// Get metadata.
foreach (IProperty property in document.Properties)
{
// Mode
string mode = "readonly";
foreach (IPropertyDefinition propertyDef in propertyDefs)
{
if (propertyDef.Id.Equals("cmis:name"))
{
Updatability updatability = propertyDef.Updatability;
mode = updatability.ToString();
}
}
// Value
if (property.IsMultiValued)
{
metadata.Add(property.Id, new string[] { property.DisplayName, mode, property.ValuesAsString });
}
else
{
metadata.Add(property.Id, new string[] { property.DisplayName, mode, property.ValueAsString });
}
}
return metadata;
}