Project

General

Profile

Download (2.02 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
    reference;
29

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

    
36

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

    
39
    private DataPortalContext() {
40

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

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

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

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

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

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

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

    
77
}
(2-2/7)