Re-implemented taxonomic tree using Common Navigator Framework.
[taxeditor.git] / taxeditor-store / src / main / java / eu / etaxonomy / taxeditor / store / model / ReferenceUtil.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.store.model;
12
13 import eu.etaxonomy.cdm.model.common.ReferencedEntityBase;
14 import eu.etaxonomy.cdm.model.reference.Generic;
15 import eu.etaxonomy.cdm.model.reference.ReferenceBase;
16
17 /**
18 * @author p.ciardelli
19 * @created 02.04.2009
20 * @version 1.0
21 */
22 public class ReferenceUtil {
23 /**
24 * Returns the entity's citation. If none exists, gives the
25 * entity a Generic citation.
26 *
27 * @param entity
28 * @return
29 */
30 public static ReferenceBase<?> getOrCreateCitation(ReferencedEntityBase entity) {
31 ReferenceBase<?> citation = entity.getCitation();
32 if (citation == null) {
33 citation = Generic.NewInstance();
34 entity.setCitation(citation);
35 }
36 return citation;
37 }
38 }