title: Get first-level categories in liferay 7
body: <p>I am facing a problem in getting the categories in Liferay 7,
  I am using the ADT to get categories of specific vocabulary as following : </p>
  
  <pre><code>&lt;#if entries?has_content&gt;
   &lt;#list entries as entry&gt;
    &lt;#assign categories = entry.getCategories()&gt;
    &lt;#list categories as category&gt;
      &lt;a&gt;${category.getName()}&lt;/a&gt;
    &lt;/#list&gt;
   &lt;/#list&gt;
  &lt;/#if&gt;
  </code></pre>
  
  <p>entry type is  : AssetVocabulary</p>
  
  <p>my problem is : I am getting the whole categories and sub categories of the vocabulary</p>
  
  <p>for example I have this categories : </p>
  
  <ul>
  <li>fruits ( apples - banana )</li>
  <li>vegetables</li>
  <li>meat</li>
  </ul>
  
  <p>so in the results I am getting all categories and sub categories as :</p>
  
  <ul>
  <li>fruits</li>
  <li>apples </li>
  <li>banana</li>
  <li>vegetables</li>
  <li>meat</li>
  </ul>
  
  <p>but what i need is : </p>
  
  <ul>
  <li>fruits</li>
  <li>vegetables</li>
  <li>meat</li>
  </ul>
  
  <p>I hope that I can find help here , thank you in advance</p>