All Downloads are FREE. Search and download functionalities are using the official Maven repository.

nz.co.senanque.oneinvoice.R5 Maven / Gradle / Ivy


package nz.co.senanque.oneinvoice;

import java.io.Serializable;
import nz.co.senanque.base.BusinessCustomer;
import nz.co.senanque.rules.FieldReference;
import nz.co.senanque.rules.Operations;
import nz.co.senanque.rules.Rule;
import nz.co.senanque.rules.RuleContext;
import nz.co.senanque.rules.RuleProxyField;
import nz.co.senanque.rules.RuleSession;
import nz.co.senanque.rules.UnKnownFieldValueException;
import nz.co.senanque.validationengine.ValidationObject;
import org.springframework.stereotype.Component;


/**
 * formula:BusinessCustomer no antecedents
 * {
 * businessx=IndustryType.FISH;}
 * 
 */
@Component("nz.co.senanque.oneinvoice.R5")
public class R5
    implements Serializable, Rule
{

    private final static long serialVersionUID = 1L;

    public void evaluate(final RuleSession session, final ValidationObject object, final RuleContext ruleContext) {
        final Operations operations = session.getOperations();
        final RuleProxyField proxyFieldbusinessx = session.getRuleProxyField(session.getMetadata(object).getProxyField("businessx"));
        try {
            session.assign(ruleContext, (nz.co.senanque.base.IndustryType.FISH), proxyFieldbusinessx);
        } catch (UnKnownFieldValueException _x) {
            return ;
        }
    }

    public String getRuleName() {
        return "nz.co.senanque.oneinvoice.R5:no antecedents";
    }

    public String getMessage(final RuleSession session, final ValidationObject object) {
        return session.getMessage("nz.co.senanque.oneinvoice.R5", new Object[] { });
    }

    public String toString() {
        return "nz.co.senanque.oneinvoice.R5:no antecedents";
    }

    public String getClassName() {
        return "BusinessCustomer";
    }

    public Class getScope() {
        return BusinessCustomer.class;
    }

    public FieldReference[] listeners() {
        return null;
    }

    public FieldReference[] outputs() {
        return new FieldReference[] {new FieldReference("Customer", "BusinessCustomer", "businessx")};
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy