View Javadoc
1   /*
2    * Licensed to The Apereo Foundation under one or more contributor license
3    * agreements. See the NOTICE file distributed with this work for additional
4    * information regarding copyright ownership.
5    *
6    *
7    * The Apereo Foundation licenses this file to you under the Educational
8    * Community License, Version 2.0 (the "License"); you may not use this file
9    * except in compliance with the License. You may obtain a copy of the License
10   * at:
11   *
12   *   http://opensource.org/licenses/ecl2.txt
13   *
14   * Unless required by applicable law or agreed to in writing, software
15   * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
16   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
17   * License for the specific language governing permissions and limitations under
18   * the License.
19   *
20   */
21  
22  package org.opencastproject.workflow.api;
23  
24  import javax.xml.bind.annotation.XmlAccessType;
25  import javax.xml.bind.annotation.XmlAccessorType;
26  import javax.xml.bind.annotation.XmlAttribute;
27  import javax.xml.bind.annotation.XmlRootElement;
28  import javax.xml.bind.annotation.XmlType;
29  import javax.xml.bind.annotation.XmlValue;
30  
31  /**
32   * JAXB annotated implementation of Map<String, String> for {@link WorkflowInstance} and {@link WorkflowOperationInstance}
33   */
34  @XmlType(name = "configuration", namespace = "http://workflow.opencastproject.org")
35  @XmlRootElement(name = "configuration", namespace = "http://workflow.opencastproject.org")
36  @XmlAccessorType(XmlAccessType.FIELD)
37  public class JaxbWorkflowConfiguration  {
38    @XmlAttribute
39    protected String key;
40    @XmlValue
41    protected String value;
42  
43    public JaxbWorkflowConfiguration() {
44    }
45  
46    public JaxbWorkflowConfiguration(String key, String value) {
47      this.key = key;
48      this.value = value;
49    }
50  
51    public String getKey() {
52      return key;
53    }
54  
55    public void setKey(String key) {
56      this.key = key;
57    }
58  
59    public String getValue() {
60      return value;
61    }
62  
63    public void setValue(String value) {
64      this.value = value;
65    }
66  
67    /**
68     * {@inheritDoc}
69     *
70     * @see java.lang.Object#hashCode()
71     */
72    @Override
73    public int hashCode() {
74      final int prime = 31;
75      int result = 1;
76      result = prime * result + ((key == null) ? 0 : key.hashCode());
77      return result;
78    }
79  
80    /**
81     * {@inheritDoc}
82     *
83     * @see java.lang.Object#equals(java.lang.Object)
84     */
85    @Override
86    public boolean equals(Object obj) {
87      if (this == obj)
88        return true;
89      if (obj == null)
90        return false;
91      if (getClass() != obj.getClass())
92        return false;
93      JaxbWorkflowConfiguration other = (JaxbWorkflowConfiguration) obj;
94      if (key == null) {
95        if (other.key != null)
96          return false;
97      } else if (!key.equals(other.key))
98        return false;
99      return true;
100   }
101 
102 }
103