|  1 |     | 
     | 
  |  2 |     | 
     | 
  |  3 |     | 
     | 
  |  4 |     | 
     | 
  |  5 |     | 
     | 
  |  6 |     | 
     | 
  |  7 |     | 
     | 
  |  8 |     | 
     | 
  |  9 |     | 
     | 
  |  10 |     | 
     | 
  |  11 |     | 
     | 
  |  12 |     | 
     | 
  |  13 |     | 
     | 
  |  14 |     | 
     | 
  |  15 |     | 
     | 
  |  16 |     | 
     | 
  |  17 |     | 
   package org.kuali.rice.core.api.parameter;  | 
  |  18 |     | 
     | 
  |  19 |     | 
   import org.apache.commons.lang.StringUtils;  | 
  |  20 |     | 
   import org.apache.commons.lang.builder.EqualsBuilder;  | 
  |  21 |     | 
   import org.apache.commons.lang.builder.HashCodeBuilder;  | 
  |  22 |     | 
   import org.apache.commons.lang.builder.ToStringBuilder;  | 
  |  23 |     | 
   import org.kuali.rice.core.api.CoreConstants;  | 
  |  24 |     | 
   import org.w3c.dom.Element;  | 
  |  25 |     | 
     | 
  |  26 |     | 
   import javax.xml.bind.annotation.XmlAccessType;  | 
  |  27 |     | 
   import javax.xml.bind.annotation.XmlAccessorType;  | 
  |  28 |     | 
   import javax.xml.bind.annotation.XmlAnyElement;  | 
  |  29 |     | 
   import javax.xml.bind.annotation.XmlElement;  | 
  |  30 |     | 
   import javax.xml.bind.annotation.XmlRootElement;  | 
  |  31 |     | 
   import javax.xml.bind.annotation.XmlType;  | 
  |  32 |     | 
   import java.io.Serializable;  | 
  |  33 |     | 
   import java.util.Collection;  | 
  |  34 |     | 
     | 
  |  35 |     | 
     | 
  |  36 |     | 
     | 
  |  37 |     | 
     | 
  |  38 |     | 
     | 
  |  39 |     | 
     | 
  |  40 |     | 
     | 
  |  41 |     | 
   @XmlRootElement(name = ParameterKey.Constants.ROOT_ELEMENT_NAME)  | 
  |  42 |     | 
   @XmlAccessorType(XmlAccessType.NONE)  | 
  |  43 |     | 
   @XmlType(name = ParameterKey.Constants.TYPE_NAME, propOrder = { | 
  |  44 |     | 
       ParameterKey.Elements.APPLICATION_CODE,  | 
  |  45 |     | 
       ParameterKey.Elements.NAMESPACE_CODE,  | 
  |  46 |     | 
       ParameterKey.Elements.COMPONENT_CODE,  | 
  |  47 |     | 
       ParameterKey.Elements.NAME,  | 
  |  48 |     | 
       CoreConstants.CommonElements.FUTURE_ELEMENTS  | 
  |  49 |     | 
   })  | 
  |  50 |     | 
   public final class ParameterKey implements Serializable { | 
  |  51 |     | 
     | 
  |  52 |     | 
           private static final long serialVersionUID = -4405355319548951283L;  | 
  |  53 |     | 
     | 
  |  54 |     | 
           @XmlElement(name = Elements.APPLICATION_CODE, required=true)  | 
  |  55 |     | 
           private final String applicationCode;  | 
  |  56 |     | 
     | 
  |  57 |     | 
           @XmlElement(name = Elements.NAMESPACE_CODE, required=true)  | 
  |  58 |     | 
           private final String namespaceCode;  | 
  |  59 |     | 
     | 
  |  60 |     | 
           @XmlElement(name = Elements.COMPONENT_CODE, required=true)  | 
  |  61 |     | 
           private final String componentCode;  | 
  |  62 |     | 
             | 
  |  63 |     | 
       @XmlElement(name = Elements.NAME, required=true)  | 
  |  64 |     | 
       private final String name;  | 
  |  65 |     | 
     | 
  |  66 |    17 |        @SuppressWarnings("unused") | 
  |  67 |     | 
           @XmlAnyElement  | 
  |  68 |     | 
       private final Collection<Element> _futureElements = null;  | 
  |  69 |     | 
     | 
  |  70 |     | 
         | 
  |  71 |     | 
     | 
  |  72 |     | 
     | 
  |  73 |    2 |        private ParameterKey() { | 
  |  74 |    2 |                this.applicationCode = null;  | 
  |  75 |    2 |                this.namespaceCode = null;  | 
  |  76 |    2 |                this.componentCode = null;  | 
  |  77 |    2 |                this.name = null;  | 
  |  78 |    2 |        }  | 
  |  79 |     | 
     | 
  |  80 |     | 
             | 
  |  81 |     | 
     | 
  |  82 |     | 
     | 
  |  83 |    15 |        private ParameterKey(String applicationCode, String namespaceCode, String componentCode, String name) { | 
  |  84 |    15 |            if (StringUtils.isBlank(applicationCode)) { | 
  |  85 |    4 |                throw new IllegalArgumentException("applicationCode is blank"); | 
  |  86 |     | 
           }  | 
  |  87 |    11 |            if (StringUtils.isBlank(namespaceCode)) { | 
  |  88 |    3 |                throw new IllegalArgumentException("namespaceCode is blank"); | 
  |  89 |     | 
           }  | 
  |  90 |    8 |            if (StringUtils.isBlank(componentCode)) { | 
  |  91 |    3 |                throw new IllegalArgumentException("componentCode is blank"); | 
  |  92 |     | 
           }  | 
  |  93 |    5 |                    if (StringUtils.isBlank(name)) { | 
  |  94 |    3 |                            throw new IllegalArgumentException("name is blank"); | 
  |  95 |     | 
                   }  | 
  |  96 |    2 |            this.applicationCode = applicationCode;  | 
  |  97 |    2 |            this.namespaceCode = namespaceCode;  | 
  |  98 |    2 |            this.componentCode = componentCode;  | 
  |  99 |    2 |                    this.name = name;  | 
  |  100 |    2 |        }  | 
  |  101 |     | 
     | 
  |  102 |     | 
         | 
  |  103 |     | 
     | 
  |  104 |     | 
     | 
  |  105 |     | 
     | 
  |  106 |     | 
     | 
  |  107 |     | 
     | 
  |  108 |     | 
     | 
  |  109 |     | 
     | 
  |  110 |     | 
     | 
  |  111 |     | 
     | 
  |  112 |     | 
       public static ParameterKey create(String applicationCode, String namespaceCode, String componentCode, String name) { | 
  |  113 |    15 |            return new ParameterKey(applicationCode, namespaceCode, componentCode, name);  | 
  |  114 |     | 
       }  | 
  |  115 |     | 
             | 
  |  116 |     | 
       public String getApplicationCode() { | 
  |  117 |    0 |                    return applicationCode;  | 
  |  118 |     | 
           }  | 
  |  119 |     | 
     | 
  |  120 |     | 
           public String getNamespaceCode() { | 
  |  121 |    0 |                    return namespaceCode;  | 
  |  122 |     | 
           }  | 
  |  123 |     | 
     | 
  |  124 |     | 
           public String getComponentCode() { | 
  |  125 |    0 |                    return componentCode;  | 
  |  126 |     | 
           }  | 
  |  127 |     | 
     | 
  |  128 |     | 
           public String getName() { | 
  |  129 |    0 |                    return name;  | 
  |  130 |     | 
           }  | 
  |  131 |     | 
     | 
  |  132 |     | 
           @Override  | 
  |  133 |     | 
           public int hashCode() { | 
  |  134 |    0 |                    return HashCodeBuilder.reflectionHashCode(this, Constants.HASH_CODE_EQUALS_EXCLUDE);  | 
  |  135 |     | 
           }  | 
  |  136 |     | 
     | 
  |  137 |     | 
           @Override  | 
  |  138 |     | 
           public boolean equals(Object obj) { | 
  |  139 |    2 |                    return EqualsBuilder.reflectionEquals(obj, this, Constants.HASH_CODE_EQUALS_EXCLUDE);  | 
  |  140 |     | 
           }  | 
  |  141 |     | 
     | 
  |  142 |     | 
           @Override  | 
  |  143 |     | 
           public String toString() { | 
  |  144 |    0 |                    return ToStringBuilder.reflectionToString(this);  | 
  |  145 |     | 
           }  | 
  |  146 |     | 
         | 
  |  147 |     | 
             | 
  |  148 |     | 
     | 
  |  149 |     | 
     | 
  |  150 |    0 |            static class Constants { | 
  |  151 |     | 
                   final static String ROOT_ELEMENT_NAME = "parameterKey";  | 
  |  152 |     | 
                   final static String TYPE_NAME = "ParameterKeyType";  | 
  |  153 |    1 |                    final static String[] HASH_CODE_EQUALS_EXCLUDE = { CoreConstants.CommonElements.FUTURE_ELEMENTS}; | 
  |  154 |     | 
           }  | 
  |  155 |     | 
       | 
  |  156 |     | 
             | 
  |  157 |     | 
     | 
  |  158 |     | 
     | 
  |  159 |     | 
     | 
  |  160 |    0 |            static class Elements { | 
  |  161 |     | 
                   final static String APPLICATION_CODE = "applicationCode";  | 
  |  162 |     | 
                   final static String NAMESPACE_CODE = "namespaceCode";  | 
  |  163 |     | 
                   final static String COMPONENT_CODE = "componentCode";  | 
  |  164 |     | 
                   final static String NAME = "name";  | 
  |  165 |     | 
           }  | 
  |  166 |     | 
       | 
  |  167 |     | 
   }  |