class OrganisationUnit extends
    BaseDimensionalItemObject implements
    MetadataObject,
    CoordinateObject {

    @JsonProperty( "ancestors" )
    @JsonSerialize( contentAs = BaseIdentifiableObject.class )
    @JacksonXmlElementWrapper( localName = "ancestors", namespace = DxfNamespaces.DXF_2_0 )
    @JacksonXmlProperty( localName = "organisationUnit", namespace = DxfNamespaces.DXF_2_0 )
    public List<OrganisationUnit> getAncestors()
    {
        List<OrganisationUnit> units = new ArrayList<>();
        Set<OrganisationUnit> visitedUnits = new HashSet<>();

        OrganisationUnit unit = parent;

        while ( unit != null )
        {
            if ( !visitedUnits.add( unit ) )
            {
                throw new IllegalStateException(
                    "Organisation unit '" + this.toString() + "' has circular parent relationships: '" + unit + "'" );
            }

            units.add( unit );
            unit = unit.getParent();
        }

        Collections.reverse( units );
        return units;
    }

    public  OrganisationUnit();
    public  OrganisationUnit( String name );
    public  OrganisationUnit( String name, String shortName, String code, Date openingDate, Date closedDate,
        String comment );
    public  OrganisationUnit( String name, OrganisationUnit parent, String shortName, String code, Date openingDate,
        Date closedDate, String comment );

}