on 03-11-2008 5:59 PM
Hello All,
Can ayone post a litle code how to do Validations with this old one JAVA API
Thanks in advance,
Andre
hi,
this may help you
thanks
vijay
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Andre, Here's a snippet of code - not plug'n play and without much context, but you'll hopefully get the gist of the solution. My private method getValidationsIDs() merely examines the standard MDM Validations table, and pulls out the IDs for all validations associated with the table being validated
int[] m_tableValidationIds;
CMTableInfo m_validationTableProperties;
ValidateRecordsCommand m_validateRecordsCommand;
m_validateRecordsCommand = m_catalogData.CreateValidateRecordsCommand();
m_validateRecordsCommand.SetTable(yourTableName);
// find the validation table and identify validations for this table
m_validationTableProperties = getValidationTable();
m_tableValidationIds = getValidationsIDs(yourTableID);
// records to validate
m_validateRecordsCommand.SetRecordIDs(recordIds);
// validations to use for the records selected above
m_validateRecordsCommand.SetValidationIDs(m_tableValidationIds);
// validate
int returnCode = m_validateRecordsCommand.Execute();
// retrieve failures
ValidationFailures failures = m_validateRecordsCommand.GetValidationFailures();
// Have any validations failed? Retrieve details.
if (failures.GetTotalValidationsFailed() > 0)
{
int[] failedValidationIds = failures.GetValidationIDs();
Set mappings = getValidationDetails(failedValidationIds).entrySet();
String validationErrorDetails = "Validation Failures: ";
for (Iterator i = mappings.iterator(); i.hasNext();)
{
Map.Entry me = (Map.Entry) i.next();
Object oKey = me.getKey();
Object oValue = me.getValue();
validationErrorDetails = validationErrorDetails + "\n " + oValue.toString();
}
throw new UpdateFailedException(validationErrorDetails);
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.