Below is the example of using the OpenDim operation to open a repository dictionary. The request contains moniker of the object that is a dictionary and a pattern for getting information about dictionary structure and elements. The response contains moniker of opened dictionary and information about the structure and elements in accordance with the specified pattern.
The C# example uses the FindObjectById function, which code is given in the Getting Object Description by Its Identifier section.
{
"OpenDim" :
{
"tObject" :
{
"id" : "S1!M!116"
},
"tArg" :
{
"openArgs" : "",
"metaArg" :
{
"pattern" :
{
"obInst" : "false",
"getDescr" : "true",
"getAttrs" : "true"
},
"elsArg" :
{
"pattern" :
{
"attributes" : "*",
"getParentKey" : "true",
"getImageIndex" : "true"
}
}
}
}
}
}
{
"OpenDimResult" :
{
"id" :
{
"id" : "S1!M!S!S3"
},
"meta" :
{
"id" :
{
"id" : "S1!M!S!S3"
},
"data" :
{
"descr" :
{
"k" : "116",
"id" : "DIM_1",
"n" : "Dim_1",
"vis" : "1",
"cls" :
{
"k" : "1025"
}
},
"attrs" :
{
"it" :
[
{
"k" : "117",
"id" : "NAME",
"n" : "Name",
"vis" : "1",
"dt" : "1",
"predefined" : "Name",
"dataDomain" : "0",
"nullable" : "1",
"hasHierarchy" : "0"
},
{
"k" : "118",
"id" : "ID",
"n" : "Identifier",
"vis" : "1",
"dt" : "2",
"uniqueIndex" : "INDEX1",
"predefined" : "Ident",
"dataDomain" : "0",
"nullable" : "1",
"hasHierarchy" : "0"
},
{
"k" : "119",
"id" : "ORDER",
"n" : "Order",
"vis" : "1",
"dt" : "2",
"predefined" : "Order",
"dataDomain" : "0",
"nullable" : "1",
"hasHierarchy" : "0"
},
{
"k" : "122",
"id" : "PARENT",
"n" : "Parent",
"vis" : "1",
"dt" : "2",
"dataDomain" : "0",
"nullable" : "1",
"hasHierarchy" : "0"
},
{
"k" : "177",
"id" : "CODE",
"n" : "Code",
"vis" : "1",
"dt" : "1",
"dataDomain" : "0",
"nullable" : "1",
"hasHierarchy" : "0"
}
],
"ident" : "1",
"name" : "0",
"order" : "2"
}
},
"els" :
{
"els" :
{
"e" :
[
{
"n" : "First element",
"a" :
{
"it" :
[
"First element",
"1",
"1",
"0",
"A000123"
]
},
"ea" :
{
"it" :
[
{
"@v" : "First element"
},
{
"@v" : "1"
},
{
"@v" : "1"
},
{
"@v" : "0"
},
{
"@v" : "A000123"
}
]
},
"k" : "1",
"h" : "1",
"o" : "0"
},
{
"n" : "Second element",
"a" :
{
"it" :
[
"Second element",
"2",
"2",
"1",
"A000124"
]
},
"ea" :
{
"it" :
[
{
"@v" : "Second element"
},
{
"@v" : "2"
},
{
"@v" : "2"
},
{
"@v" : "1"
},
{
"@v" : "A000124"
}
]
},
"k" : "2",
"h" : "1",
"o" : "1",
"p" : "1"
},
{
"n" : "Third element",
"a" :
{
"it" :
[
"Third element",
"3",
"3",
"2",
"A000125"
]
},
"ea" :
{
"it" :
[
{
"@v" : "Third element"
},
{
"@v" : "3"
},
{
"@v" : "3"
},
{
"@v" : "2"
},
{
"@v" : "A000125"
}
]
},
"k" : "3",
"h" : "0",
"o" : "2",
"p" : "2"
},
{
"n" : "Fourth element",
"a" :
{
"it" :
[
"Fourth element",
"4",
"4",
"0",
"A000126"
]
},
"ea" :
{
"it" :
[
{
"@v" : "Fourth element"
},
{
"@v" : "4"
},
{
"@v" : "4"
},
{
"@v" : "0"
},
{
"@v" : "A000126"
}
]
},
"k" : "4",
"h" : "0",
"o" : "0"
},
{
"n" : "Fifth element",
"a" :
{
"it" :
[
"Fifth element",
"5",
"5",
"0",
"A000127"
]
},
"ea" :
{
"it" :
[
{
"@v" : "Fifth element"
},
{
"@v" : "5"
},
{
"@v" : "5"
},
{
"@v" : "0"
},
{
"@v" : "A000127"
}
]
},
"k" : "5",
"h" : "0",
"o" : "0"
}
]
},
"id" :
{
"id" : "S1!M!S!S3"
}
}
}
}
}
public static OpenDimResult OpenDimensionEx(MbId mb, string id)
{
var somClient = new SomPortTypeClient(); //Proxy object for operation execution
//Operation execution parameters
var tOpen = new OpenDim()
{
tArg = new OpenDimArg()
{
metaArg = new GetDimMetadataArg()
{
elsArg = new GetDimElementsArg()
{
pattern = new ElsPattern()
{
attributes = "*",
getParentKey = true
}
},
pattern = new DmMetadataPattern()
{
getAttrs = true,
getDescr = true,
obInst = false
}
},
openArgs = new DmOpenArgs()
},
tObject = new OdId() { id = mb.id + "!" + FindObjectById(mb, id).k }
};
//Open dictionary and getting metadata
var tResult = somClient.OpenDim(tOpen);
return tResult;
}
See also: