本文整理汇总了Java中org.drools.core.util.StringUtils.isEmpty方法的典型用法代码示例。如果您正苦于以下问题:Java StringUtils.isEmpty方法的具体用法?Java StringUtils.isEmpty怎么用?Java StringUtils.isEmpty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.drools.core.util.StringUtils
的用法示例。
在下文中一共展示了StringUtils.isEmpty方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateToVersion
import org.drools.core.util.StringUtils; //导入方法依赖的package包/类
public boolean updateToVersion(String version) {
checkStatus();
if (StringUtils.isEmpty(version)) {
throw new IllegalArgumentException("Update to version cannot accept an empty version");
}
ReleaseId releaseId = kieServices.newReleaseId(
rulesConfiguration.getGroupId(),
rulesConfiguration.getArtifactId(),
version);
Results results = kieContainer.updateToVersion(releaseId);
this.releaseId = kieContainer.getReleaseId();
KieSessionUtils.logResults(results);
if (results.hasMessages(Message.Level.ERROR)) {
LOGGER.error("Update to version {} aborted due to errors", version);
return false;
}
LOGGER.info("Update to version {} completed", version);
return true;
}
示例2: setupClasspathKmoduleBuilder
import org.drools.core.util.StringUtils; //导入方法依赖的package包/类
private static RuntimeEnvironmentBuilder setupClasspathKmoduleBuilder(KieContainer kieContainer,
String kbaseName,
String ksessionName) {
if (StringUtils.isEmpty(kbaseName)) {
KieBaseModel defaultKBaseModel = ((KieContainerImpl)kieContainer).getKieProject().getDefaultKieBaseModel();
if (defaultKBaseModel != null) {
kbaseName = defaultKBaseModel.getName();
} else {
kbaseName = DEFAULT_KBASE_NAME;
}
}
InternalKieModule module = (InternalKieModule) ((KieContainerImpl)kieContainer).getKieModuleForKBase(kbaseName);
if (module == null) {
throw new IllegalStateException("Cannot find kbase with name " + kbaseName);
}
KieBase kbase = kieContainer.getKieBase(kbaseName);
return getDefault()
.knowledgeBase(kbase)
.classLoader(kieContainer.getClassLoader())
.registerableItemsFactory(new KModuleRegisterableItemsFactory(kieContainer, ksessionName));
}
示例3: setupClasspathKmoduleBuilder
import org.drools.core.util.StringUtils; //导入方法依赖的package包/类
private static RuntimeEnvironmentBuilder setupClasspathKmoduleBuilder(KieContainer kieContainer, String kbaseName, String ksessionName) {
if (StringUtils.isEmpty(kbaseName)) {
KieBaseModel defaultKBaseModel = ((KieContainerImpl)kieContainer).getKieProject().getDefaultKieBaseModel();
if (defaultKBaseModel != null) {
kbaseName = defaultKBaseModel.getName();
} else {
kbaseName = DEFAULT_KBASE_NAME;
}
}
InternalKieModule module = (InternalKieModule)((KieContainerImpl)kieContainer).getKieModuleForKBase(kbaseName);
if (module == null) {
throw new IllegalStateException("Cannot find kbase with name " + kbaseName);
}
KieBase kbase = kieContainer.getKieBase(kbaseName);
return getDefault().knowledgeBase(kbase).classLoader(kieContainer.getClassLoader())
.registerableItemsFactory(new KModuleRegisterableItemsFactory(kieContainer, ksessionName));
}
示例4: getContent
import org.drools.core.util.StringUtils; //导入方法依赖的package包/类
public String getContent(String name, String... vars) {
Map<String, String> map = new HashMap<String, String>();
int counter = 1;
for (String var : vars) {
map.put("var" + counter++, var);
}
if (!StringUtils.isEmpty(copyToDataFormat)) {
writer.println();
writer.println("@declare{\"" + name + "\"}");
}
String s = (String)TemplateRuntime.execute(tempReg.getNamedTemplate(name), map);
if (!StringUtils.isEmpty(copyToDataFormat)) {
writer.print(prettyPrintXml(template.requestBody("direct:to-" + copyToDataFormat, s, String.class)));
writer.println("@end{}");
}
return roundTripFromXml(s.trim());
}
示例5: start
import org.drools.core.util.StringUtils; //导入方法依赖的package包/类
public void start(String groupId, String artifactId, String version) {
if (started.compareAndSet(false, true)) {
kieServices = KieServices.Factory.get();
if (!(StringUtils.isEmpty(groupId) || StringUtils.isEmpty(artifactId) || StringUtils.isEmpty(version)) &&
(!rulesConfiguration.getGroupId().equals(groupId) || !rulesConfiguration.getArtifactId().equals(artifactId))) {
throw new IllegalStateException(String.format("Cannot start a Rule Manager with different Group Id and Artifact. " +
"Rule configuration releaseId [%s:%s:%s] cached value [%s:%s:%s]",
rulesConfiguration.getGroupId(), rulesConfiguration.getArtifactId(), rulesConfiguration.getVersion(),
groupId, artifactId, version));
}
this.kieContainer = newKieContainer(version);
this.releaseId = this.kieContainer.getReleaseId();
}
}
示例6: getKieBase
import org.drools.core.util.StringUtils; //导入方法依赖的package包/类
public KieBase getKieBase(KieContainer kieContainer) {
checkStatus();
if (!StringUtils.isEmpty(rulesConfiguration.getKieBaseName())) {
return kieContainer.getKieBase(rulesConfiguration.getKieBaseName());
}
return kieContainer.getKieBase();
}
示例7: newKieSession
import org.drools.core.util.StringUtils; //导入方法依赖的package包/类
public KieSession newKieSession(KieContainer kieContainer) {
checkStatus();
if (!StringUtils.isEmpty(rulesConfiguration.getKieSessionName())) {
return kieContainer.newKieSession(rulesConfiguration.getKieSessionName());
}
return kieContainer.newKieSession();
}
示例8: configure
import org.drools.core.util.StringUtils; //导入方法依赖的package包/类
protected void configure(KieComponent component, String uri) {
ksessionId = getKsessionId(uri);
if (!StringUtils.isEmpty(ksessionId)) {
executor = component.getCamelContext().getRegistry().lookup(ksessionId, CommandExecutor.class);
if (executor == null) {
if (NO_KSESSION_ENDPOINT.equals(ksessionId)) {
executorsByName = new HashMap<String, CommandExecutor>();
} else {
throw new RuntimeCamelException("Failed to instantiate KieEndpoint. Could not find ksession for " + " uri=\"" + uri + "\". Check configuration.");
}
}
}
}
示例9: before
import org.drools.core.util.StringUtils; //导入方法依赖的package包/类
@Before
public void before() throws Exception {
tempReg.addNamedTemplate("tempReg", TemplateCompiler.compileTemplate(getClass().getResourceAsStream(dataformat + ".mvt"), (Map<String, Class<? extends Node>>)null));
TemplateRuntime.execute(tempReg.getNamedTemplate("tempReg"), null, tempReg);
XMLUnit.setIgnoreComments(true);
XMLUnit.setIgnoreWhitespace(true);
XMLUnit.setIgnoreAttributeOrder(true);
XMLUnit.setNormalizeWhitespace(true);
XMLUnit.setNormalize(true);
if (!StringUtils.isEmpty(copyToDataFormat)) {
writer = new PrintWriter(new BufferedWriter(new FileWriter(copyToDataFormat + ".mvt", true)));
}
}
示例10: getCombinedCode
import org.drools.core.util.StringUtils; //导入方法依赖的package包/类
public String getCombinedCode() {
if (StringUtils.isEmpty(combinedCode)) {
combinedCode = stateCode + STATE_CODE_SEPARATOR + device.getOrg().getLocalCode();
}
return combinedCode;
}
示例11: process
import org.drools.core.util.StringUtils; //导入方法依赖的package包/类
public void process(Exchange exchange) throws Exception {
// Bad Hack - Need to remote it and fix it in Camel (if it's a camel problem)
// I need to copy the body of the exachange because for some reason
// the getContext().getEndpoint() erase the content/or loose the reference
String body = exchange.getIn().getBody(String.class);
if (ke == null) {
this.ke = exchange.getContext().getEndpoint(this.kieUri, KieEndpoint.class);
}
if (ke == null) {
throw new RuntimeException("Could not find DroolsEndPoint for uri=" + this.kieUri);
}
ClassLoader originalClassLoader = null;
try {
originalClassLoader = Thread.currentThread().getContextClassLoader();
CommandExecutor exec = ke.getExecutor();
if (exec == null) {
String lookup = exchange.getIn().getHeader(KieComponent.KIE_LOOKUP, String.class);
if (StringUtils.isEmpty(lookup)) {
// Bad Hack - Need to remote it and fix it in Camel (if it's a camel problem)
lookup = ke.getLookup(body);
// lookup = ke.getLookup( exchange.getIn().getBody( String.class ) );
}
if (StringUtils.isEmpty(lookup)) {
throw new RuntimeException("No Executor defined and no lookup information available for uri " + this.ke.getEndpointUri());
}
exec = ke.getCommandExecutor(lookup);
}
if (exec == null) {
throw new RuntimeException("CommandExecutor cannot be found for uri " + this.ke.getEndpointUri());
}
ClassLoader localClassLoader = ke.getClassLoader(exec);
if (localClassLoader == null) {
throw new RuntimeException("CommandExecutor Classloader cannot be null for uri " + this.ke.getEndpointUri());
}
// Set the classloader to the one used by the CommandExecutor
// Have to set it in both places, as not all places yet use the camel ApplicationContextClassLoader (like xstream dataformats)
Thread.currentThread().setContextClassLoader(localClassLoader);
exchange.getContext().setApplicationContextClassLoader(localClassLoader);
ExecutionNodePipelineContextImpl context = new ExecutionNodePipelineContextImpl(localClassLoader);
context.setCommandExecutor(exec);
exchange.setProperty("kie-context", context);
// Bad Hack - Need to remote it and fix it in Camel (if it's a camel problem)
// I need to re set the Body because the exchange loose the content at
// the begining of the method
exchange.getIn().setBody(new ByteArrayInputStream(body.getBytes("UTF-8")));
boolean soap = false;
if (!augmented && exchange.getFromEndpoint() instanceof CxfSpringEndpoint) {
new PreCxfTransportSoapProcessor().process(exchange);
soap = true;
}
processor.process(exchange);
if (soap) {
new PostCxfTransportSoapProcessor().process(exchange);
}
} finally {
Thread.currentThread().setContextClassLoader(originalClassLoader);
exchange.getContext().setApplicationContextClassLoader(originalClassLoader);
}
}
示例12: after
import org.drools.core.util.StringUtils; //导入方法依赖的package包/类
@After
public void after() throws Exception {
if (!StringUtils.isEmpty(copyToDataFormat)) {
writer.close();
}
}