private void copyMoveRenameTag() throws Exception {
IgnitionGateway context = IgnitionGateway.get();
GatewayTagManager tagManager = context.getTagManager();
TagPath memoryTag1 = TagPathParser.parse("[default]LevelOne_FolderA/MemoryTag1");
TagPath destination = TagPathParser.parse("[default]LevelOne_FolderA");
List<QualityCode> results = tagManager.moveTagsAsync(Arrays.asList(memoryTag1), destination, true, CollisionPolicy.Rename).get(30, TimeUnit.SECONDS);
QualityCode qc = results.get(0);
if (qc.isNotGood()) {
throw new Exception(String.format("Copy operation returned bad result '%s'", qc.toString()));
}
TagPath memoryTag2 = TagPathParser.parse("[default]LevelOne_FolderA/MemoryTag2");
destination = TagPathParser.parse("[default]");
results = tagManager.moveTagsAsync(Arrays.asList(memoryTag2), destination, false, CollisionPolicy.Abort).get(30, TimeUnit.SECONDS);
qc = results.get(0);
if (qc.isNotGood()) {
throw new Exception(String.format("Move operation returned bad result '%s'", qc.toString()));
}
memoryTag2 = TagPathParser.parse("[default]MemoryTag2");
results = tagManager.renameTag(memoryTag2, "RootMemoryTag1", CollisionPolicy.Abort)
.get(30, TimeUnit.SECONDS);
qc = results.get(0);
if (qc.isNotGood()) {
throw new Exception(String.format("Rename operation returned bad result '%s'", qc.toString()));
}
}