org.guvnor.common.services.project.model.Module.getPomXMLPath()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(11.5k)|赞(0)|评价(0)|浏览(86)

本文整理了Java中org.guvnor.common.services.project.model.Module.getPomXMLPath()方法的一些代码示例,展示了Module.getPomXMLPath()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Module.getPomXMLPath()方法的具体详情如下:
包路径:org.guvnor.common.services.project.model.Module
类名称:Module
方法名:getPomXMLPath

Module.getPomXMLPath介绍

暂无

代码示例

代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-project-explorer-backend

private void indexModule(final Module module,
             final String key) {
  final String moduleRef = module.getPomXMLPath().toURI();
  if (!moduleKeys.containsKey(moduleRef)) {
    moduleKeys.put(moduleRef,
            new HashSet<String>());
  }
  moduleKeys.get(moduleRef).add(key);
}

代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-project-explorer-backend

public boolean deleteModule(final Module module) {
  boolean changed = false;
  final String moduleRef = module.getPomXMLPath().toURI();
  if (moduleKeys.containsKey(moduleRef)) {
    changed = true;
    for (final String key2Delete : moduleKeys.get(moduleRef)) {
      content.remove(key2Delete);
    }
  }
  return changed;
}

代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-examples-screen-backend

protected List<String> getTags(final Module module) {
  List<String> tags = metadataService.getTags(module.getPomXMLPath());
  tags.sort(String::compareTo);
  return tags;
}

代码示例来源:origin: kiegroup/appformer

private void addModule(final Module module) {
    module.setPom(pomService.load(module.getPomXMLPath()));
    modules.add(module);
  }
}

代码示例来源:origin: org.uberfire/uberfire-project-backend

private void addModule(final Module module) {
    module.setPom(pomService.load(module.getPomXMLPath()));
    modules.add(module);
  }
}

代码示例来源:origin: org.kie.workbench.services/kie-wb-common-services-backend

private void updateDependenciesClassLoader(final Module project,
                      final KieModuleMetaData kieModuleMetaData) {
  KieModule kieModule = moduleService.resolveModule(project.getPomXMLPath());
  if (kieModule != null) {
    dependenciesClassLoaderCache.setDependenciesClassLoader(kieModule,
                                LRUModuleDependenciesClassLoaderCache.buildClassLoader(kieModule,
                                                            kieModuleMetaData));
  }
}

代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-project-explorer-backend

public void addPackage(final OrganizationalUnit organizationalUnit,
            final Repository repository,
            final Module module,
            final Package pkg) {
  if (repository.getDefaultBranch().isPresent()) {
    final String key = new PackageKey(organizationalUnit.getName(),
                     repository.getDefaultBranch().get().getPath(),
                     module.getPomXMLPath().toURI()).toString();
    content.put(key,
          pkg);
    indexRepository(repository,
            key);
    indexModule(module,
          key);
  }
}

代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-project-explorer-backend

public void addFolderItem(final OrganizationalUnit organizationalUnit,
             final Repository repository,
             final Module module,
             final FolderItem item) {
  if (repository.getDefaultBranch().isPresent()) {
    final String key = new FolderItemKey(organizationalUnit.getName(),
                       repository.getDefaultBranch().get().getPath(),
                       module.getPomXMLPath().toURI()).toString();
    content.put(key,
          item);
    indexRepository(repository,
            key);
    indexModule(module,
          key);
  }
}

代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-examples-screen-backend

@Test
public void nameIsNotTaken() {
  String module1 = "module1";
  WorkspaceProject project1 = mock(WorkspaceProject.class,
                   Answers.RETURNS_DEEP_STUBS.get());
  doReturn(module1).when(project1).getName();
  when(project1.getMainModule().getPomXMLPath()).thenReturn(mock(Path.class));
  doReturn(project1).when(service).importProject(eq(organizationalUnit),
                          any());
  service.importProjects(organizationalUnit,
              importProjects);
  verify(projectService,
      never()).createFreshProjectName(any(),
                      anyString());
  verify(projectScreenService,
      never()).save(any(),
             any(),
             any());
}

代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-project-explorer-backend

public Package getPackage(final WorkspaceProject project,
             final Module module) {
  if (project.getRepository() == null || module == null) {
    return null;
  }
  final Object obj = content.get(new PackageKey(project.getOrganizationalUnit().getName(),
                         project.getBranch().getPath(),
                         module.getPomXMLPath().toURI()).toString());
  if (obj != null && obj instanceof Package) {
    return (Package) obj;
  }
  return null;
}

代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-library-client

protected WorkspaceProject createProject() {
  final Path rootPath = mock(Path.class);
  doReturn("git://modulePath").when(rootPath).toURI();
  final Module module = mock(Module.class);
  doReturn("mainModuleName").when(module).getModuleName();
  doReturn("modulePath").when(module).getIdentifier();
  doReturn(rootPath).when(module).getRootPath();
  final Path pomPath = mock(Path.class);
  doReturn(pomPath).when(module).getPomXMLPath();
  final OrganizationalUnit organizationalUnit = mock(OrganizationalUnit.class);
  final Repository repository = mock(Repository.class);
  final Path repositoryRootPath = mock(Path.class);
  doReturn(Optional.of(new Branch("master",
                  repositoryRootPath))).when(repository).getDefaultBranch();
  doReturn("rootpath").when(repositoryRootPath).toURI();
  return new WorkspaceProject(organizationalUnit,
                repository,
                new Branch("master",
                      mock(Path.class)),
                module);
}

代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-project-explorer-backend

public FolderItem getFolderItem(final WorkspaceProject project,
                final Module module) {
  if (project.getOrganizationalUnit() == null || project.getRepository() == null || module == null) {
    return null;
  }
  final Object obj = content.get(new FolderItemKey(project.getOrganizationalUnit().getName(),
                           project.getBranch().getPath(),
                           module.getPomXMLPath().toURI()).toString());
  if (obj != null && obj instanceof FolderItem) {
    return (FolderItem) obj;
  }
  return null;
}

代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-examples-screen-backend

@Test
public void nameIsTaken() {
  String module1 = "module1";
  String module1_1 = "module1 [1]";
  WorkspaceProject project1 = mock(WorkspaceProject.class,
                   Answers.RETURNS_DEEP_STUBS.get());
  doReturn(module1).when(project1).getName();
  when(project1.getMainModule().getPomXMLPath()).thenReturn(mock(Path.class));
  List<WorkspaceProject> projects = new ArrayList<>();
  projects.add(project1);
  projects.add(project1);
  doReturn(project1).when(service).importProject(eq(organizationalUnit),
                          any());
  doReturn(projects).when(projectService).getAllWorkspaceProjectsByName(any(),
                                     eq(module1));
  doReturn(module1_1).when(projectService).createFreshProjectName(any(),
                                  eq(module1));
  service.importProjects(organizationalUnit,
              importProjects);
  verify(projectScreenService).save(any(),
                   modelCapture.capture(),
                   any());
  final ProjectScreenModel model = modelCapture.getValue();
  assertEquals(module1_1,
         model.getPOM().getName());
}

代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-library-client

@Test
public void testReimport() {
  {
    doReturn(false).when(this.presenter).userCanUpdateProject();
    this.presenter.reimport();
    verify(this.copyPopUpPresenter,
        never()).show(any(),
               any(),
               any());
  }
  {
    doNothing().when(projectScreenService).reImport(any());
    doReturn(true).when(this.presenter).userCanUpdateProject();
    CommandWithFileNameAndCommitMessage duplicateCommand = mock(CommandWithFileNameAndCommitMessage.class);
    doReturn(duplicateCommand).when(presenter).getDuplicateCommand();
    this.presenter.reimport();
    verify(view).showBusyIndicator(anyString());
    verify(projectScreenService).reImport(presenter.workspaceProject.getMainModule().getPomXMLPath());
    verify(view).hideBusyIndicator();
    verify(notificationEvent).fire(any());
    verify(promises).resolve();
  }
}

代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-library-client

public void rename(String newName) {
  if (libraryPermissions.userCanUpdateProject(workspaceProject)) {
    this.view.showBusyIndicator(ts.getTranslation(LibraryConstants.Renaming));
    this.projectService.call((Path path) -> {
      this.view.hideBusyIndicator();
      notificationEvent.fire(new NotificationEvent(ts.format(LibraryConstants.RenameSuccess,
                                  newName),
                             NotificationEvent.NotificationType.SUCCESS));
      this.view.hide();
    }).rename(this.workspaceProject.getMainModule().getPomXMLPath(),
         newName,
         "Project renamed to: " + newName);
  }
}

代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-examples-screen-backend

protected 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;
}

代码示例来源:origin: org.uberfire/uberfire-project-backend

@Override
public boolean isPom(final Path resource) {
  try {
    //Null resource paths cannot resolve to a Module
    if (resource == null) {
      return false;
    }
    //Check if path equals pom.xml
    final Module module = resolveModule(resource);
    //It's possible that the Incremental Build attempts to act on a Module file before the module has been fully created.
    //This should be a short-term issue that will be resolved when saving a module batches pom.xml, kmodule.xml and project.imports
    //etc into a single git-batch. At present they are saved individually leading to multiple Incremental Build requests.
    if (module == null) {
      return false;
    }
    final org.uberfire.java.nio.file.Path path = Paths.convert(resource).normalize();
    final org.uberfire.java.nio.file.Path pomFilePath = Paths.convert(module.getPomXMLPath());
    return path.startsWith(pomFilePath);
  } catch (Exception e) {
    throw ExceptionUtilities.handleException(e);
  }
}

代码示例来源:origin: kiegroup/appformer

@Override
public boolean isPom(final Path resource) {
  try {
    //Null resource paths cannot resolve to a Module
    if (resource == null) {
      return false;
    }
    //Check if path equals pom.xml
    final Module module = resolveModule(resource);
    //It's possible that the Incremental Build attempts to act on a Module file before the module has been fully created.
    //This should be a short-term issue that will be resolved when saving a module batches pom.xml, kmodule.xml and project.imports
    //etc into a single git-batch. At present they are saved individually leading to multiple Incremental Build requests.
    if (module == null) {
      return false;
    }
    final org.uberfire.java.nio.file.Path path = Paths.convert(resource).normalize();
    final org.uberfire.java.nio.file.Path pomFilePath = Paths.convert(module.getPomXMLPath());
    return path.startsWith(pomFilePath);
  } catch (Exception e) {
    throw ExceptionUtilities.handleException(e);
  }
}

代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-library-client

public void reimport() {
  if (this.userCanUpdateProject()) {
    final Path pomXMLPath = workspaceProject.getMainModule().getPomXMLPath();
    view.showBusyIndicator(view.getLoadingMessage());
    promises.promisify(projectScreenService, s -> {
      s.reImport(pomXMLPath);
    }).then(i -> {
      view.hideBusyIndicator();
      notificationEvent.fire(new NotificationEvent(view.getReimportSuccessfulMessage(),
                             NotificationEvent.NotificationType.SUCCESS));
      return promises.resolve();
    }).catch_(this::onError);
  }
}

代码示例来源:origin: kiegroup/appformer

public JobResult testProject(final String jobId,
               final String spaceName,
               final String projectName) {
  final JobResult result = new JobResult();
  result.setJobId(jobId);
  final WorkspaceProject workspaceProject = workspaceProjectService.resolveProject(spacesAPI.getSpace(spaceName), projectName);
  if (workspaceProject == null) {
    result.setStatus(JobStatus.RESOURCE_NOT_EXIST);
    result.setResult("Project [" + projectName + "] does not exist.");
    return result;
  } else {
    final Module module = workspaceProject.getMainModule();
    if (module == null) {
      result.setStatus(JobStatus.RESOURCE_NOT_EXIST);
      result.setResult("Project [" + projectName + "] has no main module.");
      return result;
    } else {
      testService.runAllTests(
          "JobRequestHelper",
          module.getPomXMLPath(),
          getCustomTestResultEvent(result));
      return result;
    }
  }
}

相关文章