Class TemplateParameter


  • public class TemplateParameter
    extends java.lang.Object

    A simple class representing the group of parameters that define a template constraint

    A template parameter is a predefined constraint where you can specify the constraint operation and the constrained value. For example it can be constraint for gene length and you can specify if the gene length should be less, equal or greater then your specified value. The user needs to supply the path identifier to identify the constraint, and the code when there are multiple constraints on the same path. The user is free to supply compatible values for the operation and value.

    Some constraint operators (such as LOOKUP) allow an extra value. See the documentation for the template or any InterMine web page that generates template URLs for examples.

    Usage:

     TemplateService service = getTemplateService();
     String templateName = "some-template-name";
     List params = Arrays.asList(
          new TemplateParameter("Employee.age", "gt", "10", "B"),
          new TemplateParameter("Employee.age", "lt", "60", "C"));
     List> results = service.getAllResults(templateName, params);
     
    • Constructor Summary

      Constructors 
      Constructor Description
      TemplateParameter​(java.lang.String path, java.lang.String op, java.lang.String value, java.lang.String code)
      Create a new TemplateParameter for a unary constraint (such as IS NULL).
      TemplateParameter​(java.lang.String path, java.lang.String op, java.lang.String value, java.lang.String extra, java.lang.String code)
      Create a new TemplateParameter for a simple value constraint.
      TemplateParameter​(java.lang.String path, java.lang.String op, java.util.Collection<java.lang.String> values, java.lang.String code)
      Create a new TemplateParameter for a multi-value constraint.
    • Constructor Detail

      • TemplateParameter

        public TemplateParameter​(java.lang.String path,
                                 java.lang.String op,
                                 java.lang.String value,
                                 java.lang.String extra,
                                 java.lang.String code)
        Create a new TemplateParameter for a simple value constraint.
        Parameters:
        path - The path-string for this constraint.
        op - The operation you wish to use.
        value - The value the constraint should be run against.
        extra - Any extra constraining value this operation might need.
        code - The identifying code for this constraint. Needed when two constraints constrain the same path.
      • TemplateParameter

        public TemplateParameter​(java.lang.String path,
                                 java.lang.String op,
                                 java.util.Collection<java.lang.String> values,
                                 java.lang.String code)
        Create a new TemplateParameter for a multi-value constraint.
        Parameters:
        path - The path-string for this constraint.
        op - The operation you wish to use.
        values - The values the constraint should be run against. Must not be null, or empty.
        code - The identifying code for this constraint. Needed when two constraints constrain the same path.
      • TemplateParameter

        public TemplateParameter​(java.lang.String path,
                                 java.lang.String op,
                                 java.lang.String value,
                                 java.lang.String code)
        Create a new TemplateParameter for a unary constraint (such as IS NULL).
        Parameters:
        path - The path-string for this constraint.
        op - The operation you wish to use.
        value - The value the constraint should be run against.
        code - The identifying code for this constraint. Needed when two constraints constrain the same path.
    • Method Detail

      • getCode

        public java.lang.String getCode()
        Returns:
        the provided code
      • getPathId

        public java.lang.String getPathId()
        Returns:
        the path-string associated with this constraint.
      • getExtraValue

        public java.lang.String getExtraValue()
        Returns:
        extra value
      • getValues

        public java.util.Collection<java.lang.String> getValues()
        Returns:
        The collection of multi-values
      • isMultiValue

        public boolean isMultiValue()
        Returns:
        whether this constraint is a multi-value constraint
      • getOperation

        public java.lang.String getOperation()
        Returns:
        operation
      • getValue

        public java.lang.String getValue()
        Returns value.
        Returns:
        value