Class DefaultSpreadsheetWorkbookDataValidatorDelegate

java.lang.Object
com.ptc.windchill.ixb.importer.custom.validator.delegate.DefaultSpreadsheetWorkbookDataValidatorDelegate
All Implemented Interfaces:
SpreadsheetWorkbookDataValidatorDelegate

public class DefaultSpreadsheetWorkbookDataValidatorDelegate extends Object implements SpreadsheetWorkbookDataValidatorDelegate
The class provides the default implementation the custom validation hook for validating at Workbook level for adding validations across sheets. The implementation must extend this class for adding custom validations at workbook level. Custom warnings or exceptions thrown from custom validation logic should adhere to pattern mentioned below. They should add warnings or exceptions to single list with all details, which will be returned by API getErrorsOrWarnings().

Supported API: true

Extendable: true
  • Method Details

    • validateFieldsForAllSheetsInWorkbook

      public void validateFieldsForAllSheetsInWorkbook(Map<String,Map<String,Map<String,Map>>> trackableToElementsMap, Locale locale) throws WTException
      This method provides the custom validation for the entire workbook. The specifics of validation is left to customer's implementation where customer will have access to entire workbook data and group of sheets along with all rows present in given sheet.

      Supported API: true
      Specified by:
      validateFieldsForAllSheetsInWorkbook in interface SpreadsheetWorkbookDataValidatorDelegate
      Parameters:
      trackableToElementsMap - This will give all import data in form of Map of ImportType as key, and value is Map of SheetNames against RowInformation. This is again a Map with RowNumber as key and RowData as value. Import type can be PART,BOM etc.
      locale -
      allWorkbookSheetDataAlongWithAllRows - This will give all import data in form of Mapinvalid input: '<'ImportType, ArrayListinvalid input: '<'Mapinvalid input: '<'SheetName, Mapinvalid input: '<'RowNumber,RowData>>>>, Where import type can be PART,BOM etc.
      Throws:
      WTException
    • addException

      public void addException(String sheetName, String rowNumber, String exceptionMsg, boolean isWarning) throws WTException
      This method provides adds Exceptions or Warnings to single collection which can be thrown during custom validations.

      Supported API: true
      Parameters:
      sheetName - Name of current sheet being imported
      rowNumber - row Number of given row being validated
      exceptionMsg - Localized exception message to be given
      isWarning - If true, then Warning would be reported, else will be treated as Error
      Throws:
      WTException
    • addException

      public void addException(String sheetName, String rowNumber, WTException customExceptionOrWarning) throws WTException
      This method provides adds Exceptions or Warnings to single collection which can be thrown during custom validations.

      Supported API: true
      Parameters:
      sheetName - Name of current sheet being imported
      rowNumber - row Number of given row being validated
      customExceptionOrWarning - Exception to be thrown to Import Framework
      Throws:
      WTException
    • addException

      public void addException(String exceptionMsg, boolean isWarning) throws WTException
      This method provides adds Exceptions to single collection which can be thrown during custom validations.

      Supported API: true
      Parameters:
      exceptionMsg - Localized exception message to be given
      isWarning - If true, then Warning would be reported, else will be treated as Error
      Throws:
      WTException
    • addException

      public void addException(WTException customExceptionOrWarning) throws WTException
      This method provides adds Exceptions to single collection which can be thrown during custom validations.

      Supported API: true
      Parameters:
      customExceptionOrWarning - Exception to be thrown to Import Framework
      Throws:
      WTException
    • getErrorsOrWarnings

      public List<WTException> getErrorsOrWarnings()
      This method returns list of custom warnings or exceptions thrown by custom logic during validations. Custom implementation should override this API to return warnings or exceptions to be shown on Import from Spreadsheet UI.

      Supported API: true
      Specified by:
      getErrorsOrWarnings in interface SpreadsheetWorkbookDataValidatorDelegate
      Returns:
      List List of exceptions/warnings thrown from custom logic, to be returned to ImportService
      Throws:
      WTException