performed javacscript:fix and worked on documentation
[taxeditor.git] / taxeditor-navigation / src / main / java / eu / etaxonomy / taxeditor / navigation / navigator / Root.java
1 // $Id$
2 /**
3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
6 *
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
9 */
10
11 package eu.etaxonomy.taxeditor.navigation.navigator;
12
13 import java.util.List;
14
15 import org.apache.log4j.Logger;
16 import org.eclipse.core.runtime.IAdaptable;
17 import org.eclipse.core.runtime.PlatformObject;
18 import org.eclipse.ui.IElementFactory;
19 import org.eclipse.ui.IMemento;
20 import org.eclipse.ui.IPersistableElement;
21
22 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
23 import eu.etaxonomy.cdm.model.taxon.TaxonomicTree;
24 import eu.etaxonomy.taxeditor.store.CdmStore;
25
26 /**
27 * <p>Root class.</p>
28 *
29 * @author p.ciardelli
30 * @created 02.06.2009
31 * @version 1.0
32 */
33 public class Root extends PlatformObject implements IAdaptable, IPersistableElement, IElementFactory {
34
35 private static final Logger logger = Logger.getLogger(Root.class);
36
37 private ConversationHolder conversation;
38
39 /**
40 * <p>Constructor for Root.</p>
41 *
42 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
43 */
44 public Root (ConversationHolder conversation){
45 this.conversation = conversation;
46 }
47
48 /**
49 * <p>getParentBeans</p>
50 *
51 * @return a {@link java.util.List} object.
52 */
53 public List<TaxonomicTree> getParentBeans() {
54 List<TaxonomicTree> classifications = CdmStore.getTaxonTreeService().list(null, null, null, null, null);
55
56 if(classifications.size() == 0){
57 CdmStore.createDefaultClassification(conversation);
58 classifications = CdmStore.getTaxonTreeService().list(null, null, null, null, null);
59 }
60
61 return classifications;
62 }
63
64 /* (non-Javadoc)
65 * @see org.eclipse.ui.IPersistableElement#getFactoryId()
66 */
67 /**
68 * <p>getFactoryId</p>
69 *
70 * @return a {@link java.lang.String} object.
71 */
72 public String getFactoryId() {
73 return null;
74 }
75
76 /* (non-Javadoc)
77 * @see org.eclipse.ui.IPersistable#saveState(org.eclipse.ui.IMemento)
78 */
79 /** {@inheritDoc} */
80 public void saveState(IMemento memento) {
81 }
82
83 /* (non-Javadoc)
84 * @see org.eclipse.ui.IElementFactory#createElement(org.eclipse.ui.IMemento)
85 */
86 /** {@inheritDoc} */
87 public IAdaptable createElement(IMemento memento) {
88 return null;
89 }
90 }