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
33   * {@link WorkflowOperationInstance}
34   */
35  @XmlType(name = "configuration", namespace = "http://workflow.opencastproject.org")
36  @XmlRootElement(name = "configuration", namespace = "http://workflow.opencastproject.org")
37  @XmlAccessorType(XmlAccessType.FIELD)
38  public class JaxbWorkflowConfiguration  {
39    @XmlAttribute
40    protected String key;
41    @XmlValue
42    protected String value;
43  
44    public JaxbWorkflowConfiguration() {
45    }
46  
47    public JaxbWorkflowConfiguration(String key, String value) {
48      this.key = key;
49      this.value = value;
50    }
51  
52    public String getKey() {
53      return key;
54    }
55  
56    public void setKey(String key) {
57      this.key = key;
58    }
59  
60    public String getValue() {
61      return value;
62    }
63  
64    public void setValue(String value) {
65      this.value = value;
66    }
67  
68    /**
69     * {@inheritDoc}
70     *
71     * @see java.lang.Object#hashCode()
72     */
73    @Override
74    public int hashCode() {
75      final int prime = 31;
76      int result = 1;
77      result = prime * result + ((key == null) ? 0 : key.hashCode());
78      return result;
79    }
80  
81    /**
82     * {@inheritDoc}
83     *
84     * @see java.lang.Object#equals(java.lang.Object)
85     */
86    @Override
87    public boolean equals(Object obj) {
88      if (this == obj) {
89        return true;
90      }
91      if (obj == null) {
92        return false;
93      }
94      if (getClass() != obj.getClass()) {
95        return false;
96      }
97      JaxbWorkflowConfiguration other = (JaxbWorkflowConfiguration) obj;
98      if (key == null) {
99        if (other.key != null) {
100         return false;
101       }
102     } else if (!key.equals(other.key)) {
103       return false;
104     }
105     return true;
106   }
107 
108 }
109