Class SearchTemplate

  • All Implemented Interfaces:
    Serializable, Cloneable

    public class SearchTemplate
    extends Template
    Represents templates for searching functionality. SearchTemplate serves the purpose of defining guidelines in a search. It defines the search filter and attributes to be returned in a search query. Reusability and flexibility are serving goals in SearchTemplate.

    See Also:
    Template, CreationTemplate, Serialized Form
    • Constructor Detail

      • SearchTemplate

        public SearchTemplate()
        Default constructor for deserialization
      • SearchTemplate

        public SearchTemplate​(String name,
                              AttrSet attrSet,
                              String filter)
        Creates a template with an attribute set and a search filter. The Attribute set contains attributes to be returned on a search. If the search filter is null, then "objectclass=*" is assumed (return all objects).
        Parameters:
        name - Template name
        attrSet - set of attributes
        filter - search filter
      • SearchTemplate

        public SearchTemplate​(String name,
                              String[] attributeNames,
                              String filter)
        Creates a template with an array of attributes and a search filter. The array of attributes contains attributes to be returned on a search. If the search filter is null, then "objectclass=*" is assumed (return all objects).
        Parameters:
        name - Template name
        attributeNames - an array of attribute names
        filter - search filter
    • Method Detail

      • setSearchFilter

        public void setSearchFilter​(String filter)
        Sets the filter expression used to search for objects of this type, for example, "objectclass=inetorgperson" or "(&(objectclass=inetorgperson)(ou=accounting))"
        Parameters:
        filter - A UMS search expression (LDAP syntax)
      • getSearchFilter

        public String getSearchFilter()
        Gets the filter expression used to search for objects of this type.
        Returns:
        a UMS search expression (LDAP syntax)
      • setAttributeNames

        public void setAttributeNames​(String[] attributeNames)
        Sets the attributes to be returned on a search.
        Parameters:
        attributeNames - The attribute names to be returned
      • addAttributeName

        public void addAttributeName​(String attributeName)
        Adds the attribute name to the list of attributes to be returned on a search.
        Parameters:
        attributeName - The attribute name to be added
      • addAttributeNames

        public void addAttributeNames​(String[] attributeNames)
        Adds the attribute names to the list of attributes to be returned on a search.
        Parameters:
        attributeNames - The attribute names to be added
      • removeAttributeName

        public void removeAttributeName​(String attributeName)
        Removes the attribute name from the list of attributes to be returned on a search.
        Parameters:
        attributeName - The attribute name to be removed
      • removeAttributeNames

        public void removeAttributeNames​(String[] attributeNames)
        Removes the attribute names from the list of attributes to be returned on a search.
        Parameters:
        attributeNames - The attribute names to be removed
      • getAttributeNames

        public String[] getAttributeNames()
        Gets a list of attribute names defined in the object.
        Returns:
        Names of all attributes defined
      • clone

        public Object clone()
        Returns a copy of the template.
        Overrides:
        clone in class Template
        Returns:
        A copy of the Template
      • toString

        public String toString()
        Render the object.
        Overrides:
        toString in class Object
        Returns:
        The object in printable form