I need to get entire List from hashmap in Drools.I have inserted hashmap as fact in working memory. In the when part i need to get the list from hashmap.I am using drools 7 version
Map contains String,List of Strings
Please help.
Thanks
Most of Drools rules use MVEL syntax on when part. According to MVEL Language Guyide:
user["foobar"]
is the equivalent of the Java code:
user.get("foobar");
Related
How can we implement pattern matching in Spring Batch, I am using org.springframework.batch.item.file.mapping.PatternMatchingCompositeLineMapper
I got to know that I can only use ? or * here to create my pattern.
My requirement is like below:
I have a fixed length record file and in each record I have two fields at 35th and 36th position which gives record type
for example below "05" is record type which is at 35th and 36th position and total length of record is 400.
0000001131444444444444445589868444050MarketsABNAKKAAAAKKKA05568551456...........
I tried to write regular expression but it does not work, i got to know only two special character can be used which are * and ? .
In that case I can only write like this
??????????????????????????????????05?????????????..................
but it does not seem to be good solution.
Please suggest how can I write this solution, Thanks a lot for help in advance
The PatternMatchingCompositeLineMapper uses an instance of org.springframework.batch.support.PatternMatcher to do the matching. It's important to note that PatternMatcher does not use true regular expressions. It uses something closer to ant patterns (the code is actually lifted from AntPathMatcher in Spring Core).
That being said, you have three options:
Use a pattern like you are referring to (since there is no short hand way to specify the number of ? that should be checked like there is in regular expressions).
Create your own composite LineMapper implementation that uses regular expressions to do the mapping.
For the record, if you choose option 2, contributing it back would be appreciated!
I understand the library http://commons.apache.org/proper/commons-lang/javadocs/api-3.4/index.html provides a number of string functions including StringUtils.capitalize
In Talend OpenStudio 6.3 I have added the tLibraryLoad and in basic settings selected commons-lang3-3.4.jar In advanced settings I have import org.apache.commons.lang3.StringUtils.*;
in my tMap I have StringUtils.Capitalize(row20.Forename) assigned to a variable but I get the error The method Capitalize(String) is undefined for the type StringUtils
On TalendExchange there is a StringUtils available but its only for 6.2 and lower.
Whats the best and most reliable way to get access to additional string handling tools like Capitalize which converts a string like MONKEY to Monkey
It seems that talend uses its own StringUtils library (routines.system), then when specifying "StringUtils", Talend does not recognize your importn and still uses its own class.
In tMap, try org.apache.commons.lang3.StringUtils.capitalize(row20.Forename) instead
You almost got the correct set-up in your tLibraryload but you may try to configure it as illustrated below:
tLibraryload set-up
Tmap
Result
I think you should try StringUtils.Capitalize(row20.Forename)
You can use StringHandling.UPCASE(row20.Forename) to convert to uppercase.
In tMap, click on "..." just where you place the expression to fill the output fields. It oppens the expression builder. Search for "StringHandling" in the categories column, then click on UPCASE and complete the expression proposed as an example by TOS.
I was going through the protractor guide here: https://github.com/angular/protractor/blob/master/docs/api.md#api-protractor
It says in order to locate a element, I could use
var temp = element(by.css("someclass"));
or alternatively
var temp1 = ptor.findElement(protractor.By.css('someclass'))
Which kind of locator is to be used when ? Could someone pls clarify
They are the same. element is the preferred syntax because it is shorter and because you can chain locators and use some fancy protractor features. Protractor extends the webdriver api and that is why you can use the same functions that you would use in plain webdriver.
For example, the following expressions are equivalent:
ptor.findElement(by.css('.foo')).getText()
element(by.css('.foo')).getText()
$('.foo').getText()
To look for multiple elements use:
ptor.findElements(by.css('.foo'))
element.all(by.css('.foo'))
$$('.foo')
There are many examples in the api.md document:
https://github.com/angular/protractor/blob/master/docs/api.md#elementfinderprototypeelement
The difference between ptor.findElement and element is that the first should be used pages without Angular while the second is used on pages with Angular. This is related to how protractor syncs with Angular. The first returns a WebDriver WebElement, the second returns a Protractor ElementFinder.
However to address your question directly, there is no difference between the locators returned by by.css and protractor.By.css.
The two are equivalent. The object referenced by the global by object is the same as the the object referenced by protractor.By.
From Protractor's runner.js:
global.by = global.By = protractor.By;
There are two versions of the API. The old version used protractor.By, whereas the new version uses by. You may often see the old style but if you are in doubt, you can use the new style and be sure nothing unexpected will happen.
i am creating a Lucene 3.0.3 index using StandardAnalyzer.
when searching is made on index using query like C, C# or C++ it gives same result for all these three term. As, i know while creating index analyzer ignore special character and do not create index for same.
Need to be able to differentiate between "C", "C#" and "C++"
please suggest me that, Is any existing analyzer will resolve this issue?
Any suggestion will be appreciated!!!
I guess that happens because of the fact that StandardAnalyzer uses StandardFilter, which uses StandardTokenizer, which removes special characters.
You could create your own Analyzer implementation.
See http://www.gossamer-threads.com/lists/lucene/java-user/91747?do=post_view_threaded#91747
New to Perl and new to ClearQuest Perl API both. I am trying to clear some values from a CQ form. I am able to clear values by simply setting the value to "" but it doesn't work on lists. Any idea how this can be done?
# following doesn't work on lists. What to do?
$entity->SetFieldValue("Foo_List", "");
# following works just fine
$entity->SetFieldValue("barstatus", "");
Here is CQ API reference:
http://publib.boulder.ibm.com/infocenter/cqhelp/v7r0m1/index.jsp?topic=/com.ibm.rational.clearquest.apiref.doc/r_examples_mangngrecrds.htm
As I understand your API, the undef is unlikely to work. setFieldValue can not be called on a list to begin with. I don't know much Perl either. But try creating a loop to read all values, and delete each value using DeleteFieldValue method of entity object.
All methods of entity objects are listed here: http://publib.boulder.ibm.com/infocenter/cqhelp/v7r0m1/index.jsp?topic=/com.ibm.rational.clearquest.apiref.doc/c_entity_mthds.htm
I don't know Perl syntax well. But someone here may be able to help.
hth.