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.form.SyncopeForm;
26  import org.apache.syncope.common.lib.request.UserUR;
27  
28  public class UserRequestForm extends SyncopeForm {
29  
30      private static final long serialVersionUID = -7044543391316529128L;
31  
32      private String bpmnProcess;
33  
34      private String username;
35  
36      private String executionId;
37  
38      private String taskId;
39  
40      private String formKey;
41  
42      private Date createTime;
43  
44      private Date dueDate;
45  
46      private String assignee;
47  
48      private UserTO userTO;
49  
50      private UserUR userUR;
51  
52      public String getBpmnProcess() {
53          return bpmnProcess;
54      }
55  
56      public void setBpmnProcess(final String bpmnProcess) {
57          this.bpmnProcess = bpmnProcess;
58      }
59  
60      public String getUsername() {
61          return username;
62      }
63  
64      public void setUsername(final String username) {
65          this.username = username;
66      }
67  
68      public String getExecutionId() {
69          return executionId;
70      }
71  
72      public void setExecutionId(final String executionId) {
73          this.executionId = executionId;
74      }
75  
76      public String getTaskId() {
77          return taskId;
78      }
79  
80      public void setTaskId(final String taskId) {
81          this.taskId = taskId;
82      }
83  
84      public String getFormKey() {
85          return formKey;
86      }
87  
88      public void setFormKey(final String formKey) {
89          this.formKey = formKey;
90      }
91  
92      public Date getCreateTime() {
93          return Optional.ofNullable(createTime).map(date -> new Date(date.getTime())).orElse(null);
94      }
95  
96      public void setCreateTime(final Date createTime) {
97          this.createTime = Optional.ofNullable(createTime).map(date -> new Date(date.getTime())).orElse(null);
98      }
99  
100     public Date getDueDate() {
101         return Optional.ofNullable(dueDate).map(date -> new Date(date.getTime())).orElse(null);
102     }
103 
104     public void setDueDate(final Date dueDate) {
105         this.dueDate = Optional.ofNullable(dueDate).map(date -> new Date(date.getTime())).orElse(null);
106     }
107 
108     public String getAssignee() {
109         return assignee;
110     }
111 
112     public void setAssignee(final String assignee) {
113         this.assignee = assignee;
114     }
115 
116     public UserTO getUserTO() {
117         return userTO;
118     }
119 
120     public void setUserTO(final UserTO userTO) {
121         this.userTO = userTO;
122     }
123 
124     public UserUR getUserUR() {
125         return userUR;
126     }
127 
128     public void setUserUR(final UserUR userUR) {
129         this.userUR = userUR;
130     }
131 
132     @Override
133     public int hashCode() {
134         return new HashCodeBuilder().
135                 appendSuper(super.hashCode()).
136                 append(bpmnProcess).
137                 append(username).
138                 append(executionId).
139                 append(taskId).
140                 append(formKey).
141                 append(createTime).
142                 append(dueDate).
143                 append(assignee).
144                 append(userTO).
145                 append(userUR).
146                 build();
147     }
148 
149     @Override
150     public boolean equals(final Object obj) {
151         if (this == obj) {
152             return true;
153         }
154         if (obj == null) {
155             return false;
156         }
157         if (getClass() != obj.getClass()) {
158             return false;
159         }
160         UserRequestForm other = (UserRequestForm) obj;
161         return new EqualsBuilder().
162                 appendSuper(super.equals(obj)).
163                 append(bpmnProcess, other.bpmnProcess).
164                 append(username, other.username).
165                 append(executionId, other.executionId).
166                 append(taskId, other.taskId).
167                 append(formKey, other.formKey).
168                 append(createTime, other.createTime).
169                 append(dueDate, other.dueDate).
170                 append(assignee, other.assignee).
171                 append(userTO, other.userTO).
172                 append(userUR, other.userUR).
173                 build();
174     }
175 }