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.series.api;
23  
24  import org.opencastproject.security.api.User;
25  
26  import java.util.Objects;
27  
28  public class SeriesCreator {
29  
30    private final String username;
31  
32    private final String name;
33  
34    public SeriesCreator(User user) {
35      this.username = Objects.requireNonNull(user.getUsername(), "Username must not be null");
36      this.name = user.getName();
37    }
38  
39    public SeriesCreator(String username, String name) {
40      this.username = Objects.requireNonNull(username, "Username must not be null");
41      this.name = name;
42    }
43  
44    public String username() {
45      return username;
46    }
47  
48    public String name() {
49      return name;
50    }
51  
52    @Override
53    public boolean equals(Object o) {
54      if (!(o instanceof SeriesCreator that)) {
55        return false;
56      }
57      return Objects.equals(username, that.username) && Objects.equals(name, that.name);
58    }
59  
60    @Override
61    public int hashCode() {
62      return Objects.hash(username, name);
63    }
64  
65  }