本文整理汇总了Java中org.uberfire.ext.editor.commons.backend.service.helper.RenameHelper类的典型用法代码示例。如果您正苦于以下问题:Java RenameHelper类的具体用法?Java RenameHelper怎么用?Java RenameHelper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RenameHelper类属于org.uberfire.ext.editor.commons.backend.service.helper包,在下文中一共展示了RenameHelper类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: renamePath
import org.uberfire.ext.editor.commons.backend.service.helper.RenameHelper; //导入依赖的package包/类
Path renamePath(final Path path,
final String newName,
final String comment) {
final org.uberfire.java.nio.file.Path _path = Paths.convert(path);
final org.uberfire.java.nio.file.Path _target = Paths.convert(pathNamingService.buildTargetPath(path,
newName));
final Path targetPath = Paths.convert(_target);
try {
ioService.startBatch(_target.getFileSystem());
ioService.move(_path,
_target,
new CommentedOption(sessionInfo != null ? sessionInfo.getId() : "--",
identity.getIdentifier(),
null,
comment));
//Delegate additional changes required for a rename to applicable Helpers
for (RenameHelper helper : helpers) {
if (helper.supports(targetPath)) {
helper.postProcess(path,
targetPath);
}
}
} catch (final Exception e) {
throw new RuntimeException(e);
} finally {
endBatch();
}
return Paths.convert(_target);
}
示例2: renamePathIfExists
import org.uberfire.ext.editor.commons.backend.service.helper.RenameHelper; //导入依赖的package包/类
void renamePathIfExists(final Path path,
final String newName,
final String comment) {
final org.uberfire.java.nio.file.Path _path = Paths.convert(path);
if (Files.exists(_path)) {
final org.uberfire.java.nio.file.Path _target = Paths.convert(pathNamingService.buildTargetPath(path,
newName));
ioService.move(_path,
_target,
new CommentedOption(sessionInfo.getId(),
identity.getIdentifier(),
null,
comment)
);
//Delegate additional changes required for a rename to applicable Helpers
if (_target != null) {
final Path targetPath = Paths.convert(_target);
for (RenameHelper helper : helpers) {
if (helper.supports(targetPath)) {
helper.postProcess(path,
targetPath);
}
}
}
}
}