本文整理了Java中org.kie.api.io.Resource.getSourcePath
方法的一些代码示例,展示了Resource.getSourcePath
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Resource.getSourcePath
方法的具体详情如下:
包路径:org.kie.api.io.Resource
类名称:Resource
方法名:getSourcePath
暂无
代码示例来源:origin: kiegroup/jbpm
if (resource.getSourcePath() != null ) {
String path = resource.getSourcePath();
代码示例来源:origin: kiegroup/jbpm
resource.setSourcePath(processResource.getSourcePath());
resource.setTargetPath(processResource.getTargetPath());
代码示例来源:origin: kiegroup/jbpm
if (duplicateProcess != null) {
Resource duplicatedResource = duplicateProcess.getResource();
if (resource == null || duplicatedResource == null || duplicatedResource.getSourcePath() == null ||
duplicatedResource.getSourcePath().equals(resource.getSourcePath())) {
this.errors.add(new DuplicateProcess(process,
this.knowledgeBuilder.getBuilderConfiguration()));
代码示例来源:origin: kiegroup/jbpm
protected List<Resource> buildAndDumpBPMN2Process(String process) throws SAXException, IOException {
KnowledgeBuilderConfiguration conf = KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration();
((KnowledgeBuilderConfigurationImpl) conf).initSemanticModules();
((KnowledgeBuilderConfigurationImpl) conf).addSemanticModule(new BPMNSemanticModule());
((KnowledgeBuilderConfigurationImpl) conf).addSemanticModule(new BPMNDISemanticModule());
((KnowledgeBuilderConfigurationImpl) conf).addSemanticModule(new BPMNExtensionsSemanticModule());
Resource classpathResource = ResourceFactory.newClassPathResource(process);
// Dump and reread
XmlProcessReader processReader
= new XmlProcessReader(((KnowledgeBuilderConfigurationImpl) conf).getSemanticModules(), getClass().getClassLoader());
List<Process> processes = processReader.read(this.getClass().getResourceAsStream("/" + process));
List<Resource> resources = new ArrayList<Resource>();
for (Process p : processes) {
RuleFlowProcess ruleFlowProcess = (RuleFlowProcess) p;
String dumpedString = XmlBPMNProcessDumper.INSTANCE.dump(ruleFlowProcess);
Resource resource = ResourceFactory.newReaderResource(new StringReader(dumpedString));
resource.setSourcePath(classpathResource.getSourcePath());
resource.setTargetPath(classpathResource.getTargetPath());
resources.add(resource);
}
return resources;
}
代码示例来源:origin: kiegroup/jbpm
kfs.delete(res.getSourcePath());
kfs.write(ResourceFactory.newFileResource(packageFile));
代码示例来源:origin: org.drools/drools-compiler
@Test
public void testDummyResourceWithWrongEncodedFileName() {
final Resource dummyResource = new KieBuilderSetImpl.DummyResource("Dummy 100%");
assertEquals(dummyResource.getSourcePath(), "Dummy 100%");
}
代码示例来源:origin: org.drools/knowledge-api
public String getSourcePath() {
return delegate.getSourcePath();
}
代码示例来源:origin: kiegroup/droolsjbpm-integration
@Override
public boolean accept(Process process, Resource resource) {
if (process != null && RuleFlowProcess.RULEFLOW_TYPE.equals(process.getType())
&& resource.getSourcePath() != null
&& resource.getSourcePath().matches(".+\\.bpsim\\.bpmn[2]?$")) {
return true;
}
return false;
}
代码示例来源:origin: org.drools/jbpm-simulation
@Override
public boolean accept(Process process, Resource resource) {
if (process != null && RuleFlowProcess.RULEFLOW_TYPE.equals(process.getType())
&& resource.getSourcePath() != null
&& resource.getSourcePath().matches(".+\\.bpsim\\.bpmn[2]?$")) {
return true;
}
return false;
}
代码示例来源:origin: org.drools/drools-compiler
assertNotNull( ikm.getResource( r1.getSourcePath() ) );
assertNotNull( ikm.getResource( r2.getSourcePath() ) );
assertNotNull( ikm.getResource( r3.getSourcePath() ) );
assertNotNull( ikm.getResource( r4.getSourcePath() ) );
代码示例来源:origin: kiegroup/drools-wb
public DMNModel getDMNModel(Path path, String dmnPath) {
return getDMNRuntime(path).getModels().stream()
.filter(model -> dmnPath.endsWith(model.getResource().getSourcePath()))
.findFirst()
.orElseThrow(() -> new IllegalStateException("Impossible to find DMN model"));
}
代码示例来源:origin: org.drools/kie-pmml
private Resource buildOutputResource(Resource resource, String theory) {
ByteArrayResource byteArrayResource = new ByteArrayResource(theory.getBytes(IoUtils.UTF8_CHARSET));
byteArrayResource.setResourceType(ResourceType.PMML);
if (resource.getSourcePath() != null) {
String originalPath = resource.getSourcePath();
int start = originalPath.lastIndexOf(File.separator);
byteArrayResource.setSourcePath("generated-sources/" + originalPath.substring(start) + ".pmml");
} else {
byteArrayResource.setSourcePath("generated-sources/" + helper.getContext() + ".pmml");
}
return byteArrayResource;
}
代码示例来源:origin: kiegroup/drools-wb
public void setActiveModel(String path) {
dmnRuntimeFluent
.addCommand(context -> {
RegistryContext registryContext = (RegistryContext) context;
DMNRuntime dmnRuntime = registryContext.lookup(DMNRuntime.class);
if (dmnRuntime == null) {
throw new IllegalStateException("There is no DMNRuntime available");
}
DMNModel dmnModel = dmnRuntime.getModels().stream()
.filter(model -> path.endsWith(model.getResource().getSourcePath()))
.findFirst()
.orElseThrow(() -> new IllegalStateException("Cannot find a DMN model with resource=" + path));
registryContext.register(DMNModel.class, dmnModel);
return dmnModel;
})
.out(DMN_MODEL);
}
代码示例来源:origin: kiegroup/droolsjbpm-knowledge
public KieHelper addResource(Resource resource, ResourceType type) {
if (resource.getSourcePath() == null && resource.getTargetPath() == null) {
resource.setSourcePath(generateResourceName(type));
}
return addResource(resource);
}
代码示例来源:origin: org.kie/kie-dmn-core
@Test
public void executeWithResource() {
GetDMNModelCommand getDMNModelCommand = new GetDMNModelCommand(resource.getSourcePath());
assertThatThrownBy(() -> getDMNModelCommand.execute(registryContext))
.isInstanceOf(IllegalStateException.class)
.hasMessage("There is no DMNRuntime available");
registryContext.register(DMNRuntime.class, dmnRuntime);
DMNModel dmnModel = getDMNModelCommand.execute(registryContext);
assertEquals(resource.getSourcePath(), dmnModel.getResource().getSourcePath());
}
}
代码示例来源:origin: org.kie/kie-dmn-core
@Test
public void executeWithResource() {
SetDMNActiveModelCommand setDMNActiveModelCommand = new SetDMNActiveModelCommand(resource.getSourcePath());
assertThatThrownBy(() -> setDMNActiveModelCommand.execute(registryContext))
.isInstanceOf(IllegalStateException.class)
.hasMessage("There is no DMNRuntime available");
registryContext.register(DMNRuntime.class, dmnRuntime);
DMNModel dmnModel = setDMNActiveModelCommand.execute(registryContext);
assertEquals(resource.getSourcePath(), dmnModel.getResource().getSourcePath());
}
}
代码示例来源:origin: org.kie.server/kie-server-services-jbpm-ui
public byte[] getImageContent(String location, String name) {
org.kie.api.definition.process.Process process = kieContainer.getKieBase(kieBaseName).getProcess(name);
if (process != null) {
String sourcePath = process.getResource().getSourcePath();
if (sourcePath != null) {
String processDirectory = "";
if (sourcePath.indexOf("/") != -1) {
processDirectory = sourcePath.substring(0, sourcePath.lastIndexOf("/") + 1);
}
byte[] data = seek(processDirectory, name, kieModule);
if (data != null) {
return data;
}
// set process directory as location in case the main search mechanism did not find the image
location = processDirectory;
}
}
byte[] data = seek(location, name, kieModule);
if (data == null && kieModule.getKieDependencies() != null) {
for (InternalKieModule depKieModule : kieModule.getKieDependencies().values()) {
data = seek(location, name, depKieModule);
if (data != null) {
break;
}
}
}
return data;
}
代码示例来源:origin: org.jbpm/jbpm-bpmn2
resource.setSourcePath(processResource.getSourcePath());
resource.setTargetPath(processResource.getTargetPath());
代码示例来源:origin: org.jbpm/jbpm-bpmn2
protected List<Resource> buildAndDumpBPMN2Process(String process) throws SAXException, IOException {
KnowledgeBuilderConfiguration conf = KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration();
((KnowledgeBuilderConfigurationImpl) conf).initSemanticModules();
((KnowledgeBuilderConfigurationImpl) conf).addSemanticModule(new BPMNSemanticModule());
((KnowledgeBuilderConfigurationImpl) conf).addSemanticModule(new BPMNDISemanticModule());
((KnowledgeBuilderConfigurationImpl) conf).addSemanticModule(new BPMNExtensionsSemanticModule());
Resource classpathResource = ResourceFactory.newClassPathResource(process);
// Dump and reread
XmlProcessReader processReader
= new XmlProcessReader(((KnowledgeBuilderConfigurationImpl) conf).getSemanticModules(), getClass().getClassLoader());
List<Process> processes = processReader.read(this.getClass().getResourceAsStream("/" + process));
List<Resource> resources = new ArrayList<Resource>();
for (Process p : processes) {
RuleFlowProcess ruleFlowProcess = (RuleFlowProcess) p;
String dumpedString = XmlBPMNProcessDumper.INSTANCE.dump(ruleFlowProcess);
Resource resource = ResourceFactory.newReaderResource(new StringReader(dumpedString));
resource.setSourcePath(classpathResource.getSourcePath());
resource.setTargetPath(classpathResource.getTargetPath());
resources.add(resource);
}
return resources;
}
代码示例来源:origin: org.jbpm/jbpm-bpmn2
kfs.delete(res.getSourcePath());
kfs.write(ResourceFactory.newFileResource(packageFile));
内容来源于网络,如有侵权,请联系作者删除!