fix #5967 Fix version check for stable release
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / util / ApplicationUtil.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.util;
12
13 import org.eclipse.core.runtime.Platform;
14 import org.osgi.framework.Bundle;
15
16 import eu.etaxonomy.taxeditor.model.AbstractUtility;
17
18 /**
19 * <p>ApplicationUtil class.</p>
20 *
21 * @author n.hoffmann
22 * @created Oct 13, 2010
23 * @version 1.0
24 */
25 public class ApplicationUtil extends AbstractUtility {
26
27
28 /**
29 * Prefix to declare the version as beta
30 */
31 private static final String BETA_PREFIX = "[BETA]";
32
33 public static String getTitle() {
34 return "EDIT Taxonomic Editor " + ApplicationUtil.getVersion();
35 }
36 /**
37 * @return
38 */
39 public static String getVersion() {
40 Bundle bundle = Platform.getBundle("eu.etaxonomy.taxeditor.application");
41 String version = bundle.getHeaders().get(org.osgi.framework.Constants.BUNDLE_VERSION);
42 // Checking if this is a beta (snapshot) version
43 if(version ==null || version.isEmpty()) {
44 return "";
45 }
46 String[] parts = version.split("\\.");
47 if(parts.length <= 3) {
48 // this is a stable version
49 return version;
50 } else {
51 return BETA_PREFIX + " " + version + " UTC";
52 }
53
54 }
55
56 /**
57 * @return
58 */
59 public static boolean isStable() {
60 return !getVersion().startsWith(BETA_PREFIX);
61 }
62
63
64 }