Class AttachmentService

java.lang.Object
de.willuhn.jameica.services.AttachmentService
All Implemented Interfaces:
de.willuhn.boot.Bootable

public class AttachmentService extends Object implements de.willuhn.boot.Bootable
Service zum Laden und Speichern von Attachments.
  • Field Details

    • QUEUE_DELETED

      public static final String QUEUE_DELETED
      Queue, die beim Löschen eines Attachments benachrichtigt wird.
      See Also:
    • QUEUE_ADDED

      public static final String QUEUE_ADDED
      Queue, die beim Hinzufügen eines Attachments benachrichtigt wird.
      See Also:
    • QUEUE_UPDATE

      public static final String QUEUE_UPDATE
      Queue, die beim Aktualisieren eines Attachments benachrichtigt wird.
      See Also:
  • Constructor Details

    • AttachmentService

      public AttachmentService()
  • Method Details

    • depends

      public Class<de.willuhn.boot.Bootable>[] depends()
      Specified by:
      depends in interface de.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:
      init in interface de.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 IOException
      Liefert den aktuellen Attachment-Context.
      Returns:
      der aktuelle Attachment-Context.
      Throws:
      IOException
    • find

      public List<Attachment> find() throws IOException
      Liefert die Attachments für die aktuelle View mit dem aktuellen Objekt.
      Returns:
      die Liste der Attachments.
      Throws:
      IOException
    • delete

      public void delete(Attachment a) throws IOException
      Löscht das Attachment.
      Parameters:
      a - das zu löschende Attachment.
      Throws:
      IOException
    • add

      public Attachment add(File file, String storageId) throws IOException
      Fügt ein Attachment zum aktuellen Dialog hinzu.
      Parameters:
      file - die Datei.
      storageId - die ID des Storage-Backends.
      Returns:
      das erzeugte Attachment.
      Throws:
      IOException
    • update

      public Attachment update(Attachment a, File file) throws IOException
      Aktualisiert ein Attachment.
      Parameters:
      a - das Attachment.
      file - die Datei.
      Returns:
      das aktualisierte Attachment.
      Throws:
      IOException
    • save

      public void save(Attachment a, File file) throws IOException
      Speichert das Attachment in der angegebenen Datei.
      Parameters:
      a - das Attachment.
      file - die Zieldatei.
      Throws:
      IOException
    • getProvider

      public StorageProvider getProvider(Attachment a) throws IOException
      Liefert den Attachment-Provider für das angegebene Attachment.
      Parameters:
      a - das Attachment.
      Returns:
      der Provider, von dem das Attachment stammt.
      Throws:
      IOException
    • getProvider

      public StorageProvider getProvider(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 List<StorageProvider> getProviders()
      Liefert die Liste der Storage-Provider.
      Returns:
      die Liste der Storage-Provider.
    • shutdown

      public void shutdown()
      Specified by:
      shutdown in interface de.willuhn.boot.Bootable
      See Also:
      • Bootable.shutdown()