Open topic with navigation

TIBCO ActiveMatrix BusinessWorks™ Plug-in for SWIFT 6.10.0

# MX Java Rule Code Example

An example of the MX Java rule code is provided for your reference.

    package com.tibco.swift2.validate.mx.rules.spec2017;
    import java.util.List;
    import org.dom4j.Element;
    import com.tibco.swift2.msg.MXFinder;
    import com.tibco.swift2.msg.SwiftMXMessage;
    import com.tibco.swift2.util.SwiftException;
    import com.tibco.swift2.validate.ArgResolver;
    import com.tibco.swift2.validate.MXValidationRule;
    import com.tibco.swift2.validate.MXValidator;
    public class PhysicalDeliveryDetails1Rule extends MXValidationRule {
    public PhysicalDeliveryDetails1Rule(String name,String xpath,,String overrideErrorSeverity, String
    overrideErrorCode,String overrideErrorText,
    String[] args, ArgResolver resolver) throws SwiftException {
    super(name, xpath, overrideErrorSeverity, overrideErrorCode, overrideErrorText, args, resolver, 0, 0, new
    Class[0]);
    }
    @Override
    public boolean eval(SwiftMXMessage msg, MXValidator validator, int validationLevel) {
    MXFinder finderParent=new MXFinder(getParam_Parent());
    boolean isValid = true;
    List<Element> elementsParent = finderParent.getElements(msg);
    String physDlvryIndTag=getParam_PhysDlvryInd().replace("//", "");
    String physDlvryDtlsTag=getParam_PhysDlvryDtls().replace("//", "");
    for(int i=0;i<elementsParent.size();i++) {
    Element elementParent=elementsParent.get(i);
    Element elementPhysDlvryInd=elementParent.element(physDlvryIndTag);
    Element elementPhysDlvryDtls=elementParent.element(physDlvryDtlsTag);
    if(elementPhysDlvryInd!=null) {
    if(elementPhysDlvryInd != null){
    if(elementPhysDlvryInd.getStringValue().equals("false") || elementPhysDlvryInd.getStringValue().equals("0")){
    if(elementPhysDlvryDtls!=null) {
    msg.addWarning(elementParent, getName(), getOverrideErrorCode(),getOverrideErrorText());
    isValid = false;
    }
    }
    }
    }
    }
    return isValid;
    }
    public String getParam_PhysDlvryInd(){
    return getParam().get("PhysDlvryInd");
    }
    public String getParam_PhysDlvryDtls(){
    return getParam().get("PhysDlvryDtls");
    }
    public String getParam_Parent(){
    return getParam().get("Parent");

Did you find this helpful?

Yes No
Great!
Thanks for taking the time to give us some feedback.
Sorry about that

Why wasn't this helpful? (check all that apply)

Could not find what I was looking for
Instructions confusing or unclear
Instructions did not work

Want to tell us more?

Please select at least one option or provide details about the issue!!

Error occurred while submitting feedback.

Error2 occurred while submitting feedback.

TIBCO ActiveMatrix BusinessWorks™ Plug-in for SWIFT

Copyright © 2001-2024. Cloud Software Group, Inc. All Rights Reserved.