Project

General

Profile

Download (2.08 KB) Statistics
| Branch: | Tag: | Revision:
1
// $Id$
2
/**
3
 * Copyright (C) 2009 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
package eu.etaxonomy.dataportal;
11

    
12
import java.net.URI;
13
import java.util.UUID;
14

    
15
import org.apache.log4j.Logger;
16

    
17
/**
18
 *
19
 * @author a.kohlbecker
20
 *
21
 */
22
public enum DataPortalContext {
23

    
24
    cichorieae,
25
    palmae,
26
    cyprus,
27
    floramalesiana;
28

    
29
    URI baseUri;
30
    URI cdmServerUri;
31
    UUID classificationUUID;
32
    String siteName; //TODO could be read with drush: $ drush vget site_name
33
    String themeName;
34

    
35

    
36
    public final Logger logger = Logger.getLogger(DataPortalContext.class);
37

    
38
    private DataPortalContext() {
39

    
40
        try {
41
            this.baseUri = TestConfiguration.getProperty(composePropertyKey("baseUri"), URI.class, true);
42
            this.cdmServerUri = TestConfiguration.getProperty(composePropertyKey("cdmServerUri"), URI.class, false);
43
            this.classificationUUID = TestConfiguration.getProperty(composePropertyKey("classificationUUID"), UUID.class, true);
44
            this.siteName = TestConfiguration.getProperty(composePropertyKey("siteName"));
45
        } catch (TestConfigurationException e) {
46
            logger.error("Configuration Error: ", e);
47
            System.exit(-1);
48
        }
49
    }
50

    
51
    private String composePropertyKey(String fieldName) {
52
        String key = this.getClass().getSimpleName().substring(0, 1).toLowerCase() + this.getClass().getSimpleName().substring(1) + "." + this.name() + "." + fieldName;
53
        return key;
54
    }
55

    
56
    public URI getBaseUri() {
57
        return baseUri;
58
    }
59

    
60
    public URI getCdmServerUri() {
61
        return cdmServerUri;
62
    }
63

    
64
    public UUID getClassificationUUID() {
65
        return classificationUUID;
66
    }
67

    
68
    public String getSiteName() {
69
        return siteName;
70
    }
71

    
72
    public String prepareTitle(String pageHeader) {
73
        return pageHeader + " | " + getSiteName();
74
    }
75

    
76
}
(2-2/7)