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 com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
22  import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
23  import java.time.OffsetDateTime;
24  import java.util.ArrayList;
25  import java.util.List;
26  import javax.ws.rs.PathParam;
27  import org.apache.commons.lang3.builder.EqualsBuilder;
28  import org.apache.commons.lang3.builder.HashCodeBuilder;
29  
30  public class ReportTO extends AbstractStartEndBean implements NamedEntityTO {
31  
32      private static final long serialVersionUID = 5274568072084814410L;
33  
34      private String key;
35  
36      private String name;
37  
38      private String mimeType;
39  
40      private String fileExt;
41  
42      private String cronExpression;
43  
44      private String jobDelegate;
45  
46      private boolean active;
47  
48      private final List<ExecTO> executions = new ArrayList<>();
49  
50      private String latestExecStatus;
51  
52      private OffsetDateTime lastExec;
53  
54      private OffsetDateTime nextExec;
55  
56      private String lastExecutor;
57  
58      @Override
59      public String getKey() {
60          return key;
61      }
62  
63      @PathParam("key")
64      @Override
65      public void setKey(final String key) {
66          this.key = key;
67      }
68  
69      @Override
70      public String getName() {
71          return name;
72      }
73  
74      @Override
75      public void setName(final String name) {
76          this.name = name;
77      }
78  
79      public String getMimeType() {
80          return mimeType;
81      }
82  
83      public void setMimeType(final String mimeType) {
84          this.mimeType = mimeType;
85      }
86  
87      public String getFileExt() {
88          return fileExt;
89      }
90  
91      public void setFileExt(final String fileExt) {
92          this.fileExt = fileExt;
93      }
94  
95      public String getCronExpression() {
96          return cronExpression;
97      }
98  
99      public void setCronExpression(final String cronExpression) {
100         this.cronExpression = cronExpression;
101     }
102 
103     public String getJobDelegate() {
104         return jobDelegate;
105     }
106 
107     public void setJobDelegate(final String jobDelegate) {
108         this.jobDelegate = jobDelegate;
109     }
110 
111     @JacksonXmlElementWrapper(localName = "executions")
112     @JacksonXmlProperty(localName = "execution")
113     public List<ExecTO> getExecutions() {
114         return executions;
115     }
116 
117     public String getLatestExecStatus() {
118         return latestExecStatus;
119     }
120 
121     public void setLatestExecStatus(final String latestExecStatus) {
122         this.latestExecStatus = latestExecStatus;
123     }
124 
125     public OffsetDateTime getLastExec() {
126         return lastExec;
127     }
128 
129     public void setLastExec(final OffsetDateTime lastExec) {
130         this.lastExec = lastExec;
131     }
132 
133     public OffsetDateTime getNextExec() {
134         return nextExec;
135     }
136 
137     public void setNextExec(final OffsetDateTime nextExec) {
138         this.nextExec = nextExec;
139     }
140 
141     public boolean isActive() {
142         return active;
143     }
144 
145     public void setActive(final boolean active) {
146         this.active = active;
147     }
148 
149     public String getLastExecutor() {
150         return lastExecutor;
151     }
152 
153     public void setLastExecutor(final String lastExecutor) {
154         this.lastExecutor = lastExecutor;
155     }
156 
157     @Override
158     public int hashCode() {
159         return new HashCodeBuilder().
160                 appendSuper(super.hashCode()).
161                 append(key).
162                 append(name).
163                 append(mimeType).
164                 append(fileExt).
165                 append(cronExpression).
166                 append(jobDelegate).
167                 append(executions).
168                 append(latestExecStatus).
169                 append(lastExec).
170                 append(nextExec).
171                 append(active).
172                 append(lastExecutor).
173                 build();
174     }
175 
176     @Override
177     public boolean equals(final Object obj) {
178         if (this == obj) {
179             return true;
180         }
181         if (obj == null) {
182             return false;
183         }
184         if (getClass() != obj.getClass()) {
185             return false;
186         }
187         final ReportTO other = (ReportTO) obj;
188         return new EqualsBuilder().
189                 appendSuper(super.equals(obj)).
190                 append(key, other.key).
191                 append(name, other.name).
192                 append(mimeType, other.mimeType).
193                 append(fileExt, other.fileExt).
194                 append(cronExpression, other.cronExpression).
195                 append(jobDelegate, other.jobDelegate).
196                 append(executions, other.executions).
197                 append(latestExecStatus, other.latestExecStatus).
198                 append(lastExec, other.lastExec).
199                 append(nextExec, other.nextExec).
200                 append(active, other.active).
201                 append(lastExecutor, other.lastExecutor).
202                 build();
203     }
204 }