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

be.personify.iam.model.provisioning.TargetSystem 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.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.ElementCollection;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Index;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;

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

@Entity
@MetaInfo( group="provisioning", frontendGroup="TargetSystem", name="TargetSystem", description="A targetsystem", iconClass="bullseye", 
				sortOrderInGroup=1,
				showInMenu=true,
				showDeleteButtonOnSearchResult = false,
				number=1,
				workflowEnabled = false,
				rst_include_description = true,
				rst_include_extra = true
)
@Table(name="target_system", indexes = {
		@Index(name = "idx_target_system_name", columnList = "name", unique=true),
		@Index(name = "idx_target_system_code", columnList = "code", unique=true)
})
public class TargetSystem extends Persisted implements Serializable {
	
	private static final long serialVersionUID = -3062392909644322940L;
	
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@MetaInfo(name="id", description="the id of the targetsystem", searchable=false,showInSearchResultGrid=false)
	private long id;
	
	@Column(nullable=false)
	@MetaInfo(name="name",description="the name of the targetsystem",sampleValue="authentication_ldap")
	private String name;
	
	@Column(nullable=false)
	@MetaInfo(name="code",description="the code of the targetsystem",sampleValue="001", searchable = true, showInSearchResultGrid = false)
	private String code;
	
	@MetaInfo(name="description",description="the description of the targetsystem", customRenderer = "text_area|rows:3", sampleValue="ldap used for authentication", searchable = false, showInSearchResultGrid = false)
	private String description;
	
	@MetaInfo(name="active",description="indicating if the targetsystem is active",sampleValue="true")
	private boolean active;
	
	@MetaInfo(searchable=false, showInSearchResultGrid=false, name="updateIfIdentical", viewable = false,
			description="during provisioning force update even soure and target are identical",sampleValue="false")
	private boolean updateIfIdentical;
	
	
	@MetaInfo(searchable=false, showInSearchResultGrid=false, viewable = false, name="supportsPagination", description="indicates if the targetsystem_ supports paging", sampleValue="true")
	private boolean supportsPagination;
	
	@MetaInfo(searchable=false, showInSearchResultGrid=false, viewable = false, name="userPasswordEnabled", description="indicates if the targetsystem supports userPassword", sampleValue="true")
	private boolean supportsUserPassword;
	
	@MetaInfo(searchable=false, showInSearchResultGrid=false,name="pingEnabled", description="activates the ping of the targetsystem, see pingresult_", sampleValue="true")
	private boolean pingEnabled;
	
	@MetaInfo(name="notifyOnFailedPing", description="specifies if notification has to be sent on failure", searchable = false, showInSearchResultGrid = false)
	private boolean notifyOnFailedPing;
	
	@OneToMany(cascade=CascadeType.ALL, mappedBy="targetSystem")
	@ElementCollection(targetClass=TargetSystemAttribute.class)
	@MetaInfo(name="TargetSystemAttributes", description="A list containing the attributes present in the remote targetsystem_. See targetsystemattribute_")
	private List targetSystemAttributes;
	
	@OneToMany(cascade=CascadeType.ALL, mappedBy="targetSystem")
	@ElementCollection(targetClass=TargetSystemAttributeMapping.class)
	@MetaInfo(name="TargetSystemAttributeMappings", description="A list containing the attributemappings present in the remote targetsystem_. See targetsystemattributemapping_")
	private List targetSystemAttributeMappings;
	
	@OneToMany(cascade=CascadeType.ALL)
	@JoinColumn(name = "target_system_id")
	@ElementCollection(targetClass=ProvisionDecision.class)
	@MetaInfo(name="Provision decisions", description="A list containing the decisions to be made during the provisioning proces. See provisiondecision_")
	private List provisionDecisions;
	
	@MetaInfo(searchable=false, showInSearchResultGrid=false, name="Connector configuration",description="The configration of the connector and it's implementation. See connectorconfiguration_ and connectorimplementation_", editable = true)
	@OneToOne
	private ConnectorConfiguration connectorConfiguration;
	
	@MetaInfo(searchable=false, showInSearchResultGrid=false, name="Accountid generator", description="Accountid generator to be used (optional). See accountidgenerator_", editable = true)
	@ManyToOne
	private AccountIdGenerator accountIdGenerator;
	
		

	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 boolean isActive() {
		return active;
	}

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

	
	public ConnectorConfiguration getConnectorConfiguration() {
		return connectorConfiguration;
	}

	public void setConnectorConfiguration(ConnectorConfiguration connectorConfiguration) {
		this.connectorConfiguration = connectorConfiguration;
	}


	public List getTargetSystemAttributes() {
		return targetSystemAttributes;
	}

	public void setTargetSystemAttributes(List targetSystemAttributes) {
		this.targetSystemAttributes = targetSystemAttributes;
	}

	public List getProvisionDecisions() {
		return provisionDecisions;
	}

	public void setProvisionDecisions(List provisionDecisions) {
		this.provisionDecisions = provisionDecisions;
	}

	public boolean isUpdateIfIdentical() {
		return updateIfIdentical;
	}

	public void setUpdateIfIdentical(boolean updateIfIdentical) {
		this.updateIfIdentical = updateIfIdentical;
	}

	public AccountIdGenerator getAccountIdGenerator() {
		return accountIdGenerator;
	}
	
	public boolean isSupportsPagination() {
		return supportsPagination;
	}

	public void setSupportsPagination(boolean supportsPagination) {
		this.supportsPagination = supportsPagination;
	}

	public void setAccountIdGenerator(AccountIdGenerator accountIdGenerator) {
		this.accountIdGenerator = accountIdGenerator;
	}

	public TargetSystemAttribute calculatePrimaryKeyAttribute() {
		for ( TargetSystemAttribute attribute : getTargetSystemAttributes()) {
			if ( attribute.isPrimaryKey()) {
				return attribute;
			}
		}
		throw new RuntimeException("the primary key attribute is not found for targetsystem [" + getName() + "]");
	}

	public boolean isPingEnabled() {
		return pingEnabled;
	}

	public void setPingEnabled(boolean pingEnabled) {
		this.pingEnabled = pingEnabled;
	}

	public List getTargetSystemAttributeMappings() {
		return targetSystemAttributeMappings;
	}

	public void setTargetSystemAttributeMappings(List targetSystemAttributeMappings) {
		this.targetSystemAttributeMappings = targetSystemAttributeMappings;
	}
	
	

	public boolean isSupportsUserPassword() {
		return supportsUserPassword;
	}

	public void setSupportsUserPassword(boolean supportsUserPassword) {
		this.supportsUserPassword = supportsUserPassword;
	}
	
	

	public boolean isNotifyOnFailedPing() {
		return notifyOnFailedPing;
	}

	public void setNotifyOnFailedPing(boolean notifyOnFailedPing) {
		this.notifyOnFailedPing = notifyOnFailedPing;
	}
	
	
	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = super.hashCode();
		result = prime * result + ((accountIdGenerator == null) ? 0 : accountIdGenerator.hashCode());
		result = prime * result + (active ? 1231 : 1237);
		result = prime * result + ((code == null) ? 0 : code.hashCode());
		result = prime * result + ((connectorConfiguration == null) ? 0 : connectorConfiguration.hashCode());
		result = prime * result + ((description == null) ? 0 : description.hashCode());
		result = prime * result + (int) (id ^ (id >>> 32));
		result = prime * result + ((name == null) ? 0 : name.hashCode());
		result = prime * result + (notifyOnFailedPing ? 1231 : 1237);
		result = prime * result + (pingEnabled ? 1231 : 1237);
		result = prime * result + ((provisionDecisions == null) ? 0 : provisionDecisions.hashCode());
		result = prime * result + (supportsPagination ? 1231 : 1237);
		result = prime * result + (supportsUserPassword ? 1231 : 1237);
		result = prime * result
				+ ((targetSystemAttributeMappings == null) ? 0 : targetSystemAttributeMappings.hashCode());
		result = prime * result + ((targetSystemAttributes == null) ? 0 : targetSystemAttributes.hashCode());
		result = prime * result + (updateIfIdentical ? 1231 : 1237);
		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;
		TargetSystem other = (TargetSystem) obj;
		if (accountIdGenerator == null) {
			if (other.accountIdGenerator != null)
				return false;
		} else if (!accountIdGenerator.equals(other.accountIdGenerator))
			return false;
		if (active != other.active)
			return false;
		if (code == null) {
			if (other.code != null)
				return false;
		} else if (!code.equals(other.code))
			return false;
		if (connectorConfiguration == null) {
			if (other.connectorConfiguration != null)
				return false;
		} else if (!connectorConfiguration.equals(other.connectorConfiguration))
			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 (name == null) {
			if (other.name != null)
				return false;
		} else if (!name.equals(other.name))
			return false;
		if (notifyOnFailedPing != other.notifyOnFailedPing)
			return false;
		if (pingEnabled != other.pingEnabled)
			return false;
		if (provisionDecisions == null) {
			if (other.provisionDecisions != null)
				return false;
		} else if (!provisionDecisions.equals(other.provisionDecisions))
			return false;
		if (supportsPagination != other.supportsPagination)
			return false;
		if (supportsUserPassword != other.supportsUserPassword)
			return false;
		if (targetSystemAttributeMappings == null) {
			if (other.targetSystemAttributeMappings != null)
				return false;
		} else if (!targetSystemAttributeMappings.equals(other.targetSystemAttributeMappings))
			return false;
		if (targetSystemAttributes == null) {
			if (other.targetSystemAttributes != null)
				return false;
		} else if (!targetSystemAttributes.equals(other.targetSystemAttributes))
			return false;
		if (updateIfIdentical != other.updateIfIdentical)
			return false;
		return true;
	}

	
	

	
	public be.personify.util.provisioning.TargetSystem toGenericTargetSystem(){
		be.personify.util.provisioning.TargetSystem genericTargetSystem = new be.personify.util.provisioning.TargetSystem();
		if ( accountIdGenerator != null) {
			genericTargetSystem.setAccountIdGenerator(accountIdGenerator.toGeneric());
		}
		genericTargetSystem.setActive(active);
		genericTargetSystem.setCode(code);
		if ( connectorConfiguration != null ) {
			genericTargetSystem.setConnectorConfiguration(connectorConfiguration.toGeneric());
		}
		genericTargetSystem.setDescription(description);
		genericTargetSystem.setId(id);
		genericTargetSystem.setName(name);
		genericTargetSystem.setNotifyOnFailedPing(notifyOnFailedPing);
		genericTargetSystem.setPingEnabled(pingEnabled);
		genericTargetSystem.setProvisionDecisions(ProvisionDecision.toGenericList(provisionDecisions));
		genericTargetSystem.setSupportsPagination(supportsPagination);
		genericTargetSystem.setSupportsUserPassword(supportsUserPassword);
		genericTargetSystem.setTargetSystemAttributeMappings(TargetSystemAttributeMapping.toGenericList(targetSystemAttributeMappings));
		genericTargetSystem.setTargetSystemAttributes(TargetSystemAttribute.toGenericList(targetSystemAttributes));
		genericTargetSystem.setUpdateIfIdentical(updateIfIdentical);
		return genericTargetSystem;
	}
	
	
	
	
	

	

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy