本文整理汇总了Java中org.uberfire.backend.server.util.Paths类的典型用法代码示例。如果您正苦于以下问题:Java Paths类的具体用法?Java Paths怎么用?Java Paths使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Paths类属于org.uberfire.backend.server.util包,在下文中一共展示了Paths类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: create
import org.uberfire.backend.server.util.Paths; //导入依赖的package包/类
@Override
public Path create(final Path context,
final String fileName,
final SolverConfigModel config,
final String comment) {
try {
final org.uberfire.java.nio.file.Path nioPath = Paths.convert(context).resolve(fileName);
final Path newPath = Paths.convert(nioPath);
if (ioService.exists(nioPath)) {
throw new FileAlreadyExistsException(nioPath.toString());
}
ioService.write(nioPath,
configPersistence.toXML(config),
commentedOptionFactory.makeCommentedOption(comment));
return newPath;
} catch (Exception e) {
throw ExceptionUtilities.handleException(e);
}
}
开发者ID:kiegroup,项目名称:optaplanner-wb,代码行数:23,代码来源:SolverEditorServiceImpl.java
示例2: save
import org.uberfire.backend.server.util.Paths; //导入依赖的package包/类
@Override
public Path save(final Path resource,
final SolverConfigModel config,
final Metadata metadata,
final String comment) {
try {
Metadata currentMetadata = metadataService.getMetadata(resource);
ioService.write(Paths.convert(resource),
configPersistence.toXML(config),
metadataService.setUpAttributes(resource,
metadata),
commentedOptionFactory.makeCommentedOption(comment));
fireMetadataSocialEvents(resource,
currentMetadata,
metadata);
return resource;
} catch (Exception e) {
throw ExceptionUtilities.handleException(e);
}
}
开发者ID:kiegroup,项目名称:optaplanner-wb,代码行数:23,代码来源:SolverEditorServiceImpl.java
示例3: fillIndexBuilder
import org.uberfire.backend.server.util.Paths; //导入依赖的package包/类
@Override
protected DefaultIndexBuilder fillIndexBuilder(final Path path) throws Exception {
final org.uberfire.backend.vfs.Path vfsPath = Paths.convert(path);
final KieProject project = kieProjectService.resolveProject(vfsPath);
if (project == null) {
logger.error("Unable to index " + path.toUri() + ", project could not be resolved.");
return null;
}
final Package _package = kieProjectService.resolvePackage(vfsPath);
if (_package == null) {
logger.error("Unable to index " + path.toUri() + ", package could not be resolved.");
return null;
}
return new DefaultIndexBuilder(vfsPath.getFileName(),
project,
_package);
}
开发者ID:kiegroup,项目名称:optaplanner-wb,代码行数:18,代码来源:SolverFileIndexer.java
示例4: save
import org.uberfire.backend.server.util.Paths; //导入依赖的package包/类
@Override
@SuppressWarnings("unused")
public void save(final Path pathToPomXML,
final RepositoryStructureModel model,
final String comment) {
final FileSystem fs = Paths.convert(pathToPomXML).getFileSystem();
try {
pomService.save(pathToPomXML,
model.getPOM(),
model.getPOMMetaData(),
comment,
true);
} catch (final Exception e) {
throw ExceptionUtilities.handleException(e);
}
}
开发者ID:kiegroup,项目名称:appformer,代码行数:17,代码来源:RepositoryStructureServiceImpl.java
示例5: getProjects
import org.uberfire.backend.server.util.Paths; //导入依赖的package包/类
private List<Project> getProjects(final Path branchRoot) {
final List<Project> repositoryProjects = new ArrayList<Project>();
if (branchRoot == null) {
return repositoryProjects;
} else {
final DirectoryStream<org.uberfire.java.nio.file.Path> nioRepositoryPaths = ioService.newDirectoryStream(Paths.convert(branchRoot));
for (org.uberfire.java.nio.file.Path nioRepositoryPath : nioRepositoryPaths) {
if (Files.isDirectory(nioRepositoryPath)) {
final org.uberfire.backend.vfs.Path projectPath = Paths.convert(nioRepositoryPath);
final Project project = projectService.resolveProject(projectPath);
if (project != null) {
repositoryProjects.add(project);
}
}
}
return repositoryProjects;
}
}
开发者ID:kiegroup,项目名称:appformer,代码行数:19,代码来源:RepositoryStructureServiceImpl.java
示例6: validate
import org.uberfire.backend.server.util.Paths; //导入依赖的package包/类
@Override
public Collection<ValidationMessage> validate(final Path path) {
if (path != null) {
String dataObjectSource = ioService.readAllString(Paths.convert(path));
GenerationResult generationResult = dataModelerService.loadDataObject(path,
dataObjectSource,
path);
if (generationResult.hasErrors()) {
return Collections.emptyList();
} else {
DataObject dataObject = generationResult.getDataObject();
if (dataObject.getAnnotation(PLANNING_SOLUTION_ANNOTATION) != null) {
return Arrays.asList(new PlanningSolutionToBeDuplicatedMessage(Level.ERROR));
}
}
}
return Collections.emptyList();
}
开发者ID:kiegroup,项目名称:optaplanner-wb,代码行数:20,代码来源:PlanningSolutionCopyValidator.java
示例7: create
import org.uberfire.backend.server.util.Paths; //导入依赖的package包/类
@Override
public Path create(final Path projectRoot,
final String repositoryWebBaseURL,
final POM pomModel) {
org.uberfire.java.nio.file.Path pathToPOMXML = null;
try {
pomModel.addRepository(getRepository(repositoryWebBaseURL));
final org.uberfire.java.nio.file.Path nioRoot = Paths.convert(projectRoot);
pathToPOMXML = nioRoot.resolve("pom.xml");
if (ioService.exists(pathToPOMXML)) {
throw new FileAlreadyExistsException(pathToPOMXML.toString());
}
ioService.write(pathToPOMXML,
pomContentHandler.toString(pomModel));
//Don't raise a NewResourceAdded event as this is handled at the Project level in ProjectServices
return Paths.convert(pathToPOMXML);
} catch (Exception e) {
throw ExceptionUtilities.handleException(e);
}
}
开发者ID:kiegroup,项目名称:appformer,代码行数:25,代码来源:POMServiceImpl.java
示例8: postProcess
import org.uberfire.backend.server.util.Paths; //导入依赖的package包/类
@Override
public void postProcess(final Path path) {
String dataObjectSource = ioService.readAllString(Paths.convert(path));
GenerationResult generationResult = dataModelerService.loadDataObject(path,
dataObjectSource,
path);
if (generationResult.hasErrors()) {
LOGGER.warn("Path " + path + " parsing as a data object has failed. Score holder global generation will be skipped.");
} else {
DataObject dataObject = generationResult.getDataObject();
if (dataObject.getAnnotation(PLANNING_SOLUTION_ANNOTATION) != null) {
org.uberfire.java.nio.file.Path source = Paths.convert(kieProjectService.resolvePackage(path).getPackageMainResourcesPath());
org.uberfire.java.nio.file.Path sourcePackage = Files.isDirectory(source) ? source : source.getParent();
String dataObjectFileName = path.getFileName().substring(0,
path.getFileName().indexOf("."));
ioService.deleteIfExists(sourcePackage.resolve(dataObjectFileName + SCORE_HOLDER_GLOBAL_FILE_SUFFIX));
}
}
}
开发者ID:kiegroup,项目名称:optaplanner-wb,代码行数:23,代码来源:PlanningSolutionDeleteHelper.java
示例9: dataObjectToADataObject
import org.uberfire.backend.server.util.Paths; //导入依赖的package包/类
@Test
public void dataObjectToADataObject() {
Path dataObjectPath = PathFactory.newPath("Test.java",
"file:///dataObjects");
when(ioService.readAllString(Paths.convert(dataObjectPath))).thenReturn("testResult");
DataObject originalDataObject = createDataObject(null);
GenerationResult generationResult = new GenerationResult();
generationResult.setDataObject(originalDataObject);
when(dataModelerService.loadDataObject(any(),
anyString(),
any())).thenReturn(generationResult);
DataObject updatedDataObject = createDataObject(null);
Collection<ValidationMessage> result = validator.validate(dataObjectPath,
updatedDataObject);
assertTrue(result.isEmpty());
}
开发者ID:kiegroup,项目名称:optaplanner-wb,代码行数:20,代码来源:PlanningSolutionScoreHolderSaveValidatorTest.java
示例10: scoreHolderTypeNotRecognized
import org.uberfire.backend.server.util.Paths; //导入依赖的package包/类
@Test
public void scoreHolderTypeNotRecognized() {
Path dataObjectPath = PathFactory.newPath("Test.java",
"file:///dataObjects");
when(ioService.readAllString(Paths.convert(dataObjectPath))).thenReturn("testResult");
DataObject originalDataObject = createDataObject(HardSoftScore.class);
GenerationResult generationResult = new GenerationResult();
generationResult.setDataObject(originalDataObject);
when(dataModelerService.loadDataObject(any(),
anyString(),
any())).thenReturn(generationResult);
when(scoreHolderUtils.extractScoreTypeFqn(originalDataObject)).thenReturn(HardSoftScore.class.getName());
when(scoreHolderUtils.getScoreHolderTypeFqn(HardSoftScore.class.getName())).thenReturn(HardSoftScoreHolder.class.getName());
when(assetsUsageService.getAssetUsages(HardSoftScoreHolder.class.getName(),
ResourceType.JAVA, dataObjectPath)).thenReturn(Arrays.asList(mock(Path.class)));
DataObject updatedDataObject = createDataObject(SimpleScore.class);
when(scoreHolderUtils.extractScoreTypeFqn(updatedDataObject)).thenReturn("UnknownScoreClassName");
when(scoreHolderUtils.getScoreHolderTypeFqn("UnknownScoreClassName")).thenReturn(null);
}
开发者ID:kiegroup,项目名称:optaplanner-wb,代码行数:23,代码来源:PlanningSolutionScoreHolderSaveValidatorTest.java
示例11: notAPlanningSolution
import org.uberfire.backend.server.util.Paths; //导入依赖的package包/类
@Test
public void notAPlanningSolution() {
Path dataObjectPath = PathFactory.newPath("Test.java",
"file:///dataObjects");
when(ioService.readAllString(Paths.convert(dataObjectPath))).thenReturn("testResult");
DataObject originalDataObject = new DataObjectImpl("test",
"Test");
GenerationResult generationResult = new GenerationResult();
generationResult.setDataObject(originalDataObject);
when(dataModelerService.loadDataObject(any(),
anyString(),
any())).thenReturn(generationResult);
DataObject updatedDataObject = new DataObjectImpl("test",
"Test");
Collection<ValidationMessage> result = validator.validate(dataObjectPath,
updatedDataObject);
assertTrue(result.isEmpty());
}
开发者ID:kiegroup,项目名称:optaplanner-wb,代码行数:23,代码来源:PlanningSolutionScoreHolderDeleteValidatorTest.java
示例12: extractSolutionScoreTypeFqns
import org.uberfire.backend.server.util.Paths; //导入依赖的package包/类
private Collection<String> extractSolutionScoreTypeFqns(final Path solutionObjectPath) {
org.uberfire.java.nio.file.Path source = Paths.convert(kieProjectService.resolvePackage(solutionObjectPath).getPackageMainResourcesPath());
org.uberfire.java.nio.file.Path sourcePackage = Files.isDirectory(source) ? source : source.getParent();
String sourceSolutionFileName = solutionObjectPath.getFileName().substring(0,
solutionObjectPath.getFileName().indexOf("."));
org.uberfire.java.nio.file.Path sourceScoreHolderGlobalPath = sourcePackage.resolve(sourceSolutionFileName + SCORE_HOLDER_GLOBAL_FILE_SUFFIX);
boolean scoreHolderGlobalFileExists = ioService.exists(sourceScoreHolderGlobalPath);
if (scoreHolderGlobalFileExists) {
GlobalsModel globalsModel = globalsEditorService.load(Paths.convert(sourceScoreHolderGlobalPath));
return globalsModel.getGlobals().stream()
.filter(global -> "scoreHolder".equals(global.getAlias()))
.map(Global::getClassName)
.collect(Collectors.toList());
}
return Collections.emptyList();
}
开发者ID:kiegroup,项目名称:optaplanner-wb,代码行数:20,代码来源:ScoreHolderServiceImpl.java
示例13: extractSolutionBendableScoreLevelsSize
import org.uberfire.backend.server.util.Paths; //导入依赖的package包/类
public BendableScoreLevelsWrapper extractSolutionBendableScoreLevelsSize(final Path solutionPath) {
String solutionString = ioService.readAllString(Paths.convert(solutionPath));
GenerationResult generationResult = dataModelerService.loadDataObject(solutionPath,
solutionString,
solutionPath);
if (!generationResult.hasErrors()) {
DataObject dataObject = generationResult.getDataObject();
ObjectProperty scoreObjectProperty = dataObject.getProperty("score");
if (scoreObjectProperty != null) {
if (isBendableScore(scoreObjectProperty.getClassName())) {
Annotation annotation = scoreObjectProperty.getAnnotation(PlanningScore.class.getName());
if (annotation != null) {
Object hardLevelsSize = annotation.getValue("bendableHardLevelsSize");
Object softLevelsSize = annotation.getValue("bendableSoftLevelsSize");
return new BendableScoreLevelsWrapper(hardLevelsSize == null ? 0 : (int) hardLevelsSize,
softLevelsSize == null ? 0 : (int) softLevelsSize);
}
}
}
}
return new BendableScoreLevelsWrapper();
}
开发者ID:kiegroup,项目名称:optaplanner-wb,代码行数:25,代码来源:ScoreHolderServiceImpl.java
示例14: deletePath
import org.uberfire.backend.server.util.Paths; //导入依赖的package包/类
void deletePath(final Path path,
final String comment) {
final org.uberfire.java.nio.file.Path _path = Paths.convert(path);
try {
ioService.startBatch(_path.getFileSystem());
// Delegate additional changes required for a deletion to applicable Helpers. Helpers are invoked before
// the deletion as Helpers may depend on the presence of the file; in particular when it is necessary to
// resolve a Package from a file name.
notifyDeleteHelpers(path);
ioService.delete(Paths.convert(path),
new CommentedOption(sessionInfo != null ? sessionInfo.getId() : "--",
identity.getIdentifier(),
null,
comment));
} catch (final Exception e) {
throw new RuntimeException(e);
} finally {
ioService.endBatch();
}
}
开发者ID:kiegroup,项目名称:appformer,代码行数:24,代码来源:DeleteServiceImpl.java
示例15: setUpAttributes
import org.uberfire.backend.server.util.Paths; //导入依赖的package包/类
@Override
public Map<String, Object> setUpAttributes(final Path path,
final Metadata metadata) {
try {
Map<String, Object> attributes;
try {
attributes = ioService.readAttributes(Paths.convert(path));
} catch (final NoSuchFileException ex) {
attributes = new HashMap<String, Object>();
}
if (metadata != null) {
attributes = configAttrs(attributes,
metadata);
}
return BasicFileAttributesUtil.cleanup(attributes);
} catch (Exception e) {
throw ExceptionUtilities.handleException(e);
}
}
开发者ID:kiegroup,项目名称:appformer,代码行数:21,代码来源:MetadataServiceImpl.java
示例16: create
import org.uberfire.backend.server.util.Paths; //导入依赖的package包/类
@Override
public Path create(final Path context,
final String fileName,
final ProcessNode content,
final String comment) {
try {
final org.uberfire.java.nio.file.Path nioPath = Paths.convert(context).resolve(fileName);
final Path newPath = Paths.convert(nioPath);
if (ioService.exists(nioPath)) {
throw new FileAlreadyExistsException(nioPath.toString());
}
ioService.write(nioPath,
BpmnPersistence.getInstance().marshal(content),
CommentedOptionFactory.makeCommentedOption(identity,
sessionInfo,
comment));
return newPath;
} catch (Exception e) {
throw ExceptionUtilities.handleException(e);
}
}
开发者ID:kiegroup,项目名称:appformer,代码行数:25,代码来源:BpmnServiceImpl.java
示例17: resolveParentProject
import org.uberfire.backend.server.util.Paths; //导入依赖的package包/类
@Override
public Project resolveParentProject(final Path resource) {
try {
//Null resource paths cannot resolve to a Project
if (resource == null) {
return null;
}
//Check if resource is the project root
org.uberfire.java.nio.file.Path path = Paths.convert(resource).normalize();
if (hasPom(path)) {
final Path projectRootPath = Paths.convert(path);
return new Project(projectRootPath,
Paths.convert(path.resolve(POM_PATH)),
projectRootPath.getFileName());
} else {
return null;
}
} catch (Exception e) {
throw ExceptionUtilities.handleException(e);
}
}
开发者ID:kiegroup,项目名称:appformer,代码行数:23,代码来源:ResourceResolver.java
示例18: save
import org.uberfire.backend.server.util.Paths; //导入依赖的package包/类
@Override
public Path save(final Path path,
final ProcessNode content,
final Metadata metadata,
final String comment) {
try {
ioService.write(Paths.convert(path),
BpmnPersistence.getInstance().marshal(content),
MetadataFactory.makeMetadata(metadata),
CommentedOptionFactory.makeCommentedOption(identity,
sessionInfo,
comment));
return path;
} catch (Exception e) {
throw ExceptionUtilities.handleException(e);
}
}
开发者ID:kiegroup,项目名称:appformer,代码行数:19,代码来源:BpmnServiceImpl.java
示例19: listFiles
import org.uberfire.backend.server.util.Paths; //导入依赖的package包/类
@Override
public List<Path> listFiles() {
final DirectoryStream<org.uberfire.java.nio.file.Path> stream = ioService.newDirectoryStream(root,
new DirectoryStream.Filter<org.uberfire.java.nio.file.Path>() {
@Override
public boolean accept(org.uberfire.java.nio.file.Path entry) throws IOException {
return typeDefinition.accept(Paths.convert(entry));
}
});
final List<Path> files = new ArrayList<Path>();
final Iterator<org.uberfire.java.nio.file.Path> itr = stream.iterator();
while (itr.hasNext()) {
files.add(Paths.convert(itr.next()));
}
return files;
}
开发者ID:kiegroup,项目名称:appformer,代码行数:17,代码来源:BpmnServiceImpl.java
示例20: acquireLock
import org.uberfire.backend.server.util.Paths; //导入依赖的package包/类
@Override
public LockResult acquireLock(final Path path)
throws IllegalArgumentException, IOException, UnsupportedOperationException {
try {
ioService.startBatch(fileSystem);
final String userId = sessionInfo.getIdentity().getIdentifier();
final LockInfo lockInfo = retrieveLockInfo(path);
final LockResult result;
if (lockInfo.isLocked() && !lockInfo.lockedBy().equals(userId)) {
result = LockResult.failed(lockInfo);
} else {
ioService.write(Paths.convert(lockInfo.getLock()),
userId);
result = LockResult.acquired(path,
userId);
updateSession(result.getLockInfo());
}
return result;
} finally {
ioService.endBatch();
}
}
开发者ID:kiegroup,项目名称:appformer,代码行数:25,代码来源:VFSLockServiceImpl.java
注:本文中的org.uberfire.backend.server.util.Paths类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论