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

org.ligoj.app.iam.CompanyOrg Maven / Gradle / Ivy

The newest version!
/*
 * Licensed under MIT (https://github.com/ligoj/ligoj/blob/master/LICENSE)
 */
package org.ligoj.app.iam;

import java.util.ArrayList;
import java.util.List;

import javax.naming.ldap.LdapName;

import lombok.Getter;
import lombok.Setter;

/**
 * An organizational company.
 */
@Getter
@Setter
public class CompanyOrg extends ContainerOrg {

	/**
	 * SID
	 */
	private static final long serialVersionUID = 1L;

	/**
	 * This company and the parents.
	 */
	private List companyTree = new ArrayList<>();

	/**
	 * LDAP Name. Is null while not computed.
	 */
	private LdapName ldapName;

	/**
	 * All arguments constructor.
	 *
	 * @param dn   Corresponds to the "Distinguished Name". Will be saved in "description".
	 * @param name "name" corresponds to the "Organizational Unit". Will be saved in "name", and in "id" in is
	 *             normalized form.
	 */
	public CompanyOrg(final String dn, final String name) {
		super(dn, name);
		companyTree.add(this);
	}

	@Override
	public boolean equals(final Object other) {
		return other instanceof CompanyOrg org && getId().equals(org.getId());
	}

	@Override
	public int hashCode() {
		return getId().hashCode();
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy