editor now updatable via updateSite
[taxeditor.git] / taxeditor-editor / src / main / java / eu / etaxonomy / taxeditor / propertysheet / name / ZoologicalNamePropertySource.java
1 /**
2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
5 *
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
8 */
9
10 package eu.etaxonomy.taxeditor.propertysheet.name;
11
12 import eu.etaxonomy.cdm.model.name.ZoologicalName;
13
14 /**
15 * Property source for ZoologicalName entries.
16 *
17 * @author p.ciardelli
18 * @created 21.05.2008
19 * @version 1.0
20 */
21 public class ZoologicalNamePropertySource extends NonViralNamePropertySource {
22
23 private ZoologicalName zoologicalName;
24
25 // Property unique keys
26 public static final String P_ID_PUBLICATIONYEAR = "publicationyear";
27 // Property display keys
28 // public static final String P_PUBLICATIONYEAR = "099:Publication Year";
29 public static final String P_PUBLICATIONYEAR = "Publication Year";
30
31 public ZoologicalNamePropertySource(ZoologicalName name) {
32 super(name);
33 this.zoologicalName = name;
34 addDescriptor(P_ID_PUBLICATIONYEAR);
35 }
36
37 @Override
38 public Object getPropertyValue(Object id) {
39 if (id.equals(P_ID_NOMENCLATURAL_CODE)) {
40 return "ICZN";
41 }
42 if (id.equals(P_ID_PUBLICATIONYEAR)) {
43 String publicationYear = Integer.toString(zoologicalName.getPublicationYear());
44 if (publicationYear.equals("0")) {
45 return "";
46 } else {
47 return publicationYear;
48 }
49 }
50 return super.getPropertyValue(id);
51 }
52 }