001/*
002 *  Copyright 2016 Anyware Services
003 *
004 *  Licensed under the Apache License, Version 2.0 (the "License");
005 *  you may not use this file except in compliance with the License.
006 *  You may obtain a copy of the License at
007 *
008 *      http://www.apache.org/licenses/LICENSE-2.0
009 *
010 *  Unless required by applicable law or agreed to in writing, software
011 *  distributed under the License is distributed on an "AS IS" BASIS,
012 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 *  See the License for the specific language governing permissions and
014 *  limitations under the License.
015 */
016package org.ametys.plugins.workspaces.project.objects;
017
018import org.ametys.plugins.repository.AmetysObject;
019import org.ametys.plugins.repository.TraversableAmetysObject;
020
021/**
022 * Node of the project tree.
023 */
024public interface ProjectsTreeNode extends TraversableAmetysObject
025{
026    /**
027     * Get the path of this node in the projects tree
028     * @return The projects tree path
029     */
030    public default String getProjectsTreePath()
031    {
032        String path = getName();
033        
034        AmetysObject parent = getParent();
035        if (parent instanceof ProjectsTreeNode)
036        {
037            path = ((ProjectsTreeNode) parent).getProjectsTreePath() + "/" + path;
038        }
039        
040        return path;
041    }
042}