Please find the rules below. That exception is happening from this rule

PAN Device MAC Address null or empty rule

to

PAN Device Smart Device Model null rule



import java.lang.Error;
import java.util.List;
import com.ge.energy.drms.smartgrid.datamodel.model.Customer
import com.ge.energy.drms.core.datamodel.messagesupport.ServiceContext
import
com.ge.energy.drms.external.integration.service.persistence.RegistrationDeregistrationPersistence
import
com.ge.energy.drms.smartgrid.datamodel.services.enddevicemanagement.pandeviceregistrationservice.MissingEntryFault
import com.ge.energy.drms.smartgrid.datamodel.model.ElectricServiceInterface
import com.ge.energy.drms.smartgrid.datamodel.model.PANDevice

global Customer customer;
global ServiceContext serviceContext;

rule "Customer and Service Context null check rule"
no-loop true
salience 1000
        when
                eval( customer == null && serviceContext == null ) // condition
        then
                throw new MissingEntryFault("Customer and ServiceContext are 
both
required"); // consequence
end

rule "User Name null or empty check rule"
no-loop true
salience 900
        when
                ServiceContext( userName == null || userName == "" ) // 
condition
        then
                throw new MissingEntryFault("USER ID is required"); // 
consequence
end
/*
rule "User Name validation check rule"
no-loop true
salience 800
        when
                $serviceContext : ServiceContext()
                RegistrationDeregistrationPersistence( eval( validateUserName(
$serviceContext ) <= -1 ) ) // condition
        then
                throw new Error("USER ID is invalid"); // consequence
end
*/
rule "Service Account Number null or empty rule"
no-loop true
salience 700
        when
                Customer( serviceAccountNumber == null || serviceAccountNumber 
== "" ) //
condition
        then
                throw new MissingEntryFault("Service Account Number is 
required"); //
consequence
end

rule "Install Service null or empty rule"
no-loop true
salience 600
        when
                Customer( installService == null || installService == "" ) // 
condition
        then
                throw new MissingEntryFault("Install Service is required"); // 
consequence
end

rule "Electric Service Interface null or empty rule"
no-loop true
salience 500
        when
                Customer( electricServiceInterfaces == null ||
electricServiceInterfaces.size() <=0 ) // condition
        then
                throw new MissingEntryFault("Electric Service Interfaces are 
required");
// consequence
end

rule "ESN null or empty rule"
no-loop true
salience 400
        when
                $customer : Customer()
                $esi : ElectricServiceInterface() from
$customer.getElectricServiceInterfaces()
                eval( $esi.getESN() == null || $esi.getESN().isEmpty() ) 
//condition
        then
                throw new MissingEntryFault("ESN cannot be null or empty"); // 
consequence
end

rule "PAN Device null or empty rule"
no-loop true
salience 300
        when
                $customer : Customer()
                $esi : ElectricServiceInterface() from
$customer.getElectricServiceInterfaces()
                eval( $esi.getPANdevices() == null || 
$esi.getPANdevices().size()<=0 )
//condition
        then
                throw new MissingEntryFault("PAN Device list cannot be null or 
empty"); //
consequence
end

rule "PAN Device MAC Address null or empty rule"
no-loop true
salience 200
        when
                $customer : Customer()
                $esis : ElectricServiceInterface() from
$customer.getElectricServiceInterfaces()
                        $panDevice : PANDevice() from $esis.getPANdevices()
                        eval( $panDevice.getMACAddress() == null || 
$panDevice.getMACAddress() ==
"" ) //condition
        then
                throw new MissingEntryFault("MAC Address cannot be null or 
empty"); //
consequence
end

rule "PAN Device Install Code null or empty rule"
no-loop true
salience 100
        when
                $customer : Customer()
                $esis : ElectricServiceInterface() from
$customer.getElectricServiceInterfaces()
                        $panDevice : PANDevice() from $esis.getPANdevices()
                        eval( $panDevice.getInstallCode() == null || 
$panDevice.getInstallCode()
== "" ) //condition
        then
                throw new MissingEntryFault("Install Code cannot be null or 
empty"); //
consequence
end

rule "PAN Device Smart Device Model null rule"
no-loop true
salience 90
        when
                $customer : Customer()
                $esis : ElectricServiceInterface() from
$customer.getElectricServiceInterfaces()
                        $panDevice : PANDevice() from $esis.getPANdevices()
                        eval( $panDevice.getSmartDeviceModel() == null ) 
//condition
        then
                throw new MissingEntryFault("Smart Device Model cannot be 
null"); //
consequence
end

rule "PAN Device Smart Device Model Device Class null rule"
no-loop true
salience 80
        when
                $customer : Customer()
                $esis : ElectricServiceInterface() from
$customer.getElectricServiceInterfaces()
                        $panDevice : PANDevice() from $esis.getPANdevices()
                        eval( $panDevice.getSmartDeviceModel().getDeviceClass() 
== null )
//condition
        then
                throw new MissingEntryFault("Device Class cannot be null"); // 
consequence
end

rule "PAN Device Smart Device Model Device Type null rule"
no-loop true
salience 70
        when
                $customer : Customer()
                $esis : ElectricServiceInterface() from
$customer.getElectricServiceInterfaces()
                        $panDevice :PANDevice() from $esis.getPANdevices()
                        eval( $panDevice.getSmartDeviceModel().getDeviceType() 
== null )
//condition
        then
                throw new MissingEntryFault("Device Type cannot be null"); // 
consequence
end


--
View this message in context: 
http://drools.46999.n3.nabble.com/Eval0Invoker-java-lang-NullPointerException-tp3586222p3586355.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-users

Reply via email to