Package de.willuhn.jameica.services
Class AttachmentService
- java.lang.Object
-
- de.willuhn.jameica.services.AttachmentService
-
- All Implemented Interfaces:
de.willuhn.boot.Bootable
public class AttachmentService extends java.lang.Object implements de.willuhn.boot.BootableService zum Laden und Speichern von Attachments.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringQUEUE_ADDEDQueue, die beim Hinzufügen eines Attachments benachrichtigt wird.static java.lang.StringQUEUE_DELETEDQueue, die beim Löschen eines Attachments benachrichtigt wird.static java.lang.StringQUEUE_UPDATEQueue, die beim Aktualisieren eines Attachments benachrichtigt wird.
-
Constructor Summary
Constructors Constructor Description AttachmentService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Attachmentadd(java.io.File file, java.lang.String storageId)Fügt ein Attachment zum aktuellen Dialog hinzu.voiddelete(Attachment a)Löscht das Attachment.java.lang.Class<de.willuhn.boot.Bootable>[]depends()java.util.List<Attachment>find()Liefert die Attachments für die aktuelle View mit dem aktuellen Objekt.ContextgetContext()Liefert den aktuellen Attachment-Context.StorageProvidergetProvider(Attachment a)Liefert den Attachment-Provider für das angegebene Attachment.StorageProvidergetProvider(java.lang.String storageId)Liefert den Storage-Provider für die angegebene Storage-ID.java.util.List<StorageProvider>getProviders()Liefert die Liste der Storage-Provider.voidinit(de.willuhn.boot.BootLoader loader, de.willuhn.boot.Bootable caller)voidsave(Attachment a, java.io.File file)Speichert das Attachment in der angegebenen Datei.voidshutdown()Attachmentupdate(Attachment a, java.io.File file)Aktualisiert ein Attachment.
-
-
-
Field Detail
-
QUEUE_DELETED
public static final java.lang.String QUEUE_DELETED
Queue, die beim Löschen eines Attachments benachrichtigt wird.- See Also:
- Constant Field Values
-
QUEUE_ADDED
public static final java.lang.String QUEUE_ADDED
Queue, die beim Hinzufügen eines Attachments benachrichtigt wird.- See Also:
- Constant Field Values
-
QUEUE_UPDATE
public static final java.lang.String QUEUE_UPDATE
Queue, die beim Aktualisieren eines Attachments benachrichtigt wird.- See Also:
- Constant Field Values
-
-
Method Detail
-
depends
public java.lang.Class<de.willuhn.boot.Bootable>[] depends()
- Specified by:
dependsin interfacede.willuhn.boot.Bootable- See Also:
Bootable.depends()
-
init
public void init(de.willuhn.boot.BootLoader loader, de.willuhn.boot.Bootable caller) throws de.willuhn.boot.SkipServiceException- Specified by:
initin interfacede.willuhn.boot.Bootable- Throws:
de.willuhn.boot.SkipServiceException- See Also:
Bootable.init(de.willuhn.boot.BootLoader, de.willuhn.boot.Bootable)
-
getContext
public Context getContext() throws java.io.IOException
Liefert den aktuellen Attachment-Context.- Returns:
- der aktuelle Attachment-Context.
- Throws:
java.io.IOException
-
find
public java.util.List<Attachment> find() throws java.io.IOException
Liefert die Attachments für die aktuelle View mit dem aktuellen Objekt.- Returns:
- die Liste der Attachments.
- Throws:
java.io.IOException
-
delete
public void delete(Attachment a) throws java.io.IOException
Löscht das Attachment.- Parameters:
a- das zu löschende Attachment.- Throws:
java.io.IOException
-
add
public Attachment add(java.io.File file, java.lang.String storageId) throws java.io.IOException
Fügt ein Attachment zum aktuellen Dialog hinzu.- Parameters:
file- die Datei.storageId- die ID des Storage-Backends.- Returns:
- das erzeugte Attachment.
- Throws:
java.io.IOException
-
update
public Attachment update(Attachment a, java.io.File file) throws java.io.IOException
Aktualisiert ein Attachment.- Parameters:
a- das Attachment.file- die Datei.- Returns:
- das aktualisierte Attachment.
- Throws:
java.io.IOException
-
save
public void save(Attachment a, java.io.File file) throws java.io.IOException
Speichert das Attachment in der angegebenen Datei.- Parameters:
a- das Attachment.file- die Zieldatei.- Throws:
java.io.IOException
-
getProvider
public StorageProvider getProvider(Attachment a) throws java.io.IOException
Liefert den Attachment-Provider für das angegebene Attachment.- Parameters:
a- das Attachment.- Returns:
- der Provider, von dem das Attachment stammt.
- Throws:
java.io.IOException
-
getProvider
public StorageProvider getProvider(java.lang.String storageId)
Liefert den Storage-Provider für die angegebene Storage-ID.- Parameters:
storageId- die Storage-ID.- Returns:
- der Provider oder NULL, wenn er niht existiert.
-
getProviders
public java.util.List<StorageProvider> getProviders()
Liefert die Liste der Storage-Provider.- Returns:
- die Liste der Storage-Provider.
-
shutdown
public void shutdown()
- Specified by:
shutdownin interfacede.willuhn.boot.Bootable- See Also:
Bootable.shutdown()
-
-