View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.syncope.common.lib.to;
20  
21  import java.util.Date;
22  import java.util.Optional;
23  import org.apache.commons.lang3.builder.EqualsBuilder;
24  import org.apache.commons.lang3.builder.HashCodeBuilder;
25  import org.apache.syncope.common.lib.BaseBean;
26  
27  public class UserRequest implements BaseBean {
28  
29      private static final long serialVersionUID = -8430826310789942133L;
30  
31      private String bpmnProcess;
32  
33      private Date startTime;
34  
35      private String username;
36  
37      private String executionId;
38  
39      private String activityId;
40  
41      private String taskId;
42  
43      private boolean hasForm;
44  
45      public String getBpmnProcess() {
46          return bpmnProcess;
47      }
48  
49      public void setBpmnProcess(final String bpmnProcess) {
50          this.bpmnProcess = bpmnProcess;
51      }
52  
53      public Date getStartTime() {
54          return Optional.ofNullable(startTime).map(date -> new Date(date.getTime())).orElse(null);
55      }
56  
57      public void setStartTime(final Date startTime) {
58          this.startTime = Optional.ofNullable(startTime).map(date -> new Date(date.getTime())).orElse(null);
59      }
60  
61      public String getUsername() {
62          return username;
63      }
64  
65      public void setUsername(final String username) {
66          this.username = username;
67      }
68  
69      public String getExecutionId() {
70          return executionId;
71      }
72  
73      public void setExecutionId(final String executionId) {
74          this.executionId = executionId;
75      }
76  
77      public String getActivityId() {
78          return activityId;
79      }
80  
81      public void setActivityId(final String activityId) {
82          this.activityId = activityId;
83      }
84  
85      public String getTaskId() {
86          return taskId;
87      }
88  
89      public void setTaskId(final String taskId) {
90          this.taskId = taskId;
91      }
92  
93      public boolean getHasForm() {
94          return hasForm;
95      }
96  
97      public void setHasForm(final boolean hasForm) {
98          this.hasForm = hasForm;
99      }
100 
101     @Override
102     public int hashCode() {
103         return new HashCodeBuilder().
104                 append(bpmnProcess).
105                 append(startTime).
106                 append(username).
107                 append(executionId).
108                 append(activityId).
109                 append(taskId).
110                 append(hasForm).
111                 build();
112     }
113 
114     @Override
115     public boolean equals(final Object obj) {
116         if (this == obj) {
117             return true;
118         }
119         if (obj == null) {
120             return false;
121         }
122         if (getClass() != obj.getClass()) {
123             return false;
124         }
125         UserRequest other = (UserRequest) obj;
126         return new EqualsBuilder().
127                 append(bpmnProcess, other.bpmnProcess).
128                 append(startTime, other.startTime).
129                 append(username, other.username).
130                 append(executionId, other.executionId).
131                 append(activityId, other.activityId).
132                 append(taskId, other.taskId).
133                 append(hasForm, other.hasForm).
134                 build();
135     }
136 }