本文整理了Java中org.guvnor.common.services.project.model.Package
类的一些代码示例,展示了Package
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Package
类的具体详情如下:
包路径:org.guvnor.common.services.project.model.Package
类名称:Package
[英]An item representing a Package within a Module
[中]表示模块中的包的项
代码示例来源:origin: org.kie.workbench.services/kie-wb-common-services-backend
@Override
public boolean accept(final Path path) {
final Package pkg = moduleService.resolvePackage(path);
if (pkg == null) {
return false;
}
return pkg.getPackageMainSrcPath().equals(path) ||
pkg.getPackageMainResourcesPath().equals(path) ||
pkg.getPackageTestSrcPath().equals(path) ||
pkg.getPackageTestResourcesPath().equals(path);
}
代码示例来源:origin: org.kie.workbench.services/kie-wb-common-services-backend
private String getFullyQualifiedClassName(final Path path) {
final Package pkg = moduleService.resolvePackage(Paths.convert(path));
final String packageName = pkg.getPackageName();
if (packageName == null) {
return null;
}
final String className = path.getFileName().toString().replace(".java",
"");
return (packageName.equals("") ? className : packageName + "." + className);
}
代码示例来源:origin: org.kie.workbench.widgets/kie-wb-common-ui
private List<Package> getSortedPackages(final boolean includeDefaultPackage,
final Set<Package> pkgs) {
final List<Package> sortedPackages = new ArrayList<>(pkgs);
Collections.sort(sortedPackages,
(p1, p2) -> p1.getCaption().compareTo(p2.getCaption()));
// Remove default package, if not required (after sorting it is guaranteed to be at index 0)
if (!includeDefaultPackage
&& !sortedPackages.isEmpty()
&& "".equals(sortedPackages.get(0).getPackageName())) {
sortedPackages.remove(0);
}
return sortedPackages;
}
代码示例来源:origin: kiegroup/jbpm-wb
public void configurePackage(@Observes NewPackageEvent pkg) {
if (isCaseProject(Paths.convert(pkg.getPackage().getModuleRootPath()))) {
String resourcesPathStr = Paths.convert(pkg.getPackage().getPackageMainResourcesPath()).toUri().toString();
String separator = Paths.convert(pkg.getPackage().getModuleRootPath()).getFileSystem().getSeparator();
Path resourcesPath = ioService.get(URI.create(resourcesPathStr + separator + WORK_DEFINITION_FILE));
addWorkDefinitions(resourcesPath);
}
}
代码示例来源:origin: org.guvnor/guvnor-project-backend
@Override
public Path resolveDefaultPath(Package pkg) {
return pkg.getPackageMainResourcesPath();
}
}
代码示例来源:origin: kiegroup/drools-wb
@Override
public void create(final Package pkg,
final String baseFileName,
final NewResourcePresenter presenter) {
final ScoreCardModel model = new ScoreCardModel();
model.setName(baseFileName);
model.setPackageName(pkg.getPackageName());
busyIndicatorView.showBusyIndicator(CommonConstants.INSTANCE.Saving());
scoreCardService.call(getSuccessCallback(presenter),
new HasBusyIndicatorDefaultErrorCallback(busyIndicatorView)).create(pkg.getPackageMainResourcesPath(),
buildFileName(baseFileName,
resourceType),
model,
"");
}
}
代码示例来源:origin: org.kie.workbench.services/kie-wb-common-services-backend
@Before
public void setUp() {
super.setUp();
final Bean moduleServiceBean = (Bean) beanManager.getBeans(KieModuleService.class).iterator().next();
final CreationalContext cc = beanManager.createCreationalContext(moduleServiceBean);
moduleService = (KieModuleService) beanManager.getReference(moduleServiceBean,
KieModuleService.class,
cc);
assertNotNull(moduleService);
final Set<Bean<?>> beans = beanManager.getBeans(ResourceTypeDefinition.class);
assertNotNull(beans);
assertFalse(beans.isEmpty());
resourceTypes = beans.stream()
.map(bean -> ((ResourceTypeDefinition) beanManager.getReference(bean,
bean.getBeanClass(),
cc)).getSuffix())
.collect(Collectors.toList());
pkg = mock(Package.class);
packageMainResourcesPath = mock(Path.class);
packageMainSrcPath = mock(Path.class);
when(pkg.getPackageMainResourcesPath()).thenReturn(packageMainResourcesPath);
when(pkg.getPackageMainSrcPath()).thenReturn(packageMainSrcPath);
}
代码示例来源:origin: kiegroup/drools-wb
@Override
public void create( final Package pkg,
final String baseFileName,
final NewResourcePresenter presenter ) {
busyIndicatorView.showBusyIndicator( CommonConstants.INSTANCE.Saving() );
service.call(
getSuccessCallback( presenter ),
new HasBusyIndicatorDefaultErrorCallback( busyIndicatorView ) ).create( pkg.getPackageTestResourcesPath(),
buildFileName( baseFileName,
resourceType ),
new Scenario( pkg.getPackageName(),
baseFileName ),
"" );
}
代码示例来源:origin: org.kie.workbench.services/kie-wb-common-services-backend
@Override
public Path resolveDefaultPath(Package pkg) {
return pkg.getPackageMainSrcPath();
}
}
代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-data-modeller-backend
/**
* Given a path within a module calculates the expected class name for the given class.
*/
public String calculateClassName(final Module module,
final org.uberfire.backend.vfs.Path path) {
PortablePreconditions.checkNotNull("module", module);
if (path == null) {
return null;
}
final Package defaultPackage = moduleService.resolveDefaultPackage(module);
if (defaultPackage == null) {
return null;
}
final Path mainSrcNioPath = Paths.convert(defaultPackage.getPackageMainSrcPath());
final Path testSrcNioPath = Paths.convert(defaultPackage.getPackageTestSrcPath());
final Path nioPath = Paths.convert(path);
Path relativePath = null;
if (mainSrcNioPath != null && nioPath.startsWith(mainSrcNioPath)) {
relativePath = mainSrcNioPath.relativize(nioPath);
} else if (testSrcNioPath != null && nioPath.startsWith(testSrcNioPath)) {
relativePath = testSrcNioPath.relativize(nioPath);
}
if (relativePath != null) {
String className = relativePath.toString().replace("/", ".");
return className.substring(0, className.lastIndexOf(".java"));
}
return null;
}
代码示例来源:origin: kiegroup/drools-wb
@Before
public void setup() throws Exception {
Set<Package> packages = new HashSet<>();
packages.add(new Package(path, path, path, path, path, "Test", "", ""));
when(kieModuleService.resolveModule(any())).thenReturn(module);
when(kieModuleService.resolvePackages(any(KieModule.class))).thenReturn(packages);
when(ioService.exists(activatorPath)).thenReturn(false);
when(kieModuleService.resolveModule(any())).thenReturn(module);
when(module.getPom()).thenReturn(projectPom);
when(projectPom.getGav()).thenReturn(gav);
when(gav.getGroupId()).thenReturn("Test");
when(projectPom.getDependencies()).thenReturn(dependencies);
when(ioService.exists(any(org.uberfire.java.nio.file.Path.class))).thenReturn(false);
when(mockedPackage.getPackageTestSrcPath()).thenReturn(path);
when(scenarioSimulationBuilderMock.createSimulation(any(), any(), any())).thenReturn(new Simulation());
service.scenarioSimulationBuilder = scenarioSimulationBuilderMock;
}
代码示例来源:origin: kiegroup/drools-wb
@Test
public void checkRightResourceType() throws Exception {
handler.create(new Package(),
"newfile.scesim",
mock(NewResourcePresenter.class));
verify(busyIndicatorViewMock).showBusyIndicator("Saving");
verify(busyIndicatorViewMock).hideBusyIndicator();
verify(notificationEventMock).fire(any(NotificationEvent.class));
verify(newResourceSuccessEventMock).fire(any(NewResourcePresenter.class));
verify(placeManagerMock).goTo(any(Path.class));
}
代码示例来源:origin: kiegroup/drools-wb
org.uberfire.java.nio.file.Path getActivatorPath(Package rootModulePackage) {
org.uberfire.java.nio.file.Path packagePath = Paths.convert(rootModulePackage.getPackageTestSrcPath());
return packagePath.resolve(ScenarioJunitActivator.ACTIVATOR_CLASS_NAME + ".java");
}
代码示例来源:origin: kiegroup/drools-wb
@Override
public void create(final Package pkg,
final String baseFileName,
final NewResourcePresenter presenter) {
final ScenarioSimulationModel.Type selectedType = sourceTypeSelector.getSelectedType();
String value;
switch (selectedType) {
case DMN:
value = uploadWidget.getSelectedPath();
if (value == null || value.isEmpty()) {
return;
}
break;
case RULE:
default:
value = "default";
}
busyIndicatorView.showBusyIndicator(CommonConstants.INSTANCE.Saving());
scenarioSimulationService.call(getSuccessCallback(presenter),
new HasBusyIndicatorDefaultErrorCallback(busyIndicatorView)).create(pkg.getPackageTestResourcesPath(),
buildFileName(baseFileName,
resourceType),
new ScenarioSimulationModel(),
"",
selectedType,
value);
}
代码示例来源:origin: org.uberfire/uberfire-project-backend
@Override
public Path resolveDefaultPath(Package pkg) {
return pkg.getPackageMainResourcesPath();
}
}
代码示例来源:origin: org.drools/drools-wb-guided-scorecard-editor-client
@Override
public void create(final Package pkg,
final String baseFileName,
final NewResourcePresenter presenter) {
final ScoreCardModel model = new ScoreCardModel();
model.setName(baseFileName);
model.setPackageName(pkg.getPackageName());
busyIndicatorView.showBusyIndicator(CommonConstants.INSTANCE.Saving());
scoreCardService.call(getSuccessCallback(presenter),
new HasBusyIndicatorDefaultErrorCallback(busyIndicatorView)).create(pkg.getPackageMainResourcesPath(),
buildFileName(baseFileName,
resourceType),
model,
"");
}
}
代码示例来源:origin: org.jbpm/jbpm-wb-integration-backend
public void configurePackage(@Observes NewPackageEvent pkg) {
if (isCaseProject(Paths.convert(pkg.getPackage().getModuleRootPath()))) {
String resourcesPathStr = Paths.convert(pkg.getPackage().getPackageMainResourcesPath()).toUri().toString();
String separator = Paths.convert(pkg.getPackage().getModuleRootPath()).getFileSystem().getSeparator();
Path resourcesPath = ioService.get(URI.create(resourcesPathStr + separator + WORK_DEFINITION_FILE));
addWorkDefinitions(resourcesPath);
}
}
代码示例来源:origin: org.kie.workbench.widgets/kie-wb-common-ui
private void addPackagesToSelect(final List<Package> sortedPackages,
final Package activePackage) {
final Map<String, String> packageNames = new HashMap<>();
for (Package pkg : sortedPackages) {
packageNames.put(pkg.getCaption(),
pkg.getPackageName());
packages.put(pkg.getCaption(),
pkg);
}
selectedPackage = getSelectedPackage(activePackage,
packageNames);
view.setUp(selectedPackage,
packageNames);
}
代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-project-explorer-client
private Path getFolderItemPath(final FolderItem folderItem) {
if (folderItem.getItem() instanceof Package) {
final Package pkg = ((Package) folderItem.getItem());
return pkg.getPackageMainSrcPath();
} else if (folderItem.getItem() instanceof Path) {
return (Path) folderItem.getItem();
}
return null;
}
代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-data-modeller-backend
Path testSrcPath = Paths.convert(testRootPath.resolve("myProject/src/test/java"));
when(defaultPackage.getPackageMainSrcPath()).thenReturn(mainSrcPath);
when(defaultPackage.getPackageTestSrcPath()).thenReturn(testSrcPath);
内容来源于网络,如有侵权,请联系作者删除!