Below is the example of creating a new operation in a custom class. The request contains the moniker of opened custom class container instance and the pattern that specifies whether a new operation should be created, and a class, in which the operation is to be created. The response contains updated information about the custom class to be changed.
{
"SetCustomExtender" :
{
"tCustomExtender" :
{
"id" : "JFHDCPAHAHHCGOAEINHJAHNJDKAOLMFEPJOPHAHKLDFBMCCP!M!S!EEMPBGPAHAHHCGOAEDPGADAFLDKKBEEAEKKOADCJKHIMOAOGI"
},
"tArg" :
{
"pattern" :
{
"obInst" : "true",
"parsOwnDefVals" : "true",
"classes" : "Change",
"customClass" :
{
"smallImage" : "true",
"largeImage" : "true",
"CustomOperations" : "Add"
}
},
"meta" :
{
"classes" :
{
"its" :
{
"it" :
[
{
"k" : "33",
"operations" :
{
"its" :
{
"it" :
[
{
"k" : "-1"
}
]
}
}
}
]
}
}
},
"metaGet" :
{
"obInst" : "true",
"parsOwnDefVals" : "true",
"classes" : "Get",
"classesFilter" :
{
"keys" :
{
"i" : "33"
}
},
"customClass" :
{
"smallImage" : "true",
"largeImage" : "true",
"CustomOperations" : "Get"
}
}
}
}
}
{
"SetCustomExtenderResult" :
{
"id" :
{
"id" : "JFHDCPAHAHHCGOAEINHJAHNJDKAOLMFEPJOPHAHKLDFBMCCP!M!S!EEMPBGPAHAHHCGOAEDPGADAFLDKKBEEAEKKOADCJKHIMOAOGI"
},
"meta" :
{
"obInst" :
{
"obDesc" :
{
"@ds" : "",
"@isShortcut" : "0",
"@isLink" : "0",
"@ver" : "13",
"@hf" : "0",
"i" : "OBJ52",
"n" : "System class additions",
"k" : "52",
"c" : "5889",
"p" : "0",
"h" : "0",
"hasPrv" : "0",
"ic" : "0",
"trackElementDependents" : "0",
"isPermanent" : "1",
"isTemp" : "0"
}
},
"dirty" : "1",
"classes" :
{
"its" :
{
"it" :
[
{
"@ic" : "0",
"k" : "33",
"id" : "OBJ417",
"n" : "CustomClass",
"vis" : "1",
"implURL" : "",
"standardOperations" :
{
"its" :
{
"it" :
[
{
"k" : "0",
"id" : "OPEN",
"n" : "Open",
"vis" : "1"
},
{
"k" : "1",
"id" : "OPENWITHPARAMS",
"n" : "Open with parameters",
"vis" : "1"
},
{
"k" : "2",
"id" : "EDIT",
"n" : "Edit",
"vis" : "1"
},
{
"k" : "3",
"id" : "DELETE",
"n" : "Delete",
"vis" : "1"
},
{
"k" : "4",
"id" : "PASTE",
"n" : "Paste",
"vis" : "1"
}
]
}
},
"operations" :
{
"its" :
{
"it" :
[
{
"k" : "1",
"id" : "CLS33OP1",
"n" : "Operation 1",
"vis" : "1"
}
]
}
},
"c" : "2168577",
"h" : "0",
"implClass" : "",
"description" : ""
}
]
}
}
}
}
}
public static SetCustomExtenderResult AddOperationInCustomClass(string moniker, CustomClass changedClass)
{
var somClient = new SomPortTypeClient(); // Proxy object for operation execution
// Operation execution parameters
var tSet = new SetCustomExtender()
{
tArg = new SetCustomExtenderArg()
{
pattern = new CustomExtenderMdPattern()
{
classes = ListOperation.Change,
customClass = new CustomClassPattern()
{
CustomOperations = ListOperation.Add
}
},
meta = new CustomExtenderMd()
{
classes = new CustomClasses()
{
its = new CustomClass[]
{
new CustomClass()
{
k = changedClass.k,
operations = new CustomOperations()
{
its = new CustomOperation[]
{
new CustomOperation() { k = uint.MaxValue }
}
}
}
}
}
},
metaGet = new CustomExtenderMdPattern()
{
classes = ListOperation.Get,
classesFilter = new CustomClassesFilter()
{
keys = new int[]
{
(int)changedClass.k
}
},
customClass = new CustomClassPattern()
{
CustomOperations = ListOperation.Get
}
}
},
tCustomExtender = new CustomObId() { id = moniker }
};
// Create a custom class operation
var tResult = somClient.SetCustomExtender(tSet);
return tResult;
}
See also: