com.identityx.clientSDK.queryHolders.StatisticQueryHolder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of IdentityXClientSDK Show documentation
Show all versions of IdentityXClientSDK Show documentation
Client SDK for IdentityX Rest Services
/*
* Copyright Daon.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.identityx.clientSDK.queryHolders;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;
import com.daon.identityx.rest.model.pojo.Statistic.StatisticTypeEnum;
import com.fasterxml.jackson.annotation.JsonIgnore;
public class StatisticQueryHolder extends QueryHolder {
public StatisticQueryHolder() {
setSensitiveDataSpec(new SensitiveDataSpec());
}
public class StatisticSearchSpec extends SearchSpec {
private StatisticTypeEnum type;
private String start;
private String end;
public StatisticTypeEnum getType() {
return type;
}
public void setType(StatisticTypeEnum type) {
this.type = type;
}
@JsonIgnore
public Date getStartDate() throws ParseException {
return convertString(start);
}
@JsonIgnore
public void setStartDate(Date start) {
this.start = convertDate(start);
}
@JsonIgnore
public Date getEndDate() throws ParseException {
return convertString(end);
}
@JsonIgnore
public void setEndDate(Date end) {
this.end = convertDate(end);
}
public String getStart() {
return start;
}
public void setStart(String start) {
this.start = start;
}
public String getEnd() {
return end;
}
public void setEnd(String end) {
this.end = end;
}
protected String convertDate(Date date) {
TimeZone tz = TimeZone.getTimeZone("UTC");
DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
df.setTimeZone(tz);
return df.format(date);
}
protected Date convertString(String date) throws ParseException {
TimeZone tz = TimeZone.getTimeZone("UTC");
DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
df.setTimeZone(tz);
return df.parse(date);
}
}
private StatisticSearchSpec searchSpec = new StatisticSearchSpec();
@Override
public StatisticSearchSpec getSearchSpec() {
return searchSpec;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy