Class ActionManagerFactory
java.lang.Object
org.apache.pdfbox.preflight.action.ActionManagerFactory
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate void
callCreateAction
(COSBase aDict, PreflightContext ctx, List<AbstractActionManager> result, String additionActionKey, Map<COSObjectKey, Boolean> alreadyCreated) Call the create action to add the ActionManager to the result list.private void
callCreateAction
(COSBase aDict, PreflightContext ctx, List<AbstractActionManager> result, Map<COSObjectKey, Boolean> alreadyCreated) Call the callCreateAction(COSBase, COSDocument, List, String) method with null as isAA parameter. protected AbstractActionManager
createActionManager
(PreflightContext ctx, COSDictionary action, String aaKey) Create an instance of ActionManager according to the value of the S entry.final List<AbstractActionManager>
getActionManagers
(PreflightContext ctx, COSDictionary dictionary) This method extract actions from the given dictionary.final List<AbstractActionManager>
getNextActions
(PreflightContext ctx, COSDictionary actionDictionary) Returns all actions contained by the Next entry.
-
Constructor Details
-
ActionManagerFactory
public ActionManagerFactory()
-
-
Method Details
-
getActionManagers
public final List<AbstractActionManager> getActionManagers(PreflightContext ctx, COSDictionary dictionary) throws ValidationException This method extract actions from the given dictionary. An action is identified by the following entries :- A (Action) : Available in Annotations, Outline items
- OpenAction (OpenAction) : Available in the Catalog dictionary
- AA (Additional Action) : Available in the Catalog dictionary, Annotations, Pages
- Parameters:
ctx
- the preflight context.dictionary
- the dictionary to retrieve the actions from.- Returns:
- the list of actions from the given dictionary.
- Throws:
ValidationException
-
callCreateAction
private void callCreateAction(COSBase aDict, PreflightContext ctx, List<AbstractActionManager> result, Map<COSObjectKey, Boolean> alreadyCreated) throws ValidationExceptionCall the callCreateAction(COSBase, COSDocument, List, String) method with null as isAA parameter. - Parameters:
aDict
- a COSBase object (COSObject or COSDictionary) which represent the action dictionary.ctx
- the preflight context.result
- the list of ActionManager to updated if the aDict parameter is valid.alreadyCreated
- This map is used to know if an Action has already been validated. It is useful to avoid infinite loop in an action which has a Next entry.- Throws:
ValidationException
-
callCreateAction
private void callCreateAction(COSBase aDict, PreflightContext ctx, List<AbstractActionManager> result, String additionActionKey, Map<COSObjectKey, Boolean> alreadyCreated) throws ValidationExceptionCall the create action to add the ActionManager to the result list. If the aDict parameter isn't an instance of COSDictionary, this method throws a ValidationException. If the aDict parameter is a reference to a COSDictionary, the action manager is create only if the linked COSObjectKey is missing from the "alreadyCreated" map, in this case the action is added to the map. If the aDict parameter is an instance of COSDictionary, it is impossible to check if the ActionManager already exists in the "alreadyCreated" map.- Parameters:
aDict
- a COSBase object (COSObject or COSDictionary) which represent the action dictionary.ctx
- the preflight validation context.result
- the list of ActionManager to updated if the aDict parameter is valid.additionActionKey
- the Action identifier if it is an additional actionalreadyCreated
- This map is used to know if an Action has already been validated. It is useful to avoid infinite loop in an action which has a Next entry.- Throws:
ValidationException
-
getNextActions
public final List<AbstractActionManager> getNextActions(PreflightContext ctx, COSDictionary actionDictionary) throws ValidationException Returns all actions contained by the Next entry. If the action dictionary doesn't have Next action, the result is an empty list.- Parameters:
ctx
- the preflight context.actionDictionary
- the dictionary to retrieve the actions from.- Returns:
- the list of actions from the given dictionary.
- Throws:
ValidationException
-
createActionManager
protected AbstractActionManager createActionManager(PreflightContext ctx, COSDictionary action, String aaKey) throws ValidationException Create an instance of ActionManager according to the value of the S entry. If the type entry isn't Action, a ValidationException will be thrown. If the action type isn't authorized in a PDF/A file, an instance of InvalidAction is returned.- Parameters:
ctx
- the preflight context.action
- the action dictionary used to instantiate the ActionManageraaKey
- the Action identifier if it is an additional action- Returns:
- the ActionManager instance.
- Throws:
ValidationException
-