How can I eliminate a "not defined" warning referring to a java.util class in my BOM file? - jrules

I'm using ODM 8.5 (the JRules successor). I generated a BOM from an existing Java project. One of the generated classes in my bom file looks something like:
public class MyClass extends java.io.Serializable
{
public java.util.UUID myId;
}
I get a warning:
[BOM] GBRMO0012W: Referenced type java.util.UUID is not defined
What do I need to do to get ODM to recognize Java classes in the BOM? I also see similar warnings about java.sql.Timestamp and others.

You can try generating a new BOM entry based on your JRE XOM and containing the classes responsible for the warnings:
Launch the 'New BOM Entry' wizard (File -> New -> BOM Entry in the Rules perspective).
In the first page of the 'New BOM Entry' wizard click 'Next >' (the option 'Create a BOM entry from a XOM' should be selected by default).
In the second page of the 'New BOM Entry' wizard, click on the 'Browse XOM...' button. The 'Browse XOM' dialog should pop-up.
In the 'Browse XOM' dialog, select the entry corresponding to your JRE, then click 'OK'.
In the 'New BOM Entry' wizard, tick the classes you are interested in, then click 'Finish'.
Note that it worked fine for me for java.util.UUID but I suspect that depending of which classes and members are imported into your BOM entry, you could end-up with other (lots of?) similar warnings.
Unfortunately, I didn't find any other way to get rid of those...

Related

Is it possible to make eclipse "new java class wizard" open the class in a specified section of a split screen?

In eclipse, I have split the editor view in two section so I can read from one file while editing the other. The file I read from contains scratch remarks something like
// Student(firstname, lastname, subject, mark)
and I need to create class Student with fields as above. So I write
Student student;
and press the quick-fix shortcut, opening the new java class wizard which creates the new class Student.java and I write
String firstname; String lastname, String mark;
left to be formatted and furnished with setters/getters later automatically.
Unfortunately, the new class opens exactly in that part of the screen where my class with the remarks is, hiding it.
Is there a decent way to persuade the wizard to open the file in the other part of the screen?

How to accomplish drop-down lists in KIE workbench?

I'm new to JBPM and am trying to wrap my head around a new project, and recently noticed that while trying to define some user task forms I couldn't find a form option for a drop-down list
At this point my knowledge of the technology is pretty small, and this seems like a strange limitation at first glance, which should have an easy work-around, but I'm having difficulty finding a quick and dirty solution.
Is this something I'd have to code in Eclipse, or something else?
The answer that #cego provides is correct for "hard-coded" values, if you want to load dynamic values (from a database for example) you can use the Select Box field type and configure it to use a SelectValuesProvider that calculates the combo values.
To create a SelectValuesProvider you should create a java project with a mvn dependency to:
<dependency>
<groupId>org.jbpm</groupId>
<artifactId>jbpm-form-modeler-api</artifactId>
</dependency>
Once you did that you can create your class that implements org.jbpm.formModeler.core.config.SelectValuesProvider. This interface provides two methods:
String getIdentifier(): should return a unique String that identifies this provider. This String will be shown on the Select Box configuration popup.
Map getSelectOptions(Field field, String value, FormRenderContext renderContext, Locale locale): This method have to return a Map containting the key, text that are going to be load on the Select box. The received parameters are:
Field field: the configuration of the field that is going to be evaluated.
String Value: the current value of the field
FormRenderContext renderContext: a class that contains all the information about the form that is rendered at that moment.
Locale locale: the locale in which is being rendered the form.
Once you've created this provider, you must compile your project and put the jar on the server classpath and restart it. After doing that you'll be able to create a form (or edit an existing one), add a Select Box field and choose your provider on the "Data provider" combo box.
Hope it helps, if you have any doubt please ask and I'll try to create an example.
Regards,
Pere
Ok, for old versions you can do it turning a textbox to a combobox using a RangeProvider. This is a very similar solution to the previous one.
First you should create java project with a mvn dependency to:
<dependency>
<groupId>org.jbpm</groupId>
<artifactId>jbpm-form-modeler-api</artifactId>
</dependency>
After that you have to create your RangeProvider class that implements org.jbpm.formModeler.api.model.RangeProvider and implement it's methods. As the SelectValuesProvider on the previous example this interface provides two methods:
- String getType(): A unique String to identify the provider
- Map getRangesMap(String namespace): This method have to return a Map containting the key, text that are going to be load on the combo box. It only receives a String parameter, it is an identifier that allows you to get all the information about the form that is being rendered.
Also you have to create a META-INF/beans.xml file to allow to lookup your provider via CDI (I missed this step on the previous example, sorry).
As the previous example, once you've created the provider you must compile your project and put the jar on the server classpath and restart it.
When the server is started you have to create a new form (or open an existing one), add a TextBox field, edit it's properties and write the string returned by your RangeProvider's getType method on the "Range value" property.
Save the field properties and if everything is fine the field would be rendered as a combobox showing the values returned by your provider.
To create a select element(drop-down list) look for "Setting a Range Formula" in this part of the documentation: http://docs.jboss.org/jbpm/v6.1/userguide/chap-formmodeler.html#sect-formmodeler-FormulasExpression

How to define a function for use in an ODM decision table w/o changing the XOM?

I'm using ODM 8.5 (the JRules successor). In my Java domain, I have a three-character String field that represents a number, "000" to "999". I'd like to have a decision table that represents logic like:
if field is between "000" and "012" then set the result to "tiny"
if field is between "013" and "060" then set the result to "less tiny"
...
IBM's documentation on defining columns states - "A condition statement is an incomplete BAL predicate expression...". Is there anything in the BAL that does the kind of String comparison I want to do? If not, is it possible to call a function defined in the IRL from the BAL? If so, how? I'm also open to other suggestions on how to handle this simple problem in ODM (without changing the existing Java XOM). Right now, it looks to me that I can't use an ODM decision table, although the underlying logic seems well-suited to a decision table.
This answer is heavily based on Justin Phillips's nice answer to this question, updated for ODM 8.5. Please plus up his answer.
The main idea is to create a function in the Business Object Model (BOM) that can be called from your rules. To add a BOM function:
Right click the bom folder in the Eclipse rules project.
Select New -> BOM Entry from the menu.
Select the Create an empty BOM entry option and then click Finish.
Double click the new BOM entry to bring up the BOM editor view, and
then click New Class.
Enter the class name and then click Finish.
Double click the new BOM class from the list, then under
the Members section, click the New button.
In the New Member
dialog, select the Method option, enter a Name (isBetween),
return Type for the method (boolean), and add three String parameters (testee - the value being tested, min and max). Click the Finish button.
Double click the new method under the Members section, and select the Static and Final options.
Click the Create link under the "Member Verbalization" section and fill in the Template text box with {0} is between {1,min} to {2,max}
Under the BOM to XOM Mapping section, enter your Java code.
11. Go back to the class level BOM editor and set the Execution name to the value void in the "BOM to XOM Mapping" section. This indicates that the BOM class is not linked to a Java class (XOM).
The verbalization for the newly created member should now be accessible when filling out the Test in the Condition Column for the decision table.

Unable to loacte properites file in wicket

In my wicket application i have 3-4 different packages say pack1,pack2 and so on .
In pack1 i have different html and java classes. I am validating the null check by setRequired(true) and getting the message from properties file.I am naming my properties file as Send.properties ... as i have Send.html and Send.java in pack1.In properties file i am mentioning like this
formname.field.Required=The ${label} is missing
I want to validate all the html fields which are present in different html pages of the same package (pack1)in one properties file say pack1.properties .So my question here is will one singe properties will be sufficient for one package where in all the validation will be taken care.
Yes, wicket first looks for the property in the properties file associated to the page, and then in the properties asociated to the package (and after that in parents packages...).
But, as long as I know the package properties file is called package.properties (independently of the package name).

How do you stop Eclipse from inserting a certain class in Content-Assist?

I'm using SpringSource Tool Suite (Eclipse) to program with Grails, and I'm also using JFreechart in the program.
In Grails you log by typing log.info("method worked"). Unfortunately JFrechart has a class called "Log" with Static methods like "info". This means that in STS I type log.info and then when I type space or ( Eclipse "assists" me by importing the JFreechart Log class and changing what I've typed to Log.info(message). Very irritating.
I reckon I could turn off the Eclipse option to "insert single proposals automatically", but I like this feature. Can I instruct Eclipse not to give me content assist from this particular JFreechart class?
You can add the JFreechart Log class to Type Filters via Window > Preferences > Java > Appearance > Type Filters:
alt text http://www.imagebanana.com/img/aairbchy/screenshot_009.png