IBM InfoSphere Master Data Management, Version 11.3<xsd:schema xmlns:product="http://www.ibm.com/xmlns/prod/websphere/mdm/product/schema"
xmlns:xsd= "http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.ibm.com/xmlns/prod/websphere/mdm/product/schema">
<xsd:complexType name="ProductPrice">
<xsd:sequence>
<xsd:element name="normal" type="xsd:decimal"/>
<xsd:element name="discount" type="xsd:decimal" minOccurs="0"/>
</xsd:sequence>
</xsd:element>
<xsd:element name="Product">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="GTIN" type="xsd:integer"/>
<xsd:element name="description" type="xsd:string" minOccurs="0"/>
<xsd:element name="Price" type="product:ProductPrice"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<Product>
<GTIN>1853729163851</GTIN>
<description>Example</description>
<Price>
<normal>188.00</normal>
<discount>94.00</discount>
</Price>
</Product>
This applies to all transaction types and it is of transaction type GENERAL.
PARAM: 100
PARAM: 50
Assuming spec format id is 12345 for the schema
PARAM: /Product/GTIN
Assuming spec format id is 12345 for the schema
PARAM: /Product/Price/normal
PARAM: /Product/Price/discount
public class GreaterCheck extends ValidatorCommon {
public final static String BIG = "BIG";
public final static String SMALL = "SMALL";
public final static String SPECNAME = "SPECNAME";
public final static String NAMESPACE = "NAMESPACE";
private String big;
private String small;
private String specName;
private String nameSpace;
public PriceCheck() {
super();
}
protected void setValidatorParameter(Map param) throws ValidationException
{
List list = null;
try {
list = (List) param.get(BIG);
big = (String) list.get(0);
list = (List) param.get(SMALL);
small= (String) list.get(0);
list = (List) param.get(SPECNAME);
specName = (String) list.get(0);
list = (List) param.get(NAMESPACE);
nameSpace = (String) list.get(0);
} catch (Exception e) {
throw new ValidationException("Set ParamType: " + BIG + " and "+
SMALL + " failed. " + e);
}
}
protected DWLStatus validateObject(Object obj, DWLStatus status, Object env) throws ValidationException{
try {
//cast to dynamic object
DynamicEntity dn = (DynamicEntity) obj;
//get SpecValueBObj
SpecValueBObj sv = dn.retrieveSpecValueBObj(specName, nameSpace);
//get big and small value
float aBig = Float.parseFloat(sv.retrieveLeafAttributeText(big));
float aSmall = Float.parseFloat(sv.retrieveLeafAttributeText(small));
//check value
if (aBig <= aSmall) {
this.setErrorStatus(status);
}
} catch (Exception e) {
throw new ValidationException(e);
}
return status;
}
}