MDM routine
The table below lists some useful MDM routine functions including those for mangling foreign keys. In MDM, you usually need to mangle foreign keys to accommodate to compound keys.
Function |
Description |
Syntax |
---|---|---|
getFK |
Returns one of the foreign key components by position in a mangled foreign key. Note that the position is specified by an integer starting from 0. |
MDM.getFK For example: getFK("[fk1][fk2][fk3]",1), which will return the second foreign key component in the composite foreign key. The output message will be "fk2". |
getWSClientTimeout | Gets webservice client timeout information from jvm param setting. | MDM.getWSClientTimeout(String property) |
createFK |
Returns the foreign key string by a single key (String singleKey). |
MDM.createFK For example: createFK("0"), which will return a foreign key created with the id provided. The output message will be "[0]". |
createFK |
Returns the foreign key string by a key list (String[] keys). |
MDM.createFK For example: createFK({"0","1"}), which will return a foreign key with the ids provided. The output message will be "[0][1]". |
createReturnMessage | Generates an error message with the content of msg and error code of code. | MDM.createReturnMessage(String msg, int code) |
createReturnMessage | Generates a report message with the content of msg and type of type. | MDM.createReturnMessage(String msg, String type) |
getRepeatingElement |
Gets repeating element in an XML string according to the xpath and position. Note that the position is specified by an integer starting from 0. |
MDM.getRepeatingElement For example: getRepeatingElement("<Product><Features><Feature>color</Feature><Feature>size</Feature></Features></Product>","/Product/Features/Feature",1), which will extract the second multi-occurrence element described by the xpath node from the XML string provided. The output message will be "size". |
hasRepeatingElement |
Checks repeating elements in an XML string according to the xpath and the text. |
MDM.hasRepeatingElement For example: hasRepeatingElement("<Product><Features><Feature>color</Feature><Feature>size</Feature></Features></Product>","/Product/Features/Feature","size"), which will return the result about whether the specified multi-occurrence element described by the xpath node and the text "size" exist in the XML string provided. The output message will be "true". |
listRepeatingElement |
Lists repeating elements in an XML string according to the xpath and the delimiter. Note that the delimiter is wrapped by single quotes. |
MDM.listRepeatingElement For example: listRepeatingElement("<Product><Features><Feature>color</Feature><Feature>size</Feature></Features></Product>", "/Product/Features/Feature",',') , which will list all the multi-occurrence elements described by the xpath node from the XML string provided with the specified delimiter. The output message will be "color, size". |
addRepeatingElement |
Adds repeating elements in an XML string according to the xpath and the text. |
MDM.addRepeatingElement For example: addRepeatingElement("<Product><Features><Feature>color</Feature><Feature>size</Feature></Features></Product>", "/Product/Features/Feature","model"), which will add a new multi-occurence element described by the combination
of the xpath node and the text to the XML string provided. The
output message will
be
|
setLanguageVariant |
Adds or updates an ISO variant to the multilingual text value. |
MDM.setLanguageVariant For example: setLanguageVariant("EN","abc","[EN:ab][FR:ab_fr]"), which will update the EN variant to be "abc". The output message will be [EN:abc][FR:ab_fr]. |
setLanguageVariant |
Adds or updates an ISO variant to the multilingual text value with the default ISO and the sort option for the output message. If the sort option is set to "true", the message will be output in alphabetical order. |
MDM.setLanguageVariant For example: setLanguageVariant("FR","ab_fr","ab","EN", true), which will add the FR variant "ab_fr". The output message will be [EN:ab][FR:ab_fr]. |
getLanguageVariant |
Gets an ISO value from a multilingual text value with the default ISO fallback. If the ISO value requested is not found, the default ISO value will be returned. |
MDM.getLanguageVariant For example: getLanguageVariant("DE","EN","[EN:ab][FR:ab_fr]"), which will return the default EN value "ab" because the DE value requested is not found. |
getLanguageVariant |
Gets an ISO value from a multilingual text value. If the ISO value requested is not found, the null value will be returned. |
MDM.getLanguageVariant For example: getLanguageVariant("FR","[EN:ab][FR:ab_fr]"), which will return the requested FR value "ab_fr". |