public final class ResourceElementTypeHelper extends Object
Modifier and Type | Field and Description |
---|---|
static String |
DATA_IDENTIFIER
Identifier of the data containing the resource's data
|
static String |
ENCODING_IDENTIFIER
Encoding metadata identifier
|
static String |
FILENAME_IDENTIFIER
file name metadata identifier
|
static String |
HASH_IDENTIFIER
hash metadata identifier
|
static String |
LAST_MODIFICATION_DATE_IDENTIFIER
Last modification date metadata identifier
|
static String |
METADATA_PREFIX
Prefix to use for resource's metadata
|
static String |
MIME_TYPE_IDENTIFIER
Mime type metadata identifier
|
Modifier | Constructor and Description |
---|---|
private |
ResourceElementTypeHelper() |
Modifier and Type | Method and Description |
---|---|
private static Calendar |
_getCalendarFromZonedDateTime(ZonedDateTime zonedDateTime) |
private static ZonedDateTime |
_getZonedDateTimeFromCalendar(Calendar calendar) |
static ZonedDateTime |
getDateValue(RepositoryData repositoryData,
String name,
String prefix)
Retrieves the date value from the given repository data
|
static <T extends RepositoryData> |
getRepositoryData(T parentData,
String dataTypeName,
String name,
String prefix)
Retrieves the child repository data from the given repository data
|
static String |
getStringValue(RepositoryData repositoryData,
String name,
String prefix)
Retrieves the string value from the given repository data
|
static String[] |
getStringValues(RepositoryData repositoryData,
String name,
String prefix)
Retrieves the string values from the given repository data
|
static Binary |
readBinaryData(RepositoryData binaryData)
Read the binary from the given repository data
|
static void |
readResourceData(RepositoryData resourceData,
Resource resource)
Read the resource from the given repository data
|
static Object |
singleFileToJSON(File file,
String fileType)
Convert the single file into a JSON object
|
static void |
singleFileToSAX(ContentHandler contentHandler,
String tagName,
File file,
String fileType)
Generates SAX events for the given single file
|
static void |
writeResourceData(ModifiableRepositoryData resourceData,
Resource value)
Write the resource in the given repository data
|
static void |
writeSingleBinaryValue(ModifiableRepositoryData parentData,
String name,
Binary value)
Write the resource in the given repository data
|
public static final String METADATA_PREFIX
public static final String MIME_TYPE_IDENTIFIER
public static final String ENCODING_IDENTIFIER
public static final String LAST_MODIFICATION_DATE_IDENTIFIER
public static final String DATA_IDENTIFIER
public static final String HASH_IDENTIFIER
public static final String FILENAME_IDENTIFIER
private ResourceElementTypeHelper()
public static void singleFileToSAX(ContentHandler contentHandler, String tagName, File file, String fileType) throws SAXException
contentHandler
- the ContentHandler
that will receive the SAX eventstagName
- the tag name of the SAX event to generate.file
- the single file to SAXfileType
- the type of the fileSAXException
- if an error occurs during the SAX events generationpublic static Object singleFileToJSON(File file, String fileType)
file
- the file to convertfileType
- the type of the filepublic static Binary readBinaryData(RepositoryData binaryData)
binaryData
- the repository data containing the binary's datapublic static void readResourceData(RepositoryData resourceData, Resource resource)
resourceData
- the repository data containing the resource's dataresource
- the resource to readpublic static void writeSingleBinaryValue(ModifiableRepositoryData parentData, String name, Binary value)
parentData
- the repository data where to write the binaryname
- the name of the element to writevalue
- the binary to writepublic static void writeResourceData(ModifiableRepositoryData resourceData, Resource value)
resourceData
- the repository data where to write the resource's datavalue
- the resource to writepublic static String getStringValue(RepositoryData repositoryData, String name, String prefix)
repositoryData
- the repository data containing the data to retrievename
- the name of the data to retrieveprefix
- the prefix of the data to retrievepublic static String[] getStringValues(RepositoryData repositoryData, String name, String prefix)
repositoryData
- the repository data containing the data to retrievename
- the name of the data to retrieveprefix
- the prefix of the data to retrievepublic static <T extends RepositoryData> T getRepositoryData(T parentData, String dataTypeName, String name, String prefix)
T
- Type of the repository data (modifiable or not)parentData
- the repository data containing the data to retrievedataTypeName
- the type of the data to retrievename
- the name of the data to retrieveprefix
- the prefix of the data to retrievepublic static ZonedDateTime getDateValue(RepositoryData repositoryData, String name, String prefix)
repositoryData
- the repository data containing data to retrieveprefix
- the prefix of the data to retrievename
- the name of the data to retrieveprivate static ZonedDateTime _getZonedDateTimeFromCalendar(Calendar calendar)
private static Calendar _getCalendarFromZonedDateTime(ZonedDateTime zonedDateTime)