Class FormArchiveUtils
- java.lang.Object
-
- com.avoka.fc.core.service.composer.FormArchiveUtils
-
public class FormArchiveUtils extends Object
Provides a service to create a Form Archive POJO from the given FAR byte array.
-
-
Field Summary
Fields Modifier and Type Field Description static String
FAR_FORMSEED_PATH
The Form Archive 'META-INF/formseed.xml' file path.static String
FAR_SFMCONFIG_PATH
The Form Archive 'META-INF/sfmconfig.xml' file path.static String
SFM_CONFIG_CONTACT_EMAIL_ELEMENT
The Form Archive 'META-INF/sfmconfig.xml' contactEmailXPath elementstatic String
SFM_CONFIG_CONTACT_PHONE_ELEMENT
The Form Archive 'META-INF/sfmconfig.xml' contactPhoneXPath elementstatic String
SFM_CONFIG_DATA_EXTRACT_NAME
The Form Archive 'META-INF/sfmconfig.xml' the data extract name attributestatic String
SFM_CONFIG_DATA_EXTRACT_PUBLISH
The Form Archive 'META-INF/sfmconfig.xml' the data extract publish attributestatic String
SFM_CONFIG_DATA_EXTRACT_REPEAT
The Form Archive 'META-INF/sfmconfig.xml' the data extract repeat attributestatic String
SFM_CONFIG_DATA_EXTRACT_SEARCHABLE
The Form Archive 'META-INF/sfmconfig.xml' the data extract searchable attribute This attribute is no longer supported in TM as of 18.11.0static String
SFM_CONFIG_DATA_EXTRACT_SUBSCRIBE
The Form Archive 'META-INF/sfmconfig.xml' the data extract subscribe attributestatic String
SFM_CONFIG_DATA_EXTRACT_VALUE
The Form Archive 'META-INF/sfmconfig.xml' the data extract value attributestatic String
SFM_CONFIG_DATA_EXTRACT_XPATH
The Form Archive 'META-INF/sfmconfig.xml' the data extract repeat element xPathstatic String
SFM_CONFIG_SAVE_CHALLENGE_ELEMENT
The Form Archive 'META-INF/sfmconfig.xml' saveChallengeXPath element
-
Constructor Summary
Constructors Constructor Description FormArchiveUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static FormArchive
createFormArchive(byte[] formArchiveData)
Create a FormArchive from the given ZIP byte array.static FormArchive
createFormArchive(byte[] formArchiveData, String farFileName)
Create a FormArchive from the given ZIP byte array.static FormArchive
getFormArchiveByFarKey(Map<String,FormArchive> formArchives, String farFormKey)
Retrieve the form archive with the specified keystatic byte[]
getFormArchiveBytes(byte[] packageData, String fileName)
Return a form archive with a given file namestatic Map<String,FormArchive>
getFormArchivesFromPackage(byte[] packageData)
Get map of form archives (keyed on archive name) from Composer Package data (ZIP).static String
validateFormArchive(byte[] formArchiveData)
Validate the given form archive byte array content and return null if valid, or the validation error otherwise.
-
-
-
Field Detail
-
SFM_CONFIG_CONTACT_EMAIL_ELEMENT
public static final String SFM_CONFIG_CONTACT_EMAIL_ELEMENT
The Form Archive 'META-INF/sfmconfig.xml' contactEmailXPath element- See Also:
- Constant Field Values
-
SFM_CONFIG_CONTACT_PHONE_ELEMENT
public static final String SFM_CONFIG_CONTACT_PHONE_ELEMENT
The Form Archive 'META-INF/sfmconfig.xml' contactPhoneXPath element- See Also:
- Constant Field Values
-
SFM_CONFIG_SAVE_CHALLENGE_ELEMENT
public static final String SFM_CONFIG_SAVE_CHALLENGE_ELEMENT
The Form Archive 'META-INF/sfmconfig.xml' saveChallengeXPath element- See Also:
- Constant Field Values
-
SFM_CONFIG_DATA_EXTRACT_XPATH
public static final String SFM_CONFIG_DATA_EXTRACT_XPATH
The Form Archive 'META-INF/sfmconfig.xml' the data extract repeat element xPath- See Also:
- Constant Field Values
-
SFM_CONFIG_DATA_EXTRACT_PUBLISH
public static final String SFM_CONFIG_DATA_EXTRACT_PUBLISH
The Form Archive 'META-INF/sfmconfig.xml' the data extract publish attribute- See Also:
- Constant Field Values
-
SFM_CONFIG_DATA_EXTRACT_REPEAT
public static final String SFM_CONFIG_DATA_EXTRACT_REPEAT
The Form Archive 'META-INF/sfmconfig.xml' the data extract repeat attribute- See Also:
- Constant Field Values
-
SFM_CONFIG_DATA_EXTRACT_SEARCHABLE
public static final String SFM_CONFIG_DATA_EXTRACT_SEARCHABLE
The Form Archive 'META-INF/sfmconfig.xml' the data extract searchable attribute This attribute is no longer supported in TM as of 18.11.0- See Also:
- Constant Field Values
-
SFM_CONFIG_DATA_EXTRACT_SUBSCRIBE
public static final String SFM_CONFIG_DATA_EXTRACT_SUBSCRIBE
The Form Archive 'META-INF/sfmconfig.xml' the data extract subscribe attribute- See Also:
- Constant Field Values
-
SFM_CONFIG_DATA_EXTRACT_NAME
public static final String SFM_CONFIG_DATA_EXTRACT_NAME
The Form Archive 'META-INF/sfmconfig.xml' the data extract name attribute- See Also:
- Constant Field Values
-
SFM_CONFIG_DATA_EXTRACT_VALUE
public static final String SFM_CONFIG_DATA_EXTRACT_VALUE
The Form Archive 'META-INF/sfmconfig.xml' the data extract value attribute- See Also:
- Constant Field Values
-
FAR_FORMSEED_PATH
public static final String FAR_FORMSEED_PATH
The Form Archive 'META-INF/formseed.xml' file path.- See Also:
- Constant Field Values
-
FAR_SFMCONFIG_PATH
public static final String FAR_SFMCONFIG_PATH
The Form Archive 'META-INF/sfmconfig.xml' file path.- See Also:
- Constant Field Values
-
-
Method Detail
-
createFormArchive
public static FormArchive createFormArchive(byte[] formArchiveData, String farFileName) throws FormArchiveValidationException, IOException
Create a FormArchive from the given ZIP byte array.- Parameters:
formArchiveData
- the FAR file byte arrayfarFileName
- the name of the FAR file (optional outside of the FAR file import context)- Returns:
- a FormArchive object
- Throws:
FormArchiveValidationException
- the form archive validation exceptionIOException
- if an I/O exception has occurred
-
createFormArchive
public static FormArchive createFormArchive(byte[] formArchiveData) throws FormArchiveValidationException, IOException
Create a FormArchive from the given ZIP byte array.- Parameters:
formArchiveData
- the FAR file byte array- Returns:
- a FormArchive object
- Throws:
FormArchiveValidationException
- the form archive validation exceptionIOException
- if an I/O exception has occurred
-
getFormArchivesFromPackage
public static Map<String,FormArchive> getFormArchivesFromPackage(byte[] packageData) throws FormArchiveValidationException, IOException
Get map of form archives (keyed on archive name) from Composer Package data (ZIP).- Parameters:
packageData
- the composer package data- Returns:
- map of form archives (keyed on archive name) from Composer Package data (ZIP)
- Throws:
FormArchiveValidationException
- the form archive validation exceptionIOException
- if an I/O exception has occurred
-
validateFormArchive
public static String validateFormArchive(byte[] formArchiveData)
Validate the given form archive byte array content and return null if valid, or the validation error otherwise.- Parameters:
formArchiveData
- the form archive to validate- Returns:
- the validation error, or null if valid
-
getFormArchiveByFarKey
public static FormArchive getFormArchiveByFarKey(Map<String,FormArchive> formArchives, String farFormKey)
Retrieve the form archive with the specified key- Parameters:
formArchives
- the map of form archivesfarFormKey
- the FAR form key to look for- Returns:
- the matching form archive, or null if none was found
-
getFormArchiveBytes
public static byte[] getFormArchiveBytes(byte[] packageData, String fileName) throws IOException
Return a form archive with a given file name- Parameters:
packageData
- the Composer package data containing the form archivefileName
- the name of FAR file to retrieve- Returns:
- a byte array representing the form archive
- Throws:
IOException
- if an error occurred traversing the Composer package
-
-