All Downloads are FREE. Search and download functionalities are using the official Maven repository.

be.personify.iam.model.gateway.Site Maven / Gradle / Ivy

There is a newer version: 1.5.2.RELEASE
Show newest version
package be.personify.iam.model.gateway;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.ElementCollection;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Index;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import be.personify.iam.model.util.Persisted;
import be.personify.util.generator.MetaInfo;

@Entity
@MetaInfo( group="gateway", frontendGroup="Site", name="site", description="A site", iconClass="sitemap", 
				sortOrderInGroup=1, showInMenu=true,
				isConcept=false, number=1,
				workflowEnabled = false
)
@Table(name="site", indexes = {@Index(name = "idx_site_path", columnList = "path")})
//use commas in the column list?
public class Site extends Persisted implements Serializable {
	
	private static final long serialVersionUID = 3074678898971101336L;
	
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@MetaInfo(showInSearchResultGrid=false , name="id", description="the id of the site")
	private long id;
	
	@Column(nullable=false)
	@MetaInfo(name="path",description="the path on the gateway that will be the portal to the backend application",sampleValue="/frontend1" )
	private String path;
	
	
	@Column(nullable=false)
	@MetaInfo(name="location",description="the location of the backend application",sampleValue="http://localhost:8080/frontend1",showInSearchResultGrid = false, searchable = false )
	private String location;	
	
	@Column(nullable=false)
	@MetaInfo(name="domains",description="the domains of the gateway, important for the cookies",sampleValue="personify.be", searchable = false, showInSearchResultGrid = false)
	@ElementCollection(fetch = FetchType.EAGER)
	private List domains = new ArrayList<>();
	
	@MetaInfo(name="description",description="the description of the site",
			sampleValue="ldap used for authentication",
			searchable=false,
			customRenderer = "text_area|rows:3",
			showInSearchResultGrid=false)
	private String description;
	
	@MetaInfo(name="active",description="indicating if the site is active",sampleValue="true")
	private boolean active;
	
	@MetaInfo(name="defaultForDomain",description="indicating if the site is default for the domain",sampleValue="true", showInSearchResultGrid = false, searchable = false)
	private boolean defaultForDomain;
	
	@Enumerated(EnumType.STRING)
	@MetaInfo(name="loadBalancerMethod",description="indicating the loadBalancerMethod",sampleValue="ROUND_ROBIN", 
		required = false,
		showInSearchResultGrid = false, searchable = false)
	private LoadBalancerMethod loadBalancerMethod;
	
	
	@OneToMany(cascade=CascadeType.ALL, mappedBy="site")
	@ElementCollection(targetClass=RequestHandler.class)
	@MetaInfo(name="requestHandlers", description="A list containing the request handlers linked to the site_. See requesthandler_")
	private List requestHandlers;
	
	
	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}
	

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public boolean isActive() {
		return active;
	}

	public void setActive(boolean active) {
		this.active = active;
	}

	public String getLocation() {
		return location;
	}

	public void setLocation(String location) {
		this.location = location;
	}

	public String getPath() {
		return path;
	}

	public void setPath(String path) {
		this.path = path;
	}


	public List getRequestHandlers() {
		return requestHandlers;
	}


	public void setRequestHandlers(List requestHandlers) {
		this.requestHandlers = requestHandlers;
	}


	public List getDomains() {
		return domains;
	}

	public void setDomains(List domains) {
		this.domains = domains;
	}


	public boolean isDefaultForDomain() {
		return defaultForDomain;
	}


	public void setDefaultForDomain(boolean defaultForDomain) {
		this.defaultForDomain = defaultForDomain;
	}

	public LoadBalancerMethod getLoadBalancerMethod() {
		return loadBalancerMethod;
	}

	public void setLoadBalancerMethod(LoadBalancerMethod loadBalancerMethod) {
		this.loadBalancerMethod = loadBalancerMethod;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = super.hashCode();
		result = prime * result + (active ? 1231 : 1237);
		result = prime * result + (defaultForDomain ? 1231 : 1237);
		result = prime * result + ((description == null) ? 0 : description.hashCode());
		result = prime * result + ((domains == null) ? 0 : domains.hashCode());
		result = prime * result + (int) (id ^ (id >>> 32));
		result = prime * result + ((loadBalancerMethod == null) ? 0 : loadBalancerMethod.hashCode());
		result = prime * result + ((location == null) ? 0 : location.hashCode());
		result = prime * result + ((path == null) ? 0 : path.hashCode());
		result = prime * result + ((requestHandlers == null) ? 0 : requestHandlers.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (!super.equals(obj))
			return false;
		if (getClass() != obj.getClass())
			return false;
		Site other = (Site) obj;
		if (active != other.active)
			return false;
		if (defaultForDomain != other.defaultForDomain)
			return false;
		if (description == null) {
			if (other.description != null)
				return false;
		} else if (!description.equals(other.description))
			return false;
		if (domains == null) {
			if (other.domains != null)
				return false;
		} else if (!domains.equals(other.domains))
			return false;
		if (id != other.id)
			return false;
		if (loadBalancerMethod != other.loadBalancerMethod)
			return false;
		if (location == null) {
			if (other.location != null)
				return false;
		} else if (!location.equals(other.location))
			return false;
		if (path == null) {
			if (other.path != null)
				return false;
		} else if (!path.equals(other.path))
			return false;
		if (requestHandlers == null) {
			if (other.requestHandlers != null)
				return false;
		} else if (!requestHandlers.equals(other.requestHandlers))
			return false;
		return true;
	}

	
	
	

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy