Class AttachmentService

  • All Implemented Interfaces:
    de.willuhn.boot.Bootable

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

      Fields 
      Modifier and Type Field Description
      static java.lang.String QUEUE_ADDED
      Queue, die beim Hinzufügen eines Attachments benachrichtigt wird.
      static java.lang.String QUEUE_DELETED
      Queue, die beim Löschen eines Attachments benachrichtigt wird.
      static java.lang.String QUEUE_UPDATE
      Queue, die beim Aktualisieren eines Attachments benachrichtigt wird.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Attachment add​(java.io.File file, java.lang.String storageId)
      Fügt ein Attachment zum aktuellen Dialog hinzu.
      void delete​(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.
      Context getContext()
      Liefert den aktuellen Attachment-Context.
      StorageProvider getProvider​(Attachment a)
      Liefert den Attachment-Provider für das angegebene Attachment.
      StorageProvider getProvider​(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.
      void init​(de.willuhn.boot.BootLoader loader, de.willuhn.boot.Bootable caller)  
      void save​(Attachment a, java.io.File file)
      Speichert das Attachment in der angegebenen Datei.
      void shutdown()  
      Attachment update​(Attachment a, java.io.File file)
      Aktualisiert ein Attachment.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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
    • Constructor Detail

      • AttachmentService

        public AttachmentService()
    • Method Detail

      • depends

        public java.lang.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 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:
        shutdown in interface de.willuhn.boot.Bootable
        See Also:
        Bootable.shutdown()