Ниже приведён пример использования операции SetMbUpdate для загрузки обновления из файла. В запросе передаётся моникёр файла с обновлением и признак необходимости проверить готовность объектов к обновлению после загрузки. В ответе приходит информация об элементах дерева обновления.
{
"SetMbUpdate" :
{
"tMbUpdate" :
{
"id" : "S1!M!S!MbUpd1"
},
"tArg" :
{
"pattern" :
{
"execute" : "true"
},
"meta" :
{
"execute" :
{
"command" : "Load",
"async" : "false",
"loadFromFile" :
{
"binaryId" :
{
"id" : "S1!M!Bin!0"
},
"newFormat" : "false",
"mode" : "Replace"
}
},
"prepare" : "true"
},
"metaGet" :
{
"node" : "true",
"nodePattern" :
{
"customProperties" : "false",
"folder" :
{
"children" : "true",
"childrenRecursive" : "true"
},
"object" :
{
"applyState" : "true",
"extendedParams" : ""
}
}
}
}
}
}
{
"SetMbUpdateResult" :
{
"id" :
{
"id" : "S1!M!S!MbUpd1"
},
"meta" :
{
"rootFolder" :
{
"k" : "4294967295",
"index" : "-1",
"type" : "Folder",
"label" : "",
"condition" : "",
"enabled" : "1",
"folder" :
{
"childrenCount" : "1",
"children" :
{
"it" :
{
"k" : "1",
"index" : "0",
"type" : "Folder",
"label" : "Folder for Object",
"condition" : "",
"parentNode" : "4294967295",
"enabled" : "1",
"folder" :
{
"childrenCount" : "2",
"children" :
{
"it" :
[
{
"k" : "2",
"index" : "0",
"type" : "Object",
"label" : "Модуль обновления",
"condition" : "",
"parentNode" : "1",
"enabled" : "1",
"folder" :
{
"childrenCount" : "0",
"children" : ""
},
"object" :
{
"object" :
{
"@ts" : "2020-04-14T10:19:08.502Z",
"@ds" : "",
"@isShortcut" : "0",
"@isLink" : "0",
"@ver" : "3",
"@hf" : "0",
"i" : "M_UPDATE",
"n" : "Модуль обновления",
"k" : "198414",
"c" : "1537",
"p" : "198413",
"h" : "0",
"hasPrv" : "0",
"ic" : "0"
},
"isSaved" : "0",
"updatePart" : "Metadata",
"updateType" :
{
"it" :
[
"Bound",
"BindById"
]
},
"parent" : "9",
"includeChildrenDependencies" : "2",
"updateOrder" : "Default",
"includeData" : "0",
"alterType" : "Default",
"objectId" : "M_UPDATE",
"objectName" : "Модуль обновления",
"objectOldKey" : "198414",
"applyState" :
{
"state" :
{
"it" : "None"
},
"forceUpdateVcs" : "0",
"applyAfterParent" : "0"
},
"constraint" : "None",
"boundType" : "ById",
"unboundType" : "Bound",
"forceUniqueId" : "0",
"forceKeepId" : "0",
"accessTokenOptions" : "Default",
"sdApplyLog" : "",
"version" : "3",
"originalMetabase" : ""
}
},
{
"k" : "5",
"index" : "1",
"type" : "DataObject",
"label" : "Справочник",
"condition" : "",
"parentNode" : "1",
"enabled" : "1",
"folder" :
{
"childrenCount" : "0",
"children" : ""
},
"object" :
{
"object" :
{
"@ts" : "2020-04-14T10:49:39.000Z",
"@ds" : "",
"@isShortcut" : "0",
"@isLink" : "0",
"@ver" : "3",
"@hf" : "0",
"i" : "D_COMPANY",
"n" : "Справочник",
"k" : "198421",
"c" : "3076",
"p" : "198413",
"h" : "0",
"hasPrv" : "0",
"ic" : "0"
},
"isSaved" : "0",
"updatePart" : "DataMetadata",
"updateType" :
{
"it" :
[
"Bound",
"BindById"
]
},
"parent" : "3",
"includeChildrenDependencies" : "2",
"updateOrder" : "Default",
"includeData" : "1",
"alterType" : "Default",
"objectId" : "D_COMPANY",
"objectName" : "Справочник",
"objectOldKey" : "198421",
"applyState" :
{
"state" :
{
"it" : "EditExisting"
},
"updateObject" :
{
"@ds" : "",
"@isShortcut" : "0",
"@isLink" : "0",
"@ver" : "3",
"@hf" : "0",
"i" : "D_COMPANY",
"n" : "Справочник",
"k" : "198421",
"c" : "3076",
"p" : "198413",
"h" : "0",
"hasPrv" : "0",
"ic" : "0"
},
"forceUpdateVcs" : "0",
"applyAfterParent" : "0"
},
"constraint" : "None",
"boundType" : "ById",
"unboundType" : "Bound",
"forceUniqueId" : "0",
"forceKeepId" : "0",
"accessTokenOptions" : "Default",
"sdApplyLog" : "",
"version" : "3",
"originalMetabase" : "",
"dataObject" :
{
"method" : "All",
"primaryKey" : "",
"referenceConstraintsHandling" : "Default",
"batchMode" : "Override",
"updateRdsSequence" : "0",
"requestAdminCredentials" : "0",
"isIdentity" : "0",
"allowExistingRubricatorUpdate" : "0"
}
}
}
]
}
}
}
}
}
}
}
}
}
public static SetMbUpdateResult LoadUpdate(string moniker, string fileMoniker)
{
var somClient = new SomPortTypeClient(); //Прокси-объект для выполнения операций
//Параметры выполнения операции
var tSet = new SetMbUpdate()
{
tArg = new SetMbUpdateArg()
{
pattern = new MbUpdateMdPattern()
{
execute = true
},
meta = new MbUpdateMd()
{
execute = new MbUpdateExecute()
{
command = MbUpdateExecuteCommand.Load,
async = false,
loadFromFile = new MbUpdateMdLoadFromFile()
{
binaryId = new BinaryId() { id = fileMoniker },
mode = UpdateLoadMode.Replace
}
},
prepare = true
},
metaGet = new MbUpdateMdPattern()
{
node = true,
nodePattern = new MbUpdateNodePattern()
{
customProperties = false,
folder = new MbUpdateFolderNodePattern()
{
children = true,
childrenRecursive = true
},
@object = new MbUpdateObjectNodePattern()
{
applyState = true,
extendedParams = new MbUpdateObjectNodeExtendedParamsPattern()
}
}
}
},
tMbUpdate = new MbUpdateId() { id = moniker }
};
//Загрузка обновления
var result = somClient.SetMbUpdate(tSet);
return result;
}
См. также: