Package no.nav.arxaas.utils
Class FormDataFactory
- java.lang.Object
-
- no.nav.arxaas.utils.FormDataFactory
-
@Component public class FormDataFactory extends Object
Public contract to be fulfilled by FormDataAnonymization and FormDataAnalysation classes
-
-
Constructor Summary
Constructors Constructor Description FormDataFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private List<Attribute>buildRequestAnalyzationAttribute(List<FormDataAttribute> attributeList)Builds a list ofAttributefrom the list ofFormDataAttributeto correctly build the attribute metadata.private List<Attribute>buildRequestAnonymizationAttribute(List<FormDataAttribute> attributeList, List<List<String[]>> hierarchies)Builds a list ofAttributefrom the list ofFormDataAttributeto correctly build the attribute metadata and parse the raw hierarchy files.RequestcreateAnalyzationPayload(org.springframework.web.multipart.MultipartFile file, FormMetaDataRequest payload)Returns anRequestobject created from the provided MultipartFile and String.RequestcreateAnonymizationPayload(org.springframework.web.multipart.MultipartFile file, FormMetaDataRequest payload, org.springframework.web.multipart.MultipartFile[] hierarchies)Returns anRequestobject created from the provided MultipartFile and String.private List<List<String[]>>handleHierarchiesInputStream(org.springframework.web.multipart.MultipartFile[] hierarchies)Takes an array ofMultipartFilecontaining the raw hierarchy files, and parses through the files and building a list out of them.private List<String[]>handleInputStream(org.springframework.web.multipart.MultipartFile file)Returns a list of String[] containing the dataset parsed from aMultipartFile.private voidvalidateParameters(org.springframework.web.multipart.MultipartFile file, FormMetaDataRequest payload)Validation method for checking against invalid parameters for data analyzation and anonymization
-
-
-
Method Detail
-
createAnalyzationPayload
public Request createAnalyzationPayload(org.springframework.web.multipart.MultipartFile file, FormMetaDataRequest payload) throws IOException
Returns anRequestobject created from the provided MultipartFile and String.- Parameters:
file- aMultipartFilecontaining the raw dataset file to be parsed.payload- a String containing the raw metadata to be parsed.- Returns:
- an ARX
Requestmodel containing the parsed dataset and metadata. - Throws:
IOException- when unable to read the InputStream of the files
-
createAnonymizationPayload
public Request createAnonymizationPayload(org.springframework.web.multipart.MultipartFile file, FormMetaDataRequest payload, org.springframework.web.multipart.MultipartFile[] hierarchies) throws IOException
Returns anRequestobject created from the provided MultipartFile and String.- Parameters:
file- aMultipartFilecontaining the raw dataset file to be parsed.payload- a String containing the raw metadata to be parsed.hierarchies- a array ofMultipartFilecontaining the raw hierarchy files to be parsed.- Returns:
- an ARX
Requestmodel containing the parsed dataset, metadata and hierarchies. - Throws:
IOException- when unable to read the InputStream of the files
-
validateParameters
private void validateParameters(org.springframework.web.multipart.MultipartFile file, FormMetaDataRequest payload)Validation method for checking against invalid parameters for data analyzation and anonymization- Parameters:
file- aMultipartFilecontaining the raw dataset file to be parsed.payload- a String containing the raw metadata to be parsed.
-
handleInputStream
private List<String[]> handleInputStream(org.springframework.web.multipart.MultipartFile file) throws IOException
Returns a list of String[] containing the dataset parsed from aMultipartFile.- Parameters:
file- aMultipartFilecontaining the raw dataset file to be parsed.- Returns:
- the parsed dataset in a list of String[].
- Throws:
IOException- when unable to read the InputStream of the files
-
buildRequestAnalyzationAttribute
private List<Attribute> buildRequestAnalyzationAttribute(List<FormDataAttribute> attributeList)
Builds a list ofAttributefrom the list ofFormDataAttributeto correctly build the attribute metadata.- Parameters:
attributeList- a list ofFormDataAttributeto be parsed in order to correctly build the attribute metadata.- Returns:
- list of
Attributefor analyzation.
-
buildRequestAnonymizationAttribute
private List<Attribute> buildRequestAnonymizationAttribute(List<FormDataAttribute> attributeList, List<List<String[]>> hierarchies)
Builds a list ofAttributefrom the list ofFormDataAttributeto correctly build the attribute metadata and parse the raw hierarchy files.- Parameters:
attributeList- a list ofFormDataAttributeto be parsed in order to correctly build the attribute metadata.hierarchies- a List containing the parsed hierarchy files. the hierarchy files are in a List of String array- Returns:
- list of
Attributefor anonymization.
-
handleHierarchiesInputStream
private List<List<String[]>> handleHierarchiesInputStream(org.springframework.web.multipart.MultipartFile[] hierarchies) throws IOException
Takes an array ofMultipartFilecontaining the raw hierarchy files, and parses through the files and building a list out of them.- Parameters:
hierarchies- an array ofMultipartFilecontaining the raw hierarchy files to be parsed.- Returns:
- a List of parsed hierarchy files in the format of List of String array
- Throws:
IOException- when unable to read the InputStream of the files
-
-