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

be.personify.iam.model.provisioning.ConnectorConfiguration Maven / Gradle / Ivy

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

import java.io.Serializable;
import java.util.Map;

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.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.MapKeyColumn;

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

@Entity
@MetaInfo( group="provisioning", frontendGroup="TargetSystem", name="ConnectorConfiguration", description="Configuration for a connector",
				showInMenu=true,
				sortOrderInGroup=4,
				iconClass = "cogs",
				number=3
)
public class ConnectorConfiguration extends Persisted implements Serializable{
	
	private static final long serialVersionUID = 4677239166337506691L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@MetaInfo(name="id", description="the id of the connector configuration", searchable=false,showInSearchResultGrid=false)
	private long id;
	

	@MetaInfo(name="name", description="the name of the connector configuration (unique)")
	@Column(unique=true)
	private String name;
	
	@MetaInfo(showInSearchResultGrid=false,name="description", description="the description of the connector configuration", customRenderer = "text_area|rows:3", searchable = false)
	private String description;
	
	
	@MetaInfo(showInSearchResultGridMobile = false)
	@Enumerated(EnumType.STRING)
	private ConnectorType connectorType;
	
	@Column
	@MetaInfo(name="customConnectorClassName", description="the fully qualified classname of the custom connector implementation" , searchable=false, showInSearchResultGrid=false, required = false )
	private String customConnectorClassName;

	

	@MetaInfo(name="poolSize", description="the size of the connection pool", searchable=false, showInSearchResultGridMobile = false,
			customRenderer = "integer_dropdown|values:1-20|default:2")
	private int poolSize = 1;
	
	@MetaInfo(name="maxPoolValidity", description="the maxPoolValidity of the connection pool", searchable=false, showInSearchResultGridMobile = false, unit="sec",
			customRenderer = "integer_dropdown|values:60,3600|default:3600")
	private int maxPoolValidity = 3600;
	
	@ElementCollection(fetch = FetchType.EAGER)
	@JoinTable(name="configuration", joinColumns=@JoinColumn(name="id"))
	@MapKeyColumn (name="configuration_id")
	@Column(name="value")
	@MetaInfo(name="configuration", description="the configuration of the connector")
	private Map configuration;
	
	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}
	
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getDescription() {
		return description;
	}

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

	public int getPoolSize() {
		return poolSize;
	}

	public void setPoolSize(int poolSize) {
		this.poolSize = poolSize;
	}

	public Map getConfiguration() {
		return configuration;
	}

	public void setConfiguration(Map configuration) {
		this.configuration = configuration;
	}

	public ConnectorType getConnectorType() {
		return connectorType;
	}

	public void setConnectorType(ConnectorType connectorType) {
		this.connectorType = connectorType;
	}

	public String getCustomConnectorClassName() {
		return customConnectorClassName;
	}

	public void setCustomConnectorClassName(String customConnectorClassName) {
		this.customConnectorClassName = customConnectorClassName;
	}
	
	public int getMaxPoolValidity() {
		return maxPoolValidity;
	}

	public void setMaxPoolValidity(int maxPoolValidity) {
		this.maxPoolValidity = maxPoolValidity;
	}

	
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = super.hashCode();
		result = prime * result + ((configuration == null) ? 0 : configuration.hashCode());
		result = prime * result + ((connectorType == null) ? 0 : connectorType.hashCode());
		result = prime * result + ((customConnectorClassName == null) ? 0 : customConnectorClassName.hashCode());
		result = prime * result + ((description == null) ? 0 : description.hashCode());
		result = prime * result + (int) (id ^ (id >>> 32));
		result = prime * result + maxPoolValidity;
		result = prime * result + ((name == null) ? 0 : name.hashCode());
		result = prime * result + poolSize;
		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;
		ConnectorConfiguration other = (ConnectorConfiguration) obj;
		if (configuration == null) {
			if (other.configuration != null)
				return false;
		} else if (!configuration.equals(other.configuration))
			return false;
		if (connectorType != other.connectorType)
			return false;
		if (customConnectorClassName == null) {
			if (other.customConnectorClassName != null)
				return false;
		} else if (!customConnectorClassName.equals(other.customConnectorClassName))
			return false;
		if (description == null) {
			if (other.description != null)
				return false;
		} else if (!description.equals(other.description))
			return false;
		if (id != other.id)
			return false;
		if (maxPoolValidity != other.maxPoolValidity)
			return false;
		if (name == null) {
			if (other.name != null)
				return false;
		} else if (!name.equals(other.name))
			return false;
		if (poolSize != other.poolSize)
			return false;
		return true;
	}

	
	
	
	
	public be.personify.util.provisioning.ConnectorConfiguration toGeneric() {
		be.personify.util.provisioning.ConnectorConfiguration generic = new be.personify.util.provisioning.ConnectorConfiguration();
		generic.setConfiguration(configuration);
		generic.setConnectorType(connectorType);
		generic.setCustomConnectorClassName(customConnectorClassName);
		generic.setDescription(description);
		generic.setId(id);
		generic.setMaxPoolValidity(maxPoolValidity);
		generic.setName(name);
		generic.setPoolSize(poolSize);
		return generic;
	}
	
	

	
	
	

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy