Class CbeffImpl

  • All Implemented Interfaces:
    CbeffUtil

    @Component
    public class CbeffImpl
    extends Object
    implements CbeffUtil
    This class is used to create,update, validate and search Cbeff data.
    Author:
    Ramadurai Pandian
    • Constructor Detail

      • CbeffImpl

        public CbeffImpl()
    • Method Detail

      • loadXSD

        @PostConstruct
        public void loadXSD()
                     throws IOException
        Load XSD.
        Throws:
        IOException - Signals that an I/O exception has occurred.
      • createXML

        public byte[] createXML​(List<BIR> birList)
                         throws Exception
        Method used for creating Cbeff XML.
        Specified by:
        createXML in interface CbeffUtil
        Parameters:
        birList - pass List of BIR for creating Cbeff data
        Returns:
        return byte array of XML data
        Throws:
        Exception - exception
      • createXML

        public byte[] createXML​(List<BIR> birList,
                                byte[] xsd)
                         throws Exception
        Method used for creating Cbeff XML with xsd.
        Specified by:
        createXML in interface CbeffUtil
        Parameters:
        birList - pass List of BIR for creating Cbeff data
        xsd - byte array of XSD data
        Returns:
        return byte array of XML data
        Throws:
        Exception - Exception
      • updateXML

        public byte[] updateXML​(List<BIR> birList,
                                byte[] fileBytes)
                         throws Exception
        Method used for updating Cbeff XML.
        Specified by:
        updateXML in interface CbeffUtil
        Parameters:
        birList - pass List of BIR for creating Cbeff data
        fileBytes - the file bytes
        Returns:
        return byte array of XML data
        Throws:
        Exception - Exception
      • validateXML

        public boolean validateXML​(byte[] xmlBytes,
                                   byte[] xsdBytes)
                            throws Exception
        Method used for validating XML against XSD.
        Specified by:
        validateXML in interface CbeffUtil
        Parameters:
        xmlBytes - byte array of XML data
        xsdBytes - byte array of XSD data
        Returns:
        boolean if data is valid or not
        Throws:
        Exception - Exception
      • getBDBBasedOnType

        public Map<String,​String> getBDBBasedOnType​(byte[] fileBytes,
                                                          String type,
                                                          String subType)
                                                   throws Exception
        Method used for validating XML against XSD.
        Specified by:
        getBDBBasedOnType in interface CbeffUtil
        Parameters:
        fileBytes - byte array of XML data
        type - to be searched
        subType - to be searched
        Returns:
        bdbMap Map of type and String of encoded biometric data
        Throws:
        Exception - Exception
      • getBIRDataFromXML

        public List<BIR> getBIRDataFromXML​(byte[] xmlBytes)
                                    throws Exception
        Method used for getting list of BIR from XML bytes *
        Specified by:
        getBIRDataFromXML in interface CbeffUtil
        Parameters:
        xmlBytes - byte array of XML data
        Returns:
        List of BIR data extracted from XML
        Throws:
        Exception - Exception
      • getAllBDBData

        public Map<String,​String> getAllBDBData​(byte[] xmlBytes,
                                                      String type,
                                                      String subType)
                                               throws Exception
        Method used for getting Map of BIR from XML bytes with type and subType.
        Specified by:
        getAllBDBData in interface CbeffUtil
        Parameters:
        xmlBytes - byte array of XML data
        type - type
        subType - subType
        Returns:
        bdbMap Map of BIR data extracted from XML
        Throws:
        Exception - Exception