If you have a corporate sensitive data removal policy as a list of redaction rules, you don’t need to specify them in your code. You can specify an XML document with a list of pre-configured redactions.
Below is an example of redaction policy XML file (code properties mapping is obvious):
You can have as much policies, as you need, loading them to redact your documents.
An example below shows how to apply redaction policy to all files within given inbound folder, and save to one of outbound folders - for successfully updated files and for failed ones. Current date and time is used as a part of output file name:
RedactionPolicypolicy=RedactionPolicy.load("Policy_file.xml");for(finalFilefileEntry:newFile("\Inbound\").listFiles())
{
final Redactor redactor = new Redactor(fileEntry.getPath());
try
{
//Apply redaction
RedactorChangeLog result = redactor.apply(policy);
// Set the output directory path, it is supposed that all folders exist
File resultFolder = new File(result.getStatus() != RedactionStatus.Failed ? "Done" : "Failed");// Save the ouput files after applying redactions
finalFileOutputStreamfileStream=newFileOutputStream(resultFolder.getPath()+fileEntry.getName());try{RasterizationOptionsoptions=newRasterizationOptions();options.setEnabled(false);redactor.save(fileStream,options);}finally{fileStream.close();}}finally{redactor.close();}}
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.