Class ApiTemplate

  • All Implemented Interfaces:
    java.lang.Cloneable, Taggable, WebSearchable

    public class ApiTemplate
    extends TemplateQuery
    implements WebSearchable
    This class extends TemplateQuery to provide the features needed by the API - Lucene indexing and database serialisation.
    Author:
    Alex Kalderimis
    • Field Detail

      • savedTemplateQuery

        protected SavedTemplateQuery savedTemplateQuery
        SavedTemplateQuery object in the UserProfile database, so we can update summaries.
    • Constructor Detail

      • ApiTemplate

        public ApiTemplate​(java.lang.String name,
                           java.lang.String title,
                           java.lang.String comment,
                           PathQuery query)
        Parameters:
        name - name of template
        title - title of template
        comment - comment
        query - query
      • ApiTemplate

        public ApiTemplate​(TemplateQuery template)
        Construct a new API template that has all the same properties as the TemplateQuery passed into the constructor.
        Parameters:
        template - The prototypical template to be like.
    • Method Detail

      • setSavedTemplateQuery

        public void setSavedTemplateQuery​(SavedTemplateQuery savedTemplateQuery)
        Sets the saved template query object.
        Parameters:
        savedTemplateQuery - the database object
      • getSavedTemplateQuery

        public SavedTemplateQuery getSavedTemplateQuery()
        Gets the saved template query object.
        Returns:
        a SavedTemplateQuery object that represents this TemplateQuery in the userprofile database
      • equals

        public boolean equals​(java.lang.Object other)
        Overrides:
        equals in class TemplateQuery
      • addObserver

        public void addObserver​(WebSearchWatcher wsw)
        Description copied from interface: WebSearchable
        Add this observer to the list of interested parties. The observer should be notified of every change event this web searchable object has cause to issue.
        Specified by:
        addObserver in interface WebSearchable
        Parameters:
        wsw - The observer.
      • removeObserver

        public void removeObserver​(WebSearchWatcher wsw)
        Description copied from interface: WebSearchable
        Remove this observer from the list of interested parties. The observer should not be notified of any subsequent events this web searchable object has cause to generate.
        Specified by:
        removeObserver in interface WebSearchable
        Parameters:
        wsw - The observer.
      • getTagType

        public java.lang.String getTagType()
        Description copied from interface: Taggable
        Poly-Morphic Constant.
        Specified by:
        getTagType in interface Taggable
        Returns:
        The appropriate tag-type for this kind of object.
      • fireEvent

        public void fireEvent​(OriginatingEvent e)
        Description copied from interface: WebSearchable
        Notify all your observers of this event which originates at this web searchable.
        Specified by:
        fireEvent in interface WebSearchable
        Parameters:
        e - The event that has just occurred.
      • setTitle

        public void setTitle​(java.lang.String title)
        Description copied from class: PathQuery
        Sets the name of the query.
        Overrides:
        setTitle in class PathQuery
        Parameters:
        title - the new title, or null for none.
      • setName

        public void setName​(java.lang.String name)
        Description copied from class: TemplateQuery
        Sets the query short name.
        Overrides:
        setName in class TemplateQuery
        Parameters:
        name - the template name
      • setDescription

        public void setDescription​(java.lang.String description)
        Description copied from class: PathQuery
        Sets the description for this PathQuery.
        Overrides:
        setDescription in class PathQuery
        Parameters:
        description - the new description, or null for none
      • setAPI

        public void setAPI​(InterMineAPI im)
        Only used on export so we can get the tags related to this template.
        Parameters:
        im - InterMine API
      • setProfile

        public void setProfile​(Profile profile)
        Only used on export so we can get the tags related to this template.
        Parameters:
        profile - user who owns this template
      • getHeadAttributes

        protected java.util.Map<java.lang.String,​java.lang.Object> getHeadAttributes()
        Overrides:
        getHeadAttributes in class TemplateQuery
        Returns:
        the attributes that should go in the head of a JSON object.