use of org.uberfire.backend.vfs.Path in project kie-wb-common by kiegroup.
the class ExamplesServiceImpl method readDescription.
private String readDescription(final Module module) {
final Path root = module.getRootPath();
final POM pom = module.getPom();
final org.uberfire.java.nio.file.Path nioRoot = Paths.convert(root);
final org.uberfire.java.nio.file.Path nioDescription = nioRoot.resolve(PROJECT_DESCRIPTON);
String description = "Example '" + module.getModuleName() + "' module";
if (ioService.exists(nioDescription)) {
description = ioService.readAllString(nioDescription);
} else if (pom != null && pom.getDescription() != null && !pom.getDescription().isEmpty()) {
description = pom.getDescription();
}
if (description != null) {
return description.replaceAll("[\\s]+", " ");
}
return description;
}
use of org.uberfire.backend.vfs.Path in project kie-wb-common by kiegroup.
the class ExamplesServiceImpl method renameIfNecessary.
private WorkspaceProject renameIfNecessary(final OrganizationalUnit ou, final WorkspaceProject project) {
String name = project.getName();
Collection<WorkspaceProject> projectsWithSameName = projectService.getAllWorkspaceProjectsByName(ou, name);
if (projectsWithSameName.size() > 1) {
name = this.projectService.createFreshProjectName(ou, project.getName());
}
if (!name.equals(project.getName())) {
final Path pomXMLPath = project.getMainModule().getPomXMLPath();
final ProjectScreenModel model = projectScreenService.load(pomXMLPath);
model.getPOM().setName(name);
projectScreenService.save(pomXMLPath, model, "");
return projectService.resolveProject(pomXMLPath);
}
return project;
}
use of org.uberfire.backend.vfs.Path in project kie-wb-common by kiegroup.
the class WorkItemDefinitionBackendShowcaseRegistry method load.
@Override
public WorkItemDefinitionBackendRegistry load(final Metadata metadata) {
final Path root = metadata.getRoot();
if (!deployed.contains(root)) {
deploy(root);
}
super.load(metadata);
return this;
}
use of org.uberfire.backend.vfs.Path in project kie-wb-common by kiegroup.
the class WorkItemDefinitionServiceImplTest method testPathAcceptor.
@Test
public void testPathAcceptor() {
assertNotNull(pathAcceptor);
Path p1 = mock(Path.class);
when(p1.getFileName()).thenReturn("email.test");
assertFalse(pathAcceptor.test(p1));
Path p2 = mock(Path.class);
when(p2.getFileName()).thenReturn("email.wid");
assertTrue(pathAcceptor.test(p2));
Path p3 = mock(Path.class);
when(p3.getFileName()).thenReturn("email.WID");
assertTrue(pathAcceptor.test(p3));
}
use of org.uberfire.backend.vfs.Path in project kie-wb-common by kiegroup.
the class CalledElementFormProviderTest method setup.
@Before
public void setup() {
calledElementFormProvider.setQueryService(queryService);
List<RefactoringPageRow> results = new ArrayList<RefactoringPageRow>();
RefactoringMapPageRow refactoringMapPageRow = new RefactoringMapPageRow();
Map<String, Path> map = new HashMap<String, Path>();
map.put(ID1, path1);
map.put(ID2, path2);
refactoringMapPageRow.setValue(map);
results.add(refactoringMapPageRow);
when(queryService.query(anyString(), anyObject())).thenReturn(results);
}
Aggregations