Adding Custom Validations for SIM Bundles
You can add custom validations to validate the SIM bundle data in PTC Arbortext Content Delivery.
Follow these steps to add a custom validation for SIM:
1. Add the validation entry in the SIMFileValidationScanner component and the validation details in the customizedContext_YY.conf.xml file. The customizedContext_YY.conf.xml file is a copy of its default version and YY in the file name denotes a numeric value lesser than the corresponding numeric value in the default file. For more information, see Configuring Custom Validations for SIM Bundle.
2. Create a Java class file that extends the default validation. The file must call the validate(String inputData) API for the file type validation.
3. Add the Java class file to the SCEValidationManager.jar file located in <HOME>/SW/SW/System/WildFly/modules/system/layers/base/com/ptc/e3c/main.
4. Restart the coreServer, coreCMIserver, and JBoss services.
All validations are executed in the given sequence when you run the Validate SIM Data task from the Task Manager. The Validation_Results_(<task_id>) file is generated every time your run the Validate SIM Data task and the <task_id> task identifier is appended to the validation results file name.
The Validation_Results_(<task_id>) file is located in <HOME>/Data/Work/Applications/TaskManager/Work/TaskReport/SIMVValidationReports. If a validation is of type error and it fails, or is of type warning, the Validation_Results_(<task_id>) file displays the code, description, and resolution for the validation.
In this example, a custom validation is added to validate if the publishInfo file is present in the bundle or not.
Follow these steps to add the custom validation:
1. Add the following validation details whether the customizedContext_YY.conf.xml file:
2. Add the following validation entry in the SIMFileValidationScanner component of the customizedContext_YY.conf.xml file:
3. Create a Java class file that extends the DefaultValidator and add the file to the SCEValidationManager.jar file.Add the following jar files in the referenced libraries from location <HOME>/SW/SW/System/WildFly/modules/system/layers/base/com/ptc/e3c/main:
SCEValidationManager.jar
framework.jar
runtime.jar
SCEContentManager.jar
SCECSVLoad.jar
processMonitor.jar
storage.jar
workflowEngine.jar
The following Java class file shows an example format to extend the default validation:
package com.ptc.sce.validation.px;
import java.io.File;
import com.enigma.sdk.framework.logger.Logger;
import com.ptc.sce.validator.DefaultValidator;
import com.ptc.sce.validator.ValidationConstant;
public class DemoPxValidator extends DefaultValidator { /* This method can be used to implement custom validation logic for SIM validator. It receives a string value of specified. To include multiple valdation messages, you can call the following method: logger. writeLog(ValidationMessage validationRecord, String taskCode, Object ... params);
Return false if validation fails; otherwise, return true. */
@Override
public boolean validate(String arg0) {
/*validation logic should be added here */
/*to generate output log messages in case of failure.
Here 823 is validation code as specified in customizedContext_3.xml logger.writeLog(validationMessage,"823"); */
}
@Override
public boolean validate() {
// TODO Auto-generated method stub
return false;
}
4. Restart the coreServer, coreCMIserver, and JBoss services.
Was this helpful?