Class BagQueryHelper


  • public final class BagQueryHelper
    extends java.lang.Object
    Author:
    Richard Smith
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String DEFAULT_MESSAGE
      Message associated with default bag query.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static Query createDefaultBagQuery​(java.lang.String type, BagQueryConfig bagQueryConfig, Model model, java.util.Map<java.lang.String,​java.util.List<FieldDescriptor>> classKeys, java.util.Collection<java.lang.String> input)
      Create a BagQuery that constrains the class key fields of the given type.
      static BagQueryConfig readBagQueryConfig​(Model model, java.io.InputStream is)
      Read the bag query configuration from the given stream.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • DEFAULT_MESSAGE

        public static final java.lang.String DEFAULT_MESSAGE
        Message associated with default bag query.
        See Also:
        Constant Field Values
    • Method Detail

      • createDefaultBagQuery

        public static Query createDefaultBagQuery​(java.lang.String type,
                                                  BagQueryConfig bagQueryConfig,
                                                  Model model,
                                                  java.util.Map<java.lang.String,​java.util.List<FieldDescriptor>> classKeys,
                                                  java.util.Collection<java.lang.String> input)
                                           throws java.lang.ClassNotFoundException
        Create a BagQuery that constrains the class key fields of the given type.
        Parameters:
        type - the class to query for
        bagQueryConfig - The BagQueryConfig object used to get the extra class and field to constrain when making the query (eg. constrain Bioentiry.organism.name = "something")
        classKeys - the class keys map
        input - the input strings/identifiers
        model - the Model to pass to the BagQuery constructor
        Returns:
        a BagQuery that queries for objects of class given of type where any of the class key fields match any of the input identifiers
        Throws:
        java.lang.ClassNotFoundException - if the type isn't in the model
      • readBagQueryConfig

        public static BagQueryConfig readBagQueryConfig​(Model model,
                                                        java.io.InputStream is)
                                                 throws java.lang.Exception
        Read the bag query configuration from the given stream.
        Parameters:
        model - the Model to use to check the bag types
        is - the InputStream
        Returns:
        the BagQueryConfig object for this webapp
        Throws:
        java.lang.Exception - if there is a problem parsing the bag-queries.xml