1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
13   */
14  
15  package com.liferay.portlet.tags.model.impl;
16  
17  import com.liferay.portal.PortalException;
18  import com.liferay.portal.SystemException;
19  import com.liferay.portal.kernel.util.StringPool;
20  import com.liferay.portlet.tags.NoSuchEntryException;
21  import com.liferay.portlet.tags.model.TagsEntry;
22  import com.liferay.portlet.tags.model.TagsEntryConstants;
23  import com.liferay.portlet.tags.model.TagsVocabulary;
24  import com.liferay.portlet.tags.service.TagsEntryLocalServiceUtil;
25  import com.liferay.portlet.tags.service.TagsVocabularyLocalServiceUtil;
26  
27  /**
28   * <a href="TagsEntryImpl.java.html"><b><i>View Source</i></b></a>
29   *
30   * @author Brian Wing Shun Chan
31   * @author Jorge Ferrer
32   * @author Bruno Farache
33   */
34  public class TagsEntryImpl extends TagsEntryModelImpl implements TagsEntry {
35  
36      public TagsEntryImpl() {
37      }
38  
39      public String getParentName() throws PortalException, SystemException {
40          String name = StringPool.BLANK;
41  
42          if (getParentEntryId() == TagsEntryConstants.DEFAULT_PARENT_ENTRY_ID) {
43              return name;
44          }
45  
46          try {
47              name = TagsEntryLocalServiceUtil.getEntry(
48                  getParentEntryId()).getName();
49          }
50          catch (NoSuchEntryException nsee) {
51          }
52  
53          return name;
54      }
55  
56      public TagsVocabulary getVocabulary()
57          throws PortalException, SystemException {
58  
59          return TagsVocabularyLocalServiceUtil.getVocabulary(getVocabularyId());
60      }
61  
62      public boolean isCategory() throws PortalException, SystemException {
63          TagsVocabulary vocabulary = getVocabulary();
64  
65          if (vocabulary.isFolksonomy()) {
66              return false;
67          }
68          else {
69              return true;
70          }
71      }
72  
73  }