Class AttachmentsHelper
java.lang.Object
org.tailormap.api.geotools.featuresources.AttachmentsHelper
Helper class for managing the
<FT>_attachments sidecar tables in JDBC DataStores.-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcreateAttachmentTableForFeatureType(TMFeatureType featureType) Create attachment table and index for the given FeatureType.static voiddeleteAttachment(UUID attachmentId, TMFeatureType featureType) getAttachment(TMFeatureType featureType, UUID attachmentId) static AttachmentMetadatainsertAttachment(TMFeatureType featureType, AttachmentMetadata attachment, String featureId, byte[] fileData) static List<AttachmentMetadata> listAttachmentsForFeature(TMFeatureType featureType, String featureId)
-
Method Details
-
createAttachmentTableForFeatureType
public static void createAttachmentTableForFeatureType(TMFeatureType featureType) throws IOException, SQLException, IllegalArgumentException Create attachment table and index for the given FeatureType. This will validate that any AttachmentAttribute has a valid name.- Parameters:
featureType- the FeatureType to create the attachment table for- Throws:
IOException- when creating the GeoTools datastore failsSQLException- when executing the SQL statements failsIllegalArgumentException- when the FeatureType is invalid
-
insertAttachment
public static AttachmentMetadata insertAttachment(TMFeatureType featureType, AttachmentMetadata attachment, String featureId, byte[] fileData) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
deleteAttachment
public static void deleteAttachment(UUID attachmentId, TMFeatureType featureType) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
listAttachmentsForFeature
public static List<AttachmentMetadata> listAttachmentsForFeature(TMFeatureType featureType, String featureId) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
getAttachment
public static AttachmentsHelper.AttachmentWithBinary getAttachment(TMFeatureType featureType, UUID attachmentId) throws IOException, SQLException - Throws:
IOExceptionSQLException
-