当前位置: 首页>>代码示例>>Java>>正文


Java RenameHelper类代码示例

本文整理汇总了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);
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:35,代码来源:RenameServiceImpl.java

示例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);
                }
            }
        }
    }
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:30,代码来源:RenameServiceImpl.java


注:本文中的org.uberfire.ext.editor.commons.backend.service.helper.RenameHelper类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。