I'm getting an error as follows:
Error: Unable to build expression for 'consequence': [Error: unterminated
string literal]
[Near : {... label, priceValue);
                        }
                } ....}]

I've combed the file looking for any stray quote characters, did a ctrl + f
and verified that all my string literals are closed, all my lines of code
have their appropriate ; terminations... I'm sure I'm probably missing
something obvious, but can somebody take a look for me?

I'm using Drools version 5.1.0; my rule file is below.


package net.intellidata.pricing.rules

import net.intellidata.pricing.data.model.PriceDataRecord;
import net.intellidata.pricing.PriceRequest;
import net.intellidata.pricing.result.PriceResult;
import net.intellidata.pricing.result.ValueType;
import net.intellidata.pricing.result.PriceValue;
import net.intellidata.pricing.data.InputType;

rule "someclient-default rule"
        dialect "mvel"
        when 
                $priceRequest : PriceRequest( )
                $priceDataRecord : PriceDataRecord( )
        then
                PriceResult result = new PriceResult($priceRequest.getClient(),
$priceRequest.getRequestedPn());
                for(InputType inputType : $priceDataRecord.keyset())
                {
                        String label = inputType.getPropertyName();
                        Object value = $priceDataRecord.get(inputType);
                        ValueType valueType = null;
                        String valueDisplay = null;
                        switch(inputType)
                        {
                                //Don't add ID and PN to the result - ID is 
unnecessary and PN is
included as a separate property
                                case ID:
                                case PN:
                                        break;

                                case PACKAGE_UNIT:
                                        valueType = ValueType.INTEGER;
                                        valueDisplay = value.toString();
                                        break;

                                case MOQ_1:
                                case MOQ2:
                                        valueType = ValueType.INTEGER;
                                        valueDisplay = value.toString();
                                        break

                                case PRICE_1:
                                case PRICE_2:
                                        valueType = ValueType.BIG_DECIMAL;
                                        valueDisplay = value.toString();
                                        break;

                                case LEAD_TIME:
                                        valueType = ValueType.DOUBLE;
                                        valueDisplay = value.toString();
                                        break;

                                default:
                                        throw new 
IllegalArgumentException("InputType " + InputType.toString()
+ " is not defined for " + $priceRequest.getClient().getName());
                        }

                        if(valueType != null)
                        {
                                PriceValue priceValue = new PriceValue(label, 
value, valueType,
valueDisplay); 
                                result.put(label, priceValue);
                        }
                }
end

-- 
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/Unterminated-String-Literal-error-tp2513857p2513857.html
Sent from the Drools - User mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-users

Reply via email to