OIM 11G R2 PS2 : RequestDataValidator Plugin

In this post, I will talk about a custom RequestDataValidator plugin which is used for custom validation of request data after submission. Please remember that it is used after request submission and not before or during the request submission.


I will provide below the sample implementation

You can attach the data validation anywhere you get the form or request data.

import java.util.Iterator;
import java.util.List;

import oracle.iam.request.exception.InvalidRequestDataException;
import oracle.iam.request.plugins.RequestDataValidator;
import oracle.iam.request.vo.Beneficiary;
import oracle.iam.request.vo.RequestBeneficiaryEntity;
import oracle.iam.request.vo.RequestBeneficiaryEntityAttribute;
import oracle.iam.request.vo.RequestData;


public class RequestDataValidatorPlugin implements RequestDataValidator{

    @Override
    public void validate(RequestData requestdata) throws InvalidRequestDataException {
        List<Beneficiary> beneficiaries = requestdata.getBeneficiaries();
        List<RequestBeneficiaryEntity> beneficiaryEntities = null;  
        List<RequestBeneficiaryEntityAttribute> beneficiaryEntityAttributes = null;
         for (Beneficiary beneficiary : beneficiaries){
             beneficiaryEntities = beneficiary.getTargetEntities();
             for (RequestBeneficiaryEntity beneficiaryEntity : beneficiaryEntities) {
                 beneficiaryEntityAttributes = beneficiaryEntity.getEntityData();
                 for (RequestBeneficiaryEntityAttribute requestBeneficiaryEntityAttribute : beneficiaryEntityAttributes){
                      System.out.println("requestBeneficiaryEntityAttribute.getName()--->"+requestBeneficiaryEntityAttribute.getName());
                      System.out.println("requestBeneficiaryEntityAttribute.getValue()--->"+requestBeneficiaryEntityAttribute.getValue());
                      if(requestBeneficiaryEntityAttribute.hasChild()){
                          List <RequestBeneficiaryEntityAttribute> childRequestBeneficiaryEntityAttributes = requestBeneficiaryEntityAttribute.getChildAttributes();
                          Iterator iterator = childRequestBeneficiaryEntityAttributes.iterator();
                          while(iterator.hasNext()){
                              RequestBeneficiaryEntityAttribute childAttribute =(RequestBeneficiaryEntityAttribute)iterator.next();
                              System.out.println("childAttribute.getName()--->"+childAttribute.getName());
                              System.out.println("childAttribute.getValue()--->"+childAttribute.getValue());
                              
                          }
                      }
                 }
             }
         }
        
    }

}

Comments

Popular posts from this blog

OIM 11g R2 PS2 : SOA Approval Workflow Sample

Oracle Identity Manager (OIM) Interview Questions

OHS 12c (12.1.3) webgate deployment and configuration