12f1e3585442b6b1f1317c88aa0f90e04eba0f14
[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 org.apache.log4j.Logger;
13
14 import eu.etaxonomy.cdm.model.name.ZoologicalName;
15
16 /**
17 * Property source for ZoologicalName entries.
18 *
19 * @author p.ciardelli
20 * @created 21.05.2008
21 * @version 1.0
22 */
23 public class ZoologicalNamePropertySource extends NonViralNamePropertySource {
24 private static final Logger logger = Logger
25 .getLogger(ZoologicalNamePropertySource.class);
26
27 private ZoologicalName zoologicalName;
28
29 // Property unique keys
30 public static final String P_ID_PUBLICATIONYEAR = "publicationyear";
31 // Property display keys
32 // public static final String P_PUBLICATIONYEAR = "099:Publication Year";
33 public static final String P_PUBLICATIONYEAR = "Publication Year";
34
35 public ZoologicalNamePropertySource(ZoologicalName name) {
36 super(name);
37 this.zoologicalName = name;
38 addDescriptor(P_ID_PUBLICATIONYEAR);
39 }
40
41 @Override
42 public Object getPropertyValue(Object id) {
43 if (id.equals(P_ID_NOMENCLATURAL_CODE)) {
44 return "ICZN";
45 }
46 if (id.equals(P_ID_PUBLICATIONYEAR)) {
47 String publicationYear = Integer.toString(zoologicalName.getPublicationYear());
48 if (publicationYear.equals("0")) {
49 return "";
50 } else {
51 return publicationYear;
52 }
53 }
54 return super.getPropertyValue(id);
55 }
56 }