Class FolderView

    • Constructor Detail

      • FolderView

        public FolderView​(java.util.List<DocumentField> propertyFields,
                          DocumentField defaultSortingField)
        Constuct a new FolderView
        Parameters:
        propertyFields - Any properties field definitions that may be attached to documents in this folder. Must not be null, but may be empty.
        defaultSortingField - One of the fields in searchResultProperties or null if there is no default field on which to sort.
    • Method Detail

      • addDocumentProperties

        public void addDocumentProperties​(URN documentUrn,
                                          java.util.Map<java.lang.String,​java.lang.Object> searchResultProperties)
        Add a set of properties associated with a document. This method is always called by the database service when a document is added to the folder.
        Parameters:
        documentUrn - the URN of the document to associate properties with
        searchResultProperties - the properties to associate with that document which must not be null, but may be empty. Any existing properties for the document will be replaced.
        See Also:
        WritableDatabaseService.createFolderViewFolder(String, com.biomatters.geneious.publicapi.documents.AnnotatedPluginDocument)
      • addDocumentProperties

        public void addDocumentProperties​(java.util.Map<URN,​java.util.Map<java.lang.String,​java.lang.Object>> searchResultProperties)
        Update search properties for several documents at once. This method is equivalent to addDocumentProperties(com.biomatters.geneious.publicapi.documents.URN, java.util.Map) except that it only updates the folder view after all properties have been set instead of after each one, meaning it is faster when adding properties for many documents at once.
        Parameters:
        searchResultProperties - a map of properties for several document urns, must not be null. Any existing properties for the documents will be replaced.
      • addChangeListener

        public void addChangeListener​(org.virion.jam.util.SimpleListener changeListener)
        Add a listener which is notified whenever the contents of the folder view folder is changed.
        Parameters:
        changeListener - Listener to be notified of changes
      • removeDocumentProperties

        public void removeDocumentProperties​(URN documentUrn)
        Removes any properties associated with this document.
        Parameters:
        documentUrn - the URN of the document to associate properties with
      • getPropertiesForDocument

        public java.util.Map<java.lang.String,​java.lang.Object> getPropertiesForDocument​(URN documentUrn)
        Get the stored properties for a document
        Parameters:
        documentUrn - the URN of the document to get properties for.
        Returns:
        the document properties (which may be empty), or null if no properties are stored for that document.
      • getPropertyFields

        public java.util.List<DocumentField> getPropertyFields()
        Get the field definitions for any properties that may appear on documents.
        Returns:
        the field definitions for any properties that may appear on documents.
      • getDefaultSortingField

        public DocumentField getDefaultSortingField()
        Get the default field on which to sort documents.
        Returns:
        the default field on which to sort documents or null if there is no default field on which to sort the documents.
      • toXML

        public org.jdom.Element toXML()
        Description copied from interface: XMLSerializable
        Convert object to a JDOM element. The representation should be complete so that XMLSerializable.fromXML(org.jdom.Element) can completely restore the object's representation.

        It is recommended that the returned element use XMLSerializable.ROOT_ELEMENT_NAME as its name, in which case it must not define an attribute called "type". In this case, fromXML, will be called with an element whose name may differ from the element return from this function. This recommendation allows a more compact representation of the XML can be stored.

        This method generally should not be called directly. Instead, you should usually call XMLSerializer.classToXML(String, XMLSerializable) which calls this method internally.

        PluginDocument implementations of this method may choose to throw an XMLSerializationException, enclosed in a RuntimeException.

        Specified by:
        toXML in interface XMLSerializable
        Returns:
        object encoded as a JDOM element
      • toXML

        public org.jdom.Element toXML​(Geneious.MajorVersion majorVersion,
                                      jebl.util.ProgressListener progressListener)
        Description copied from interface: XMLSerializable.OldVersionCompatible
        Serializes this class to XML format, potentially to a format readable by an earlier version of Geneious. It is acceptable for the XML to include unnecessary tags that will be ignored by the earlier version. For example if the implementation has only extended the XML since the earlier version, then the XML returned may be identical to the XML returned for the current version.

        See XMLSerializable.toXML() for a more detailed description of what it means to serialize to XML.

        All classes that implement this method must also implement XMLSerializable.toXML() and should delegate back to this method using Geneious.getMajorVersion() and ProgressListener.EMPTY as parameters.

        Specified by:
        toXML in interface XMLSerializable.OldVersionCompatible
        Parameters:
        majorVersion - the major version of Geneious to serialize to XML for. For example "6.0" but not "6.0.0". This must be a version returned greater or equal to a version returned from getVersionSupport(VersionSupportType.OldestVersionSerializableTo) and must never be greater than the current version (Geneious.getMajorVersion())
        progressListener - for reporting progress and cancelling
        Returns:
        object encoded as a JDOM element
      • fromXML

        public void fromXML​(org.jdom.Element element)
                     throws XMLSerializationException
        Description copied from interface: XMLSerializable
        Restore the object from the JDOM Element returned by XMLSerializable.toXML().

        This method generally should not be called directly. Instead, you should usually call XMLSerializer.classFromXML(org.jdom.Element) or XMLSerializer.classFromXML(org.jdom.Element, Class) which calls this method internally.

        It is optional to implement this method. Instead of implementing an empty constructor and implementing this method properly, the implementation may instead throw an UnsupportedOperationException and implement a constructor that takes a single Element as a parameter. This allows for cleaner code such as support for final fields in the XMLSerializable class.

        The element parameter should not be modified since it may be reused. If you need a modified version of it, take a copy with Element.clone().

        Specified by:
        fromXML in interface XMLSerializable
        Parameters:
        element - representation from a previous call to XMLSerializable.toXML()
        Throws:
        XMLSerializationException - if the Element can't be converted into this type of object