Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.uid2.shared.model.Site Maven / Gradle / Ivy
package com.uid2.shared.model;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.NonNull;
import java.time.Instant;
import java.util.HashSet;
import java.util.Set;
@Data
public class Site {
private static final String DEFAULT_DESCRIPTION = "";
private static final boolean DEFAULT_VISIBLE = true;
private final int id;
private String name;
private String description;
private Boolean enabled;
@JsonProperty("domain_names")
private Set domainNames;
@NonNull
@JsonProperty("app_names")
private Set appNames;
private Set clientTypes;
private Boolean visible;
private final long created;
@JsonCreator
public Site(@JsonProperty("id") int id,
@JsonProperty("name") String name,
@JsonProperty("description") String description,
@JsonProperty("enabled") Boolean enabled,
@JsonProperty("clientTypes") Set types,
@JsonProperty("domain_names") Set domains,
@JsonProperty("app_names") Set appNames,
@JsonProperty("visible") Boolean visible,
@JsonProperty("created") long created) {
this.id = id;
this.name = name;
this.description = (description != null) ? description : DEFAULT_DESCRIPTION;
this.enabled = enabled;
this.clientTypes = (types != null) ? new HashSet<>(types) : new HashSet<>();
this.domainNames = (domains != null) ? new HashSet<>(domains) : new HashSet<>();
this.appNames = (appNames != null) ? new HashSet<>(appNames) : new HashSet<>();
this.visible = visible;
this.created = created;
}
public Site(int id, String name, Boolean enabled) {
this(id, name, enabled, new HashSet<>());
}
public Site(int id, String name, Boolean enabled, Set domains) {
this(id, name, enabled, new HashSet<>(), domains);
}
public Site(int id, String name, Boolean enabled, Set types, Set domains) {
this(id, name, enabled, types, domains, Instant.now().getEpochSecond());
}
public Site(int id, String name, Boolean enabled, Set types, Set domains, long created) {
this(id, name, DEFAULT_DESCRIPTION, enabled, types, domains, new HashSet<>(), DEFAULT_VISIBLE, created);
}
public Site(int id, String name, String description, Boolean enabled, Set types, Set domains, Boolean visible) {
this(id, name, description, enabled, types, domains, new HashSet<>(), visible);
}
public Site(int id, String name, Boolean enabled, Set types, Set domains, Set appNames) {
this(id, name, DEFAULT_DESCRIPTION, enabled, types, domains, appNames, DEFAULT_VISIBLE);
}
public Site(int id, String name, String description, Boolean enabled, Set types, Set domains, Set appNames, Boolean visible) {
this(id, name, description, enabled, types, domains, appNames, visible, Instant.now().getEpochSecond());
}
public Boolean isEnabled() { return enabled; }
public Boolean isVisible() { return visible; }
}