Class GroovyRedirectRules

java.lang.Object
groovy.lang.GroovyObjectSupport
de.uplanet.lucy.server.urlredirect.scripting.groovy.GroovyRedirectRules
All Implemented Interfaces:
groovy.lang.GroovyObject, Iterable<de.uplanet.lucy.server.urlredirect.scripting.groovy.GroovyRedirectRule>

@Scriptable public final class GroovyRedirectRules extends groovy.lang.GroovyObjectSupport implements Iterable<de.uplanet.lucy.server.urlredirect.scripting.groovy.GroovyRedirectRule>
Since:
Intrexx 10.0.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(int p_iIndex, de.uplanet.lucy.server.urlredirect.scripting.groovy.GroovyRedirectRule p_rule)
    Inserts the given redirect rule at the specified position in this list.
    boolean
    add(de.uplanet.lucy.server.urlredirect.scripting.groovy.GroovyRedirectRule p_rule)
    Append the given rule to the end of the list.
    void
    Delete all redirect rules.
    boolean
    contains(de.uplanet.lucy.server.urlredirect.scripting.groovy.GroovyRedirectRule p_rule)
    Check if the rules contain the given one.
    Create a new and empty redirect rules object.
    de.uplanet.lucy.server.urlredirect.scripting.groovy.GroovyRedirectRule
    createNewRule(String p_strFromUrl, String p_strToUrl)
     
    de.uplanet.lucy.server.urlredirect.scripting.groovy.GroovyRedirectRule
    createNewRule(Map<String,String> p_namedParams)
     
    de.uplanet.lucy.server.urlredirect.scripting.groovy.GroovyRedirectRule
    get(int p_iIndex)
    Get the redirect rule at the specified index in this list.
    de.uplanet.lucy.server.urlredirect.scripting.groovy.GroovyRedirectRule
    getAt(int p_iIndex)
    Get the redirect rule at the specified index in this list.
    int
    indexOf(de.uplanet.lucy.server.urlredirect.scripting.groovy.GroovyRedirectRule p_rule)
    Get the index of the given rule in this list.
    boolean
    Check if there are any rules defined.
    Iterator<de.uplanet.lucy.server.urlredirect.scripting.groovy.GroovyRedirectRule>
    Returns an iterator over the redirect rules in this list in proper sequence.
    leftShift(de.uplanet.lucy.server.urlredirect.scripting.groovy.GroovyRedirectRule p_rule)
    Append the given rule to the end of the list.
    Load the current redirect rules from the configuration file internal/cfg/urlredirect.cfg
    void
    putAt(int p_iIndex, de.uplanet.lucy.server.urlredirect.scripting.groovy.GroovyRedirectRule p_rule)
    Set the redirect rule at the specified index in this list.
    static void
    Reload the currently deployed redirect rules in the system.
    de.uplanet.lucy.server.urlredirect.scripting.groovy.GroovyRedirectRule
    remove(int p_iIndex)
    Removes the redirect rule at the specified position in this list.
    boolean
    remove(de.uplanet.lucy.server.urlredirect.scripting.groovy.GroovyRedirectRule p_rule)
    Remove the given redirect rule if it is contained in this list.
    boolean
    removeAll(Collection<?> p_rules)
    Remove the redirect rules contained in this list.
    void
    Save these redirect rules to the configuration file internal/cfg/urlredirect.cfg.
    de.uplanet.lucy.server.urlredirect.scripting.groovy.GroovyRedirectRule
    set(int p_iIndex, de.uplanet.lucy.server.urlredirect.scripting.groovy.GroovyRedirectRule p_rule)
    Replace the redirect rule at the specified index in this list.
    int
    Returns the number of rules.

    Methods inherited from class groovy.lang.GroovyObjectSupport

    getMetaClass, setMetaClass

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface groovy.lang.GroovyObject

    getProperty, invokeMethod, setProperty

    Methods inherited from interface java.lang.Iterable

    forEach, spliterator
  • Method Details

    • createNew

      public static GroovyRedirectRules createNew()
      Create a new and empty redirect rules object.
      Returns:
      The new and empty redirect rules.
    • reloadConfiguration

      public static void reloadConfiguration()
      Reload the currently deployed redirect rules in the system.

      Calling this method does not affect rules possibly loaded with load().

    • load

      Load the current redirect rules from the configuration file internal/cfg/urlredirect.cfg
      Returns:
      The redirect rules.
      Throws:
      IOException
      SAXException
      TransformerException
    • save

      public void save() throws IOException, SAXException
      Save these redirect rules to the configuration file internal/cfg/urlredirect.cfg.

      Note: The content of the existing file will be completely overwritten.

      Throws:
      SAXException
      IOException
    • createNewRule

      public de.uplanet.lucy.server.urlredirect.scripting.groovy.GroovyRedirectRule createNewRule(String p_strFromUrl, String p_strToUrl)
    • createNewRule

      public de.uplanet.lucy.server.urlredirect.scripting.groovy.GroovyRedirectRule createNewRule(Map<String,String> p_namedParams)
    • iterator

      public Iterator<de.uplanet.lucy.server.urlredirect.scripting.groovy.GroovyRedirectRule> iterator()
      Returns an iterator over the redirect rules in this list in proper sequence.
      Specified by:
      iterator in interface Iterable<de.uplanet.lucy.server.urlredirect.scripting.groovy.GroovyRedirectRule>
    • size

      public int size()
      Returns the number of rules.
      Returns:
      The number of rules.
    • isEmpty

      public boolean isEmpty()
      Check if there are any rules defined.
      Returns:
      true if there are any rules defined, or false otherwise.
    • contains

      public boolean contains(de.uplanet.lucy.server.urlredirect.scripting.groovy.GroovyRedirectRule p_rule)
      Check if the rules contain the given one.
      Parameters:
      p_rule - The rule whose presence in this list is to be tested.
      Returns:
      true if the rules contain the given one, or false otherwise.
    • indexOf

      public int indexOf(de.uplanet.lucy.server.urlredirect.scripting.groovy.GroovyRedirectRule p_rule)
      Get the index of the given rule in this list.
      Parameters:
      p_rule - The rule to search for.
      Returns:
      The index of the given rule, or -1 if the list does not contain the rule.
    • add

      public boolean add(de.uplanet.lucy.server.urlredirect.scripting.groovy.GroovyRedirectRule p_rule)
      Append the given rule to the end of the list.
      Parameters:
      p_rule - The rule to be appended.
      Returns:
      true if the rules have been changed by this call, or false otherwise.
    • leftShift

      public GroovyRedirectRules leftShift(de.uplanet.lucy.server.urlredirect.scripting.groovy.GroovyRedirectRule p_rule)
      Append the given rule to the end of the list.
      Parameters:
      p_rule - The rule to be appended.
      Returns:
      This redirect rules.
    • get

      public de.uplanet.lucy.server.urlredirect.scripting.groovy.GroovyRedirectRule get(int p_iIndex)
      Get the redirect rule at the specified index in this list.
      Parameters:
      p_iIndex - The index of the redirect rule.
      Returns:
      The redirect rule.
      Throws:
      IndexOutOfBoundsException - If the index is out of range, i.e. (index < 0 || index >= size()).
      See Also:
    • set

      public de.uplanet.lucy.server.urlredirect.scripting.groovy.GroovyRedirectRule set(int p_iIndex, de.uplanet.lucy.server.urlredirect.scripting.groovy.GroovyRedirectRule p_rule)
      Replace the redirect rule at the specified index in this list.
      Parameters:
      p_iIndex - The index of the redirect rule to be replaced.
      Returns:
      The redirect rule previously at the specified index.
      Throws:
      IndexOutOfBoundsException - If the index is out of range, i.e. (index < 0 || index >= size()).
      See Also:
    • add

      public void add(int p_iIndex, de.uplanet.lucy.server.urlredirect.scripting.groovy.GroovyRedirectRule p_rule)
      Inserts the given redirect rule at the specified position in this list. Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).
      Parameters:
      p_iIndex - The index at which the specified redirect rule is to be inserted.
      p_rule - The rule to be appended.
      Throws:
      IndexOutOfBoundsException - If the index is out of range, i.e (index < 0 || index > size()).
    • getAt

      public de.uplanet.lucy.server.urlredirect.scripting.groovy.GroovyRedirectRule getAt(int p_iIndex)
      Get the redirect rule at the specified index in this list.

      This methods supports Groovy's subscript operator, e.g.

       def rules = GroovyRedirectRules.load()
       def firstRule = rules[0]
       def lastRule  = rules[-1]
       

      Parameters:
      p_iIndex - The index of the redirect rule.
      Returns:
      The redirect rule.
      Throws:
      IndexOutOfBoundsException - If the index is out of range, i.e. (index < 0 || index >= size()).
      See Also:
    • putAt

      public void putAt(int p_iIndex, de.uplanet.lucy.server.urlredirect.scripting.groovy.GroovyRedirectRule p_rule)
      Set the redirect rule at the specified index in this list.

      This methods supports Groovy's subscript operator, e.g.

       def rules = GroovyRedirectRules.load()
       rules[0]  = firstRule
       rules[-1] = lastRule
       

      Parameters:
      p_iIndex - The index of the redirect rule.
      Throws:
      IndexOutOfBoundsException - If the index is out of range, i.e. (index < 0 || index > size()).
      See Also:
    • remove

      public boolean remove(de.uplanet.lucy.server.urlredirect.scripting.groovy.GroovyRedirectRule p_rule)
      Remove the given redirect rule if it is contained in this list.
      Parameters:
      p_rule - The rule to be removed.
      Returns:
      true if this list contained the specified redirect rule, or false otherwise.
    • removeAll

      public boolean removeAll(Collection<?> p_rules)
      Remove the redirect rules contained in this list.
      Parameters:
      p_rules - The rules to be removed.
      Returns:
      true if this list changed as a result of the call, or false otherwise.
    • remove

      public de.uplanet.lucy.server.urlredirect.scripting.groovy.GroovyRedirectRule remove(int p_iIndex)
      Removes the redirect rule at the specified position in this list. Shifts any subsequent elements to the left (subtracts one from their indices).
      Parameters:
      p_iIndex - The index of the redirect rule to be removed.
      Returns:
      The removed redirect rule.
      Throws:
      IndexOutOfBoundsException - If the index is out of range, i.e (index < 0 || index >= size()).
    • clear

      public void clear()
      Delete all redirect rules.