private void editTag() throws Exception {
IgnitionGateway context = IgnitionGateway.get();
GatewayTagManager tagManager = context.getTagManager();
TagProvider provider = tagManager.getTagProvider("default");
TagPath memoryTag0 = TagPathParser.parse("MemoryTag0");
List<TagConfigurationModel> configs = provider.getTagConfigsAsync(Arrays.asList(memoryTag0), false, true).get(30, TimeUnit.SECONDS);
TagConfigurationModel tagConfig = configs.get(0);
if(TagObjectType.Unknown == tagConfig.getType()) {
throw new Exception("MemoryTag0 edit configuration not found");
}
tagConfig.set(WellKnownTagProps.Documentation, "Some documentation for MemoryTag0");
List<QualityCode> results = provider.saveTagConfigsAsync(Arrays.asList(tagConfig), CollisionPolicy.MergeOverwrite).get(30, TimeUnit.SECONDS);
for (int i = 0; i < results.size(); i++) {
QualityCode result = results.get(i);
if (result.isNotGood()) {
throw new Exception(String.format("Edit tag operation returned bad result '%s'", result.toString()));
}
}
}