Customizing Standard Record Validations

Procedure

  1. Write the Java class which extends the StandardCatalogProductValidator, which is the base implementation for ICatalogProductValidator interface. The sample class can be copied from $MQ_COMMON_DIR/standard/catalog/master/CatalogProductValidator.java.

    The ICatalogProductValidator interface should be implemented by the class that provides the custom validation. This interface has following methods:

    • public HashMap preValidate(ICatalogProduct cp, ICatalogProduct oldCP, HashMap actions)

      This callback method is called before rulebase validations are done.

    • public HashMap validate(ICatalogProduct cp, ICatalogProduct oldCP, HashMap actions)

      This method implements record validations. These validations are applied after rulebase validations are done.

    • public ArrayList isDuplicate(ICatalogProduct cp, ArrayList attrList, ArrayList valueList, int eventId, int ownerType)

      This method checks for duplicates. It overrides the standard duplicate check method.

    • public ArrayList isDuplicate(ICatalogProduct cp, ArrayList attrList, ArrayList valueList)

      This method checks for duplicates. It overrides the standard duplicate check method. This callback is used to verify duplicate when event context is not available.

      Both isDuplicate methods must be implemented.

    • public boolean getDuplicateCheckSQL(ArrayList attrList, ArrayList valueList, StringBuilder sql)

      This method builds the where clause for a duplicate check. For customization, override this method.

  2. Compile the class and copy it to $MQ_COMMON_DIR/<enterpriseInternalName>/catalog/master/<catalogid>.