public class

XfdfUtils

extends Object
java.lang.Object
   ↳ com.pdftron.collab.utils.XfdfUtils

Class Overview

Utility class for XFDF

Summary

Constants
String OP_ADD
String OP_MODIFY
String OP_REMOVE
String XFDF_ADD
String XFDF_DELETE
String XFDF_END
String XFDF_MODIFY
String XFDF_START
Public Constructors
XfdfUtils()
Public Methods
static ArrayList<AnnotationEntity> convToAnnotations(String xfdfJSON, String xfdfCommand, String documentId, String userName)
Converts JSON with annotation properties to list of AnnotationEntity
static ArrayList<AnnotationEntity> convToAnnotations(String xfdfJSON, String xfdfCommand, String documentId, String userName, AnnotationDao annotationDao)
Converts JSON with annotation properties to list of AnnotationEntity This version will fetch from existing annotation entity
static Date deserializeDate(String dateStr)
Converts date string to java.util.Date
static void fillAnnotationEntity(String documentId, AnnotationEntity input)
Parse required fields for AnnotationEntity from its XFDF information
static boolean isValidInsertEntity(AnnotationEntity entity)
static Pair<String, HashMap<String, AnnotationEntity>> parseAndProcessXfdf(String documentId, String xfdf)
Parses XFDF string into map of properties, also return processed XFDF string
static Pair<String, HashMap<String, AnnotationEntity>> parseAndProcessXfdfCommand(String documentId, String xfdfCommand)
static AnnotationEntity parseAnnotationEntity(String documentId, JSONObject annotation)
Parse XFDF information from JSON into AnnotationEntity
static ReplyEntity parseReplyEntity(AnnotationEntity annotation)
Parse reply information from AnnotationEntity
static HashMap<String, AnnotationEntity> parseXfdf(String documentId, String xfdf)
Parses XFDF string into map of properties
static String prepareAnnotation(String action, ArrayList<AnnotationEntity> annotationEntities, String documentId, String userName)
static AnnotationEntity toAnnotationEntity(PDFDoc pdfDoc, String documentId, Annot annot)
static String validateXfdf(String xfdf, String action)
static String validateXfdf(String xfdf)
Utility method to return a valid XFDF command string
static String wrapDeleteXfdf(String id)
Gets delete XFDF command
static AnnotationEntity xfdfToAnnotationEntity(String documentId, JSONObject annotation)
Creates AnnotationEntity from JSON that contains required information
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final String OP_ADD

Constant Value: "add"

public static final String OP_MODIFY

Constant Value: "modify"

public static final String OP_REMOVE

Constant Value: "remove"

public static final String XFDF_ADD

Constant Value: "add"

public static final String XFDF_DELETE

Constant Value: "delete"

public static final String XFDF_END

Constant Value: ""

public static final String XFDF_MODIFY

Constant Value: "modify"

public static final String XFDF_START

Constant Value: " "

Public Constructors

public XfdfUtils ()

Public Methods

public static ArrayList<AnnotationEntity> convToAnnotations (String xfdfJSON, String xfdfCommand, String documentId, String userName)

Converts JSON with annotation properties to list of AnnotationEntity

Throws
JSONException

public static ArrayList<AnnotationEntity> convToAnnotations (String xfdfJSON, String xfdfCommand, String documentId, String userName, AnnotationDao annotationDao)

Converts JSON with annotation properties to list of AnnotationEntity This version will fetch from existing annotation entity

Throws
JSONException

public static Date deserializeDate (String dateStr)

Converts date string to java.util.Date

public static void fillAnnotationEntity (String documentId, AnnotationEntity input)

Parse required fields for AnnotationEntity from its XFDF information

public static boolean isValidInsertEntity (AnnotationEntity entity)

public static Pair<String, HashMap<String, AnnotationEntity>> parseAndProcessXfdf (String documentId, String xfdf)

Parses XFDF string into map of properties, also return processed XFDF string

public static Pair<String, HashMap<String, AnnotationEntity>> parseAndProcessXfdfCommand (String documentId, String xfdfCommand)

public static AnnotationEntity parseAnnotationEntity (String documentId, JSONObject annotation)

Parse XFDF information from JSON into AnnotationEntity

public static ReplyEntity parseReplyEntity (AnnotationEntity annotation)

Parse reply information from AnnotationEntity

public static HashMap<String, AnnotationEntity> parseXfdf (String documentId, String xfdf)

Parses XFDF string into map of properties

public static String prepareAnnotation (String action, ArrayList<AnnotationEntity> annotationEntities, String documentId, String userName)

Throws
JSONException

public static AnnotationEntity toAnnotationEntity (PDFDoc pdfDoc, String documentId, Annot annot)

Parameters
pdfDoc the PDF document
annot the annotation
Returns
  • the annotation entity

public static String validateXfdf (String xfdf, String action)

public static String validateXfdf (String xfdf)

Utility method to return a valid XFDF command string

public static String wrapDeleteXfdf (String id)

Gets delete XFDF command

public static AnnotationEntity xfdfToAnnotationEntity (String documentId, JSONObject annotation)

Creates AnnotationEntity from JSON that contains required information